| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | * Author: wpLingua Translation Service |
| 7 | 7 | * Author URI: https://wplingua.com/ |
| 8 | 8 | * Text Domain: wplingua |
| 9 | 9 | * Domain Path: /languages/ |
| 10 | - * Version: 2.13.0 | |
| 10 | + * Version: 2.16.7 | |
| 11 | 11 | * Requires PHP: 7.4 |
| 12 | 12 | * License: GPL v2 or later |
| 13 | 13 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 14 | 14 | */ |
| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | // Define wpLingua constants |
| 24 | 24 | define( 'WPLNG_API_URL', 'https://api.wplingua.com' ); |
| 25 | 25 | define( 'WPLNG_API_VERSION', '3.0' ); |
| 26 | 26 | define( 'WPLNG_API_SSLVERIFY', true ); |
| 27 | -define( 'WPLNG_PLUGIN_VERSION', '2.13.0' ); | |
| 27 | +define( 'WPLNG_PLUGIN_VERSION', '2.16.7' ); | |
| 28 | 28 | define( 'WPLNG_PLUGIN_FILE', plugin_basename( __FILE__ ) ); |
| 29 | 29 | define( 'WPLNG_PLUGIN_DIR', __DIR__ ); |
| 30 | 30 | define( 'WPLNG_CACHE_DIR', WP_CONTENT_DIR . '/wplingua-cache' ); |
| 31 | 31 | define( 'WPLNG_PHP_MIN_VERSION', '7.4' ); |
| @@ -105,11 +105,13 @@ | ||
| 105 | 105 | // Update version number in DB |
| 106 | 106 | update_option( 'wplng_version', WPLNG_PLUGIN_VERSION, true ); |
| 107 | 107 | |
| 108 | 108 | // Clear all wpLingua cache |
| 109 | - wplng_clear_translations_cache(); | |
| 110 | - wplng_clear_slugs_cache(); | |
| 109 | + delete_option( 'wplng_cached_translations' ); | |
| 110 | + delete_option( 'wplng_cached_slugs' ); | |
| 111 | + delete_option( 'wplng_api_key_data' ); | |
| 111 | 112 | wplng_clear_folder_cache(); |
| 113 | + wplng_clear_website_cache(); | |
| 112 | 114 | |
| 113 | 115 | // Clear old cache method (version <= 2.12.3) |
| 114 | 116 | delete_transient( 'wplng_cached_translations' ); |
| 115 | 117 | delete_transient( 'wplng_cached_slugs' ); |
| @@ -129,10 +131,10 @@ | ||
| 129 | 131 | add_action( 'admin_notices', 'wplng_admin_notice_incompatible_plain_permalink', 1 ); |
| 130 | 132 | |
| 131 | 133 | // Return if incompatibility is detected |
| 132 | 134 | if ( ! empty( wplng_get_incompatible_plugins() ) |
| 133 | - || ( is_multisite() | |
| 134 | - && ! apply_filters( 'wplng_bypass_multisite_incompatibility', false ) | |
| 135 | + || ( is_multisite() | |
| 136 | + && ! apply_filters( 'wplng_bypass_multisite_incompatibility', false ) | |
| 135 | 137 | ) |
| 136 | 138 | || ( version_compare( PHP_VERSION, WPLNG_PHP_MIN_VERSION ) < 0 ) |
| 137 | 139 | || ! wplng_htaccess_is_valid() |
| 138 | 140 | || empty( get_option( 'permalink_structure' ) ) |
| @@ -174,8 +176,11 @@ | ||
| 174 | 176 | */ |
| 175 | 177 | |
| 176 | 178 | // Add menu in back office |
| 177 | 179 | add_action( 'admin_menu', 'wplng_create_menu' ); |
| 180 | + add_filter( 'parent_file', 'wplng_option_page_parent_file' ); | |
| 181 | + add_filter( 'submenu_file', 'wplng_option_page_submenu_file' ); | |
| 182 | + add_action( 'admin_head', 'wplng_option_page_hide_submenu' ); | |
| 178 | 183 | |
| 179 | 184 | // Add admin Bar menu |
| 180 | 185 | add_action( 'admin_bar_menu', 'wplng_admin_bar_menu', 81 ); |
| 181 | 186 | add_action( 'admin_bar_menu', 'wplng_admin_bar_edit', 81 ); |
| @@ -194,8 +199,12 @@ | ||
| 194 | 199 | |
| 195 | 200 | // Update flags URL |
| 196 | 201 | add_action( 'update_option_wplng_flags_style', 'wplng_options_switcher_update_flags_style', 10, 2 ); |
| 197 | 202 | |
| 203 | + // Update translations on dictionary changes | |
| 204 | + add_action( 'update_option_wplng_dictionary_entries', 'wplng_on_dictionary_entries_updated', 10, 2 ); | |
| 205 | + add_action( 'wp_ajax_wplng_dictionary_update_translations', 'wplng_ajax_dictionary_update_translations' ); | |
| 206 | + | |
| 198 | 207 | // Reset API data on API key changing |
| 199 | 208 | add_action( 'update_option_wplng_api_key', 'wplng_on_update_option_wplng_api_key', 10, 2 ); |
| 200 | 209 | |
| 201 | 210 | // Add edit link on page and post list |
| @@ -201,8 +210,11 @@ | ||
| 201 | 210 | // Add edit link on page and post list |
| 202 | 211 | add_filter( 'page_row_actions', 'wplng_row_edit_translation_link', 10, 2 ); |
| 203 | 212 | add_filter( 'post_row_actions', 'wplng_row_edit_translation_link', 10, 2 ); |
| 204 | 213 | |
| 214 | + // Notice for obtaining the PRO version | |
| 215 | + // add_action( 'admin_notices', 'wplng_admin_notice_get_pro_version', 1 ); | |
| 216 | + | |
| 205 | 217 | /** |
| 206 | 218 | * wplng_translation : CPT, taxo, meta |
| 207 | 219 | */ |
| 208 | 220 | |
| @@ -341,8 +353,11 @@ | ||
| 341 | 353 | add_action( 'init', 'wplng_ob_start', 1 ); |
| 342 | 354 | |
| 343 | 355 | // Redirect page if is called with an untranslate slug |
| 344 | 356 | add_action( 'template_redirect', 'wplng_redirect_translated_slug' ); |
| 357 | + | |
| 358 | + // Translate WooCommerce cart URL | |
| 359 | + add_filter( 'woocommerce_get_cart_url', 'wplng_url_translate' ); | |
| 345 | 360 | |
| 346 | 361 | /** |
| 347 | 362 | * Generate JSON translation on the fly for wp-i18n.js |
| 348 | 363 | */ |