Translate WordPress with GTranslate - Version 2.8.60

Version Description

  • Added debug option for WooCommerce Email translation
Download this release

Release Info

Developer edo888
Plugin Icon 128x128 Translate WordPress with GTranslate
Version 2.8.60
Comparing to
See all releases

Code changes from version 2.8.59 to 2.8.60

Files changed (2) hide show
  1. gtranslate.php +28 -7
  2. readme.txt +4 -1
gtranslate.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: GTranslate
4
  Plugin URI: https://gtranslate.io/?xyz=998
5
  Description: Makes your website <strong>multilingual</strong> and available to the world using Google Translate. For support visit <a href="https://wordpress.org/support/plugin/gtranslate">GTranslate Support</a>.
6
- Version: 2.8.59
7
  Author: Translate AI Multilingual Solutions
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
@@ -316,6 +316,7 @@ function RefreshDoWidgetCode() {
316
  var native_language_names = jQuery('#native_language_names:checked').length > 0 ? true : false;
317
  var analytics = jQuery('#analytics:checked').length > 0 ? true : false;
318
  var detect_browser_language = jQuery('#detect_browser_language:checked').length > 0 ? true : false;
 
319
  var switcher_text_color = jQuery('#switcher_text_color').val();
320
  var switcher_arrow_color = jQuery('#switcher_arrow_color').val();
321
  var switcher_border_color = jQuery('#switcher_border_color').val();
@@ -338,12 +339,15 @@ function RefreshDoWidgetCode() {
338
  jQuery('#url_translation_option').show();
339
  jQuery('#hreflang_tags_option').show();
340
  jQuery('#email_translation_option').show();
 
 
341
  //jQuery('#auto_switch_option').hide();
342
  } else {
343
  jQuery('#new_window_option').hide();
344
  jQuery('#url_translation_option').hide();
345
  jQuery('#hreflang_tags_option').hide();
346
  jQuery('#email_translation_option').hide();
 
347
  //jQuery('#auto_switch_option').show();
348
  }
349
 
@@ -835,6 +839,7 @@ jQuery('#enterprise_version').attr('checked', '$enterprise_version'.length > 0);
835
  jQuery('#url_translation').attr('checked', '$url_translation'.length > 0);
836
  jQuery('#add_hreflang_tags').attr('checked', '$add_hreflang_tags'.length > 0);
837
  jQuery('#email_translation').attr('checked', '$email_translation'.length > 0);
 
838
  jQuery('#new_window').attr('checked', '$new_window'.length > 0);
839
  jQuery('#show_in_menu').val('$show_in_menu');
840
  jQuery('#floating_language_selector').val('$floating_language_selector');
@@ -861,6 +866,8 @@ if(jQuery('#pro_version:checked').length || jQuery('#enterprise_version:checked'
861
  jQuery('#url_translation_option').show();
862
  jQuery('#hreflang_tags_option').show();
863
  jQuery('#email_translation_option').show();
 
 
864
  //jQuery('#auto_switch_option').hide();
865
  }
866
 
@@ -870,6 +877,12 @@ if('$widget_look' == 'dropdown' || '$widget_look' == 'flags_dropdown' || '$widge
870
  jQuery('#dropdown_languages_option').hide();
871
  }
872
 
 
 
 
 
 
 
873
  if('$widget_look' == 'globe') {
874
  jQuery('#alternative_flags_option').show();
875
  } else {
@@ -1126,7 +1139,11 @@ EOT;
1126
  </tr>
1127
  <tr id="email_translation_option" style="display:none;">
1128
  <td class="option_name"><?php _e('Enable WooCommerce Email Translation', 'gtranslate'); ?>:</td>
1129
- <td><input id="email_translation" name="email_translation" value="1" type="checkbox"/></td>
 
 
 
 
1130
  </tr>
1131
  <tr id="new_window_option" style="display:none;">
1132
  <td class="option_name"><?php _e('Open in new window', 'gtranslate'); ?>:</td>
@@ -1485,6 +1502,7 @@ EOT;
1485
  $data['url_translation'] = isset($_POST['url_translation']) ? intval($_POST['url_translation']) : '';
1486
  $data['add_hreflang_tags'] = isset($_POST['add_hreflang_tags']) ? intval($_POST['add_hreflang_tags']) : '';
1487
  $data['email_translation'] = isset($_POST['email_translation']) ? intval($_POST['email_translation']) : '';
 
1488
  $data['new_window'] = isset($_POST['new_window']) ? intval($_POST['new_window']) : '';
1489
  $data['show_in_menu'] = isset($_POST['show_in_menu']) ? sanitize_text_field($_POST['show_in_menu']) : '';
1490
  $data['floating_language_selector'] = isset($_POST['floating_language_selector']) ? sanitize_text_field($_POST['floating_language_selector']) : 'no';
@@ -1569,6 +1587,7 @@ EOT;
1569
  $data['url_translation'] = isset($data['url_translation']) ? $data['url_translation'] : '';
1570
  $data['add_hreflang_tags'] = isset($data['add_hreflang_tags']) ? $data['add_hreflang_tags'] : '';
1571
  $data['email_translation'] = isset($data['email_translation']) ? $data['email_translation'] : '';
 
1572
  $data['new_window'] = isset($data['new_window']) ? $data['new_window'] : '';
1573
  $data['show_in_menu'] = isset($data['show_in_menu']) ? $data['show_in_menu'] : ((isset($data['show_in_primary_menu']) and $data['show_in_primary_menu'] == 1) ? 'primary' : '');
1574
  $data['floating_language_selector'] = isset($data['floating_language_selector']) ? $data['floating_language_selector'] : 'no';
@@ -2472,15 +2491,17 @@ if($data['pro_version'] or $data['enterprise_version']) {
2472
  curl_setopt($ch, CURLOPT_POST, 1);
2473
  curl_setopt($ch, CURLOPT_POSTFIELDS, array('body' => do_shortcode("<subject>$subject</subject><message>$message</message>"), 'access_key' => md5(substr(NONCE_SALT, 0, 10) . substr(NONCE_KEY, 0, 5))));
2474
 
2475
- //$fh = fopen(dirname(__FILE__) . '/url_addon/debug.txt', 'a');
2476
- //curl_setopt($ch, CURLOPT_VERBOSE, true);
2477
- //curl_setopt($ch, CURLOPT_STDERR, $fh);
 
 
2478
 
2479
  $response = curl_exec($ch);
2480
  $response_info = curl_getinfo($ch);
2481
  curl_close($ch);
2482
 
2483
- if($debug) {
2484
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Response: ' . $response . "\n", FILE_APPEND);
2485
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Response_info: ' . print_r($response_info, true) . "\n", FILE_APPEND);
2486
  }
@@ -2496,7 +2517,7 @@ if($data['pro_version'] or $data['enterprise_version']) {
2496
  $subject = $matches[1][0];
2497
  $message = $matches[2][0];
2498
 
2499
- if($debug) {
2500
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Translated Subject: ' . $subject . "\n", FILE_APPEND);
2501
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Translated Message: ' . $message . "\n", FILE_APPEND);
2502
  }
3
  Plugin Name: GTranslate
4
  Plugin URI: https://gtranslate.io/?xyz=998
5
  Description: Makes your website <strong>multilingual</strong> and available to the world using Google Translate. For support visit <a href="https://wordpress.org/support/plugin/gtranslate">GTranslate Support</a>.
6
+ Version: 2.8.60
7
  Author: Translate AI Multilingual Solutions
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
316
  var native_language_names = jQuery('#native_language_names:checked').length > 0 ? true : false;
317
  var analytics = jQuery('#analytics:checked').length > 0 ? true : false;
318
  var detect_browser_language = jQuery('#detect_browser_language:checked').length > 0 ? true : false;
319
+ var email_translation = jQuery('#email_translation:checked').length > 0 ? true : false;
320
  var switcher_text_color = jQuery('#switcher_text_color').val();
321
  var switcher_arrow_color = jQuery('#switcher_arrow_color').val();
322
  var switcher_border_color = jQuery('#switcher_border_color').val();
339
  jQuery('#url_translation_option').show();
340
  jQuery('#hreflang_tags_option').show();
341
  jQuery('#email_translation_option').show();
342
+ if(email_translation)
343
+ jQuery('#email_translation_debug_option').show();
344
  //jQuery('#auto_switch_option').hide();
345
  } else {
346
  jQuery('#new_window_option').hide();
347
  jQuery('#url_translation_option').hide();
348
  jQuery('#hreflang_tags_option').hide();
349
  jQuery('#email_translation_option').hide();
350
+ jQuery('#email_translation_debug_option').hide();
351
  //jQuery('#auto_switch_option').show();
352
  }
353
 
839
  jQuery('#url_translation').attr('checked', '$url_translation'.length > 0);
840
  jQuery('#add_hreflang_tags').attr('checked', '$add_hreflang_tags'.length > 0);
841
  jQuery('#email_translation').attr('checked', '$email_translation'.length > 0);
842
+ jQuery('#email_translation_debug').attr('checked', '$email_translation_debug'.length > 0);
843
  jQuery('#new_window').attr('checked', '$new_window'.length > 0);
844
  jQuery('#show_in_menu').val('$show_in_menu');
845
  jQuery('#floating_language_selector').val('$floating_language_selector');
866
  jQuery('#url_translation_option').show();
867
  jQuery('#hreflang_tags_option').show();
868
  jQuery('#email_translation_option').show();
869
+ if(jQuery('#email_translation:checked').length)
870
+ jQuery('#email_translation_debug_option').show();
871
  //jQuery('#auto_switch_option').hide();
872
  }
873
 
877
  jQuery('#dropdown_languages_option').hide();
878
  }
879
 
880
+ if('$widget_look' == 'dropdown_with_flags') {
881
+ jQuery('.switcher_color_options').show();
882
+ } else {
883
+ jQuery('.switcher_color_options').hide();
884
+ }
885
+
886
  if('$widget_look' == 'globe') {
887
  jQuery('#alternative_flags_option').show();
888
  } else {
1139
  </tr>
1140
  <tr id="email_translation_option" style="display:none;">
1141
  <td class="option_name"><?php _e('Enable WooCommerce Email Translation', 'gtranslate'); ?>:</td>
1142
+ <td><input id="email_translation" name="email_translation" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/></td>
1143
+ </tr>
1144
+ <tr id="email_translation_debug_option" style="display:none;">
1145
+ <td class="option_name"><?php _e('Debug Email Translation', 'gtranslate'); ?>:</td>
1146
+ <td><input id="email_translation_debug" name="email_translation_debug" value="1" type="checkbox"/></td>
1147
  </tr>
1148
  <tr id="new_window_option" style="display:none;">
1149
  <td class="option_name"><?php _e('Open in new window', 'gtranslate'); ?>:</td>
1502
  $data['url_translation'] = isset($_POST['url_translation']) ? intval($_POST['url_translation']) : '';
1503
  $data['add_hreflang_tags'] = isset($_POST['add_hreflang_tags']) ? intval($_POST['add_hreflang_tags']) : '';
1504
  $data['email_translation'] = isset($_POST['email_translation']) ? intval($_POST['email_translation']) : '';
1505
+ $data['email_translation_debug'] = isset($_POST['email_translation_debug']) ? intval($_POST['email_translation_debug']) : '';
1506
  $data['new_window'] = isset($_POST['new_window']) ? intval($_POST['new_window']) : '';
1507
  $data['show_in_menu'] = isset($_POST['show_in_menu']) ? sanitize_text_field($_POST['show_in_menu']) : '';
1508
  $data['floating_language_selector'] = isset($_POST['floating_language_selector']) ? sanitize_text_field($_POST['floating_language_selector']) : 'no';
1587
  $data['url_translation'] = isset($data['url_translation']) ? $data['url_translation'] : '';
1588
  $data['add_hreflang_tags'] = isset($data['add_hreflang_tags']) ? $data['add_hreflang_tags'] : '';
1589
  $data['email_translation'] = isset($data['email_translation']) ? $data['email_translation'] : '';
1590
+ $data['email_translation_debug'] = isset($data['email_translation_debug']) ? $data['email_translation_debug'] : '';
1591
  $data['new_window'] = isset($data['new_window']) ? $data['new_window'] : '';
1592
  $data['show_in_menu'] = isset($data['show_in_menu']) ? $data['show_in_menu'] : ((isset($data['show_in_primary_menu']) and $data['show_in_primary_menu'] == 1) ? 'primary' : '');
1593
  $data['floating_language_selector'] = isset($data['floating_language_selector']) ? $data['floating_language_selector'] : 'no';
2491
  curl_setopt($ch, CURLOPT_POST, 1);
2492
  curl_setopt($ch, CURLOPT_POSTFIELDS, array('body' => do_shortcode("<subject>$subject</subject><message>$message</message>"), 'access_key' => md5(substr(NONCE_SALT, 0, 10) . substr(NONCE_KEY, 0, 5))));
2493
 
2494
+ if($data['email_translation_debug']) {
2495
+ $fh = fopen(dirname(__FILE__) . '/url_addon/debug.txt', 'a');
2496
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
2497
+ curl_setopt($ch, CURLOPT_STDERR, $fh);
2498
+ }
2499
 
2500
  $response = curl_exec($ch);
2501
  $response_info = curl_getinfo($ch);
2502
  curl_close($ch);
2503
 
2504
+ if($data['email_translation_debug']) {
2505
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Response: ' . $response . "\n", FILE_APPEND);
2506
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Response_info: ' . print_r($response_info, true) . "\n", FILE_APPEND);
2507
  }
2517
  $subject = $matches[1][0];
2518
  $message = $matches[2][0];
2519
 
2520
+ if($data['email_translation_debug']) {
2521
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Translated Subject: ' . $subject . "\n", FILE_APPEND);
2522
  file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Translated Message: ' . $message . "\n", FILE_APPEND);
2523
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Author: Translate AI Multilingual Solutions
4
  Tags: translate, translate wordpress, multilingual, translation, translate language, bilingual, localization, translation proxy, localisation, multilanguage, google translate
5
  Requires at least: 2.8.1
6
  Tested up to: 5.5
7
- Stable tag: 2.8.59
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Donate link: https://gtranslate.io/?xyz=998#pricing
@@ -252,6 +252,9 @@ If you want us to translate your website professionally or provide you a proofre
252
  8. User Dashboard
253
 
254
  == Changelog ==
 
 
 
255
  = 2.8.59 =
256
  * Fix for redirect loop in sub-directory translate mode caused by empty get parameters: ?a=&b= -> ?a&b
257
 
4
  Tags: translate, translate wordpress, multilingual, translation, translate language, bilingual, localization, translation proxy, localisation, multilanguage, google translate
5
  Requires at least: 2.8.1
6
  Tested up to: 5.5
7
+ Stable tag: 2.8.60
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Donate link: https://gtranslate.io/?xyz=998#pricing
252
  8. User Dashboard
253
 
254
  == Changelog ==
255
+ = 2.8.60 =
256
+ * Added debug option for WooCommerce Email translation
257
+
258
  = 2.8.59 =
259
  * Fix for redirect loop in sub-directory translate mode caused by empty get parameters: ?a=&b= -> ?a&b
260