Translate WordPress with GTranslate - Version 2.8.11

Version Description

  • Fix for open redirect issue
  • Fix for incorrect selected language in nice dropdown
Download this release

Release Info

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

Code changes from version 2.8.10 to 2.8.11

Files changed (3) hide show
  1. gtranslate.php +22 -9
  2. readme.txt +5 -3
  3. url_addon/gtranslate.php +4 -2
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.10
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
@@ -76,8 +76,8 @@ class GTranslate extends WP_Widget {
76
  wp_enqueue_style( 'gtranslate-style', plugins_url('gtranslate-style'.$data['flag_size'].'.css', __FILE__) );
77
  wp_enqueue_script('jquery');
78
 
79
- //if($data['pro_version'] or $data['enterprise_version'])
80
- //wp_add_inline_script('jquery-core', "var gt_request_uri = '".addslashes($_SERVER['REQUEST_URI'])."';", 'before');
81
  }
82
 
83
  public static function load_textdomain() {
@@ -534,7 +534,7 @@ function hideGSatelites($) {
534
  widget_preview += '<script type="text/javascript">'+new_line;
535
  widget_preview += "jQuery('.switcher .selected').click(function() {if(!(jQuery('.switcher .option').is(':visible'))) {jQuery('.switcher .option').stop(true,true).delay(50).slideDown(500);jQuery('.switcher .selected a').toggleClass('open')}});"+new_line;
536
  widget_preview += "jQuery('.switcher .option').bind('mousewheel', function(e) {var options = jQuery('.switcher .option');if(options.is(':visible'))options.scrollTop(options.scrollTop() - e.originalEvent.wheelDelta);return false;});"+new_line;
537
- widget_preview += "jQuery('body').not('.switcher .selected').mousedown(function() {if(jQuery('.switcher .option').is(':visible')) {jQuery('.switcher .option').stop(true,true).delay(50).slideUp(500);jQuery('.switcher .selected a').toggleClass('open')}});"+new_line;
538
  widget_preview += '<\/script>'+new_line;
539
 
540
  // Adding slider css
@@ -595,7 +595,7 @@ function hideGSatelites($) {
595
  else
596
  widget_code += "function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(sel[i].className=='goog-te-combo')teCombo=sel[i];if(document.getElementById('google_translate_element2')==null||document.getElementById('google_translate_element2').innerHTML.length==0||teCombo.length==0||teCombo.innerHTML.length==0){setTimeout(function(){doGTranslate(lang_pair)},500)}else{teCombo.value=lang;GTranslateFireEvent(teCombo,'change');GTranslateFireEvent(teCombo,'change')}}"+new_line;
597
  if(widget_look == 'dropdown_with_flags') {
598
- widget_code += "if(GTranslateGetCurrentLang() != null)jQuery(document).ready(function() {jQuery('div.switcher div.selected a').html(jQuery('div.switcher div.option').find('span.gflag img[alt=\"'+GTranslateGetCurrentLang()+'\"]').parent().parent().html());});"+new_line;
599
  }
600
  }
601
 
@@ -1078,8 +1078,12 @@ foreach($alt_flags as $flag)
1078
  .connectedSortable1 li label, .connectedSortable2 li label {cursor:move;}
1079
  </style>
1080
 
 
 
1081
  <!-- Live Chat for GTranslate -->
1082
  <script>var _glc =_glc || [];_glc.push('all_ag9zfmNsaWNrZGVza2NoYXRyDgsSBXVzZXJzGM3hxwQM');var glcpath = (('https:' == document.location.protocol) ? 'https://my.clickdesk.com/clickdesk-ui/browser/' : 'http://my.clickdesk.com/clickdesk-ui/browser/');var glcp = (('https:' == document.location.protocol) ? 'https://' : 'http://');var glcspt = document.createElement('script'); glcspt.type = 'text/javascript'; glcspt.async = true; glcspt.src = glcpath + 'livechat-new.js';var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(glcspt, s);</script>
 
 
1083
  <?php
1084
  }
1085
 
@@ -1308,7 +1312,12 @@ class GTranslate_Notices {
1308
  // If user clicks to ignore the notice, update the option to not show it again
1309
  if (isset($_GET[$this->prefix . '_admin_notice_ignore'])) {
1310
  $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
1311
- $admin_notices_option[$_GET[$this->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
 
 
 
 
 
1312
  update_option($this->prefix . '_admin_notice', $admin_notices_option);
1313
  $query_str = remove_query_arg($this->prefix . '_admin_notice_ignore');
1314
  wp_redirect($query_str);
@@ -1323,12 +1332,16 @@ class GTranslate_Notices {
1323
  $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
1324
  $current_date = current_time("n/j/Y");
1325
  $date_array = explode('/', $current_date);
1326
- $interval = (isset($_GET['gt_int']) ? $_GET['gt_int'] : 14);
1327
  $date_array[1] += $interval;
1328
  $new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
1329
 
1330
- $admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
1331
- $admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
 
 
 
 
1332
  update_option($this->prefix . '_admin_notice', $admin_notices_option);
1333
  $query_str = remove_query_arg(array($this->prefix . '_admin_notice_temp_ignore', 'gt_int'));
1334
  wp_redirect( $query_str );
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.11
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
76
  wp_enqueue_style( 'gtranslate-style', plugins_url('gtranslate-style'.$data['flag_size'].'.css', __FILE__) );
77
  wp_enqueue_script('jquery');
78
 
79
+ //get_option('googlelanguagetranslator_active');
80
+ //get_option('wg_allowed');
81
  }
82
 
83
  public static function load_textdomain() {
534
  widget_preview += '<script type="text/javascript">'+new_line;
535
  widget_preview += "jQuery('.switcher .selected').click(function() {if(!(jQuery('.switcher .option').is(':visible'))) {jQuery('.switcher .option').stop(true,true).delay(50).slideDown(500);jQuery('.switcher .selected a').toggleClass('open')}});"+new_line;
536
  widget_preview += "jQuery('.switcher .option').bind('mousewheel', function(e) {var options = jQuery('.switcher .option');if(options.is(':visible'))options.scrollTop(options.scrollTop() - e.originalEvent.wheelDelta);return false;});"+new_line;
537
+ widget_preview += "jQuery('body').not('.switcher').mousedown(function(e) {if(jQuery('.switcher .option').is(':visible') && e.target != jQuery('.switcher .option').get(0)) {jQuery('.switcher .option').stop(true,true).delay(50).slideUp(500);jQuery('.switcher .selected a').toggleClass('open')}});"+new_line;
538
  widget_preview += '<\/script>'+new_line;
539
 
540
  // Adding slider css
595
  else
596
  widget_code += "function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(sel[i].className=='goog-te-combo')teCombo=sel[i];if(document.getElementById('google_translate_element2')==null||document.getElementById('google_translate_element2').innerHTML.length==0||teCombo.length==0||teCombo.innerHTML.length==0){setTimeout(function(){doGTranslate(lang_pair)},500)}else{teCombo.value=lang;GTranslateFireEvent(teCombo,'change');GTranslateFireEvent(teCombo,'change')}}"+new_line;
597
  if(widget_look == 'dropdown_with_flags') {
598
+ widget_code += "if(GTranslateGetCurrentLang() != null)jQuery(document).ready(function() {jQuery('div.switcher div.selected a').html(jQuery('div.switcher div.option').find('img[alt=\"'+GTranslateGetCurrentLang()+'\"]').parent().html());});"+new_line;
599
  }
600
  }
601
 
1078
  .connectedSortable1 li label, .connectedSortable2 li label {cursor:move;}
1079
  </style>
1080
 
1081
+ <?php
1082
+ /*
1083
  <!-- Live Chat for GTranslate -->
1084
  <script>var _glc =_glc || [];_glc.push('all_ag9zfmNsaWNrZGVza2NoYXRyDgsSBXVzZXJzGM3hxwQM');var glcpath = (('https:' == document.location.protocol) ? 'https://my.clickdesk.com/clickdesk-ui/browser/' : 'http://my.clickdesk.com/clickdesk-ui/browser/');var glcp = (('https:' == document.location.protocol) ? 'https://' : 'http://');var glcspt = document.createElement('script'); glcspt.type = 'text/javascript'; glcspt.async = true; glcspt.src = glcpath + 'livechat-new.js';var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(glcspt, s);</script>
1085
+ */
1086
+ ?>
1087
  <?php
1088
  }
1089
 
1312
  // If user clicks to ignore the notice, update the option to not show it again
1313
  if (isset($_GET[$this->prefix . '_admin_notice_ignore'])) {
1314
  $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
1315
+
1316
+ $key = $_GET[$this->prefix . '_admin_notice_ignore'];
1317
+ if(!preg_match('/^[a-z_0-9]+$/i', $key))
1318
+ return;
1319
+
1320
+ $admin_notices_option[$key]['dismissed'] = 1;
1321
  update_option($this->prefix . '_admin_notice', $admin_notices_option);
1322
  $query_str = remove_query_arg($this->prefix . '_admin_notice_ignore');
1323
  wp_redirect($query_str);
1332
  $admin_notices_option = get_option($this->prefix . '_admin_notice', array());
1333
  $current_date = current_time("n/j/Y");
1334
  $date_array = explode('/', $current_date);
1335
+ $interval = (isset($_GET['gt_int']) ? intval($_GET['gt_int']) : 14);
1336
  $date_array[1] += $interval;
1337
  $new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
1338
 
1339
+ $key = $_GET[$this->prefix . '_admin_notice_temp_ignore'];
1340
+ if(!preg_match('/^[a-z_0-9]+$/i', $key))
1341
+ return;
1342
+
1343
+ $admin_notices_option[$key]['start'] = $new_start;
1344
+ $admin_notices_option[$key]['dismissed'] = 0;
1345
  update_option($this->prefix . '_admin_notice', $admin_notices_option);
1346
  $query_str = remove_query_arg(array($this->prefix . '_admin_notice_temp_ignore', 'gt_int'));
1347
  wp_redirect( $query_str );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Author: Edvard Ananyan
4
  Tags: translation proxy, localization, translate, translation, google translate, language, multilingual, multilanguage, bilingual, tradurre, traducir, traduire, traduzione, ubersetzung, mehrsprachig, oversette, oversatta, vertaling, vertaler, meertalig, polylang, qtranslate, transposh, wpml, l18n
5
  Requires at least: 2.8
6
  Tested up to: 4.7
7
- Stable tag: 2.8.10
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
@@ -52,8 +52,6 @@ Please check our [FAQ](https://gtranslate.io/?xyz=998#faq) to get quick answers.
52
  **Edit Translations Demo (paid)**
53
  [youtube https://www.youtube.com/watch?v=YwSy3VtQx3I]
54
 
55
- Keywords: polylang, prisna, gts, localize, lingotek, smartling, qtranslate, loco translate, loco, google website translator, translate wordpress, translate, transposh, global translator, machine translate, wp translate, bilingual, multilanguage, multilingual, l18n, quebec, canada, usa, brazil, mexico
56
-
57
  == Installation ==
58
 
59
  1. Upload `gtranslate` folder to the `/wp-content/plugins/` directory
@@ -520,6 +518,10 @@ You need to go to the language you want to edit, for instance, French: http://do
520
 
521
  == Changelog ==
522
 
 
 
 
 
523
  = 2.8.10 =
524
  * Added Quebec and Canada alternative flags for French and English
525
 
4
  Tags: translation proxy, localization, translate, translation, google translate, language, multilingual, multilanguage, bilingual, tradurre, traducir, traduire, traduzione, ubersetzung, mehrsprachig, oversette, oversatta, vertaling, vertaler, meertalig, polylang, qtranslate, transposh, wpml, l18n
5
  Requires at least: 2.8
6
  Tested up to: 4.7
7
+ Stable tag: 2.8.11
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
52
  **Edit Translations Demo (paid)**
53
  [youtube https://www.youtube.com/watch?v=YwSy3VtQx3I]
54
 
 
 
55
  == Installation ==
56
 
57
  1. Upload `gtranslate` folder to the `/wp-content/plugins/` directory
518
 
519
  == Changelog ==
520
 
521
+ = 2.8.11 =
522
+ * Fix for open redirect issue
523
+ * Fix for incorrect selected language in nice dropdown
524
+
525
  = 2.8.10 =
526
  * Added Quebec and Canada alternative flags for French and English
527
 
url_addon/gtranslate.php CHANGED
@@ -19,15 +19,17 @@ $page_url = implode('/', $page_url_segments);
19
 
20
  $get_params = $_GET;
21
  if(isset($get_params['glang']))
22
- unset($get_params['glang']);
23
  if(isset($get_params['gurl']))
24
  unset($get_params['gurl']);
25
 
26
  if(count($get_params)) {
27
- $page_url .= '?' . http_build_query($get_params);
28
  }
29
 
30
  if($glang == $main_lang) {
 
 
31
  header('Location: ' . $page_url, true, 301);
32
  exit;
33
  }
19
 
20
  $get_params = $_GET;
21
  if(isset($get_params['glang']))
22
+ unset($get_params['glang']);
23
  if(isset($get_params['gurl']))
24
  unset($get_params['gurl']);
25
 
26
  if(count($get_params)) {
27
+ $page_url .= '?' . http_build_query($get_params);
28
  }
29
 
30
  if($glang == $main_lang) {
31
+ $page_url = preg_replace('/^[\/]+/', '/', $page_url);
32
+
33
  header('Location: ' . $page_url, true, 301);
34
  exit;
35
  }