PluginProbe
Translate and Go multilingual – Automatic AI translation – wpLingua / 2.16.7
Translate and Go multilingual – Automatic AI translation – wpLingua v2.16.7
2.16.7 2.16.6 2.16.5 2.16.4 2.16.3 2.16.2 2.16.1 2.16.0 2.15.2 2.15.1 2.15.0 2.14.3 2.14.2 2.14.1 2.14.0 2.13.1 2.13.0 2.12.3 2.12.2 2.12.1 trunk 1.0.3 1.0.4 1.0.5 1.1.0 All 112 releases
← All changes | wplingua.php +44 -5 2.12.32.16.7 View file →
@@ -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.12.3
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.12.3' );
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' );
@@ -101,12 +101,21 @@
101 101 }
102 102
103 103 // The plugin version has changed
104 104 if ( get_option( 'wplng_version' ) !== WPLNG_PLUGIN_VERSION ) {
105 + // Update version number in DB
105 106 update_option( 'wplng_version', WPLNG_PLUGIN_VERSION, true );
106 - wplng_clear_translations_cache();
107 - wplng_clear_slugs_cache();
107 +
108 + // Clear all wpLingua cache
109 + delete_option( 'wplng_cached_translations' );
110 + delete_option( 'wplng_cached_slugs' );
111 + delete_option( 'wplng_api_key_data' );
108 112 wplng_clear_folder_cache();
113 + wplng_clear_website_cache();
114 +
115 + // Clear old cache method (version <= 2.12.3)
116 + delete_transient( 'wplng_cached_translations' );
117 + delete_transient( 'wplng_cached_slugs' );
109 118 }
110 119
111 120 // Load plugin text domain /languages/
112 121 add_action( 'init', 'wplng_load_plugin_textdomain' );
@@ -122,9 +131,11 @@
122 131 add_action( 'admin_notices', 'wplng_admin_notice_incompatible_plain_permalink', 1 );
123 132
124 133 // Return if incompatibility is detected
125 134 if ( ! empty( wplng_get_incompatible_plugins() )
126 - || is_multisite()
135 + || ( is_multisite()
136 + && ! apply_filters( 'wplng_bypass_multisite_incompatibility', false )
137 + )
127 138 || ( version_compare( PHP_VERSION, WPLNG_PHP_MIN_VERSION ) < 0 )
128 139 || ! wplng_htaccess_is_valid()
129 140 || empty( get_option( 'permalink_structure' ) )
130 141 ) {
@@ -165,8 +176,11 @@
165 176 */
166 177
167 178 // Add menu in back office
168 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' );
169 183
170 184 // Add admin Bar menu
171 185 add_action( 'admin_bar_menu', 'wplng_admin_bar_menu', 81 );
172 186 add_action( 'admin_bar_menu', 'wplng_admin_bar_edit', 81 );
@@ -185,8 +199,12 @@
185 199
186 200 // Update flags URL
187 201 add_action( 'update_option_wplng_flags_style', 'wplng_options_switcher_update_flags_style', 10, 2 );
188 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 +
189 207 // Reset API data on API key changing
190 208 add_action( 'update_option_wplng_api_key', 'wplng_on_update_option_wplng_api_key', 10, 2 );
191 209
192 210 // Add edit link on page and post list
@@ -192,8 +210,11 @@
192 210 // Add edit link on page and post list
193 211 add_filter( 'page_row_actions', 'wplng_row_edit_translation_link', 10, 2 );
194 212 add_filter( 'post_row_actions', 'wplng_row_edit_translation_link', 10, 2 );
195 213
214 + // Notice for obtaining the PRO version
215 + // add_action( 'admin_notices', 'wplng_admin_notice_get_pro_version', 1 );
216 +
196 217 /**
197 218 * wplng_translation : CPT, taxo, meta
198 219 */
199 220
@@ -333,8 +354,11 @@
333 354
334 355 // Redirect page if is called with an untranslate slug
335 356 add_action( 'template_redirect', 'wplng_redirect_translated_slug' );
336 357
358 + // Translate WooCommerce cart URL
359 + add_filter( 'woocommerce_get_cart_url', 'wplng_url_translate' );
360 +
337 361 /**
338 362 * Generate JSON translation on the fly for wp-i18n.js
339 363 */
340 364
@@ -379,8 +403,10 @@
379 403 if ( ! empty( get_option( 'wplng_translate_search' ) )
380 404 && wplng_api_feature_is_allow( 'search' )
381 405 ) {
382 406 add_action( 'parse_query', 'wplng_translate_search_query' );
407 + add_filter( 'get_search_query', 'wplng_search_put_tag' );
408 + add_filter( 'wplng_translated_html', 'wplng_search_replace_tag', 5 );
383 409 } else {
384 410 add_filter( 'wplng_url_is_translatable', 'wplng_exclude_search', 20 );
385 411 }
386 412
@@ -416,4 +442,17 @@
416 442
417 443 }
418 444 }
419 445 wplng_start();
446 +
447 +
448 +/**
449 + * Delete translation and slug cache options on plugin deactivation.
450 + *
451 + * @return void
452 + */
453 +function wplng_deactivate() {
454 + delete_option( 'wplng_cached_translations' );
455 + delete_option( 'wplng_cached_slugs' );
456 + delete_option( 'wplng_api_key_data' );
457 +}
458 +register_deactivation_hook( __FILE__, 'wplng_deactivate' );