Translate WordPress with GTranslate - Version 2.8.8

Version Description

  • Fix for flags rendering issue in menu
  • Fix for analytics code in onfly mode
  • Fixed issue with some template conflicts
Download this release

Release Info

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

Code changes from version 2.8.7 to 2.8.8

Files changed (2) hide show
  1. gtranslate.php +36 -6
  2. readme.txt +8 -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.7
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() {
@@ -519,7 +519,10 @@ function hideGSatelites($) {
519
  } else if(translation_method == 'onfly') {
520
  widget_code += "function GTranslateGetCurrentLang() {var keyValue = document.cookie.match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}"+new_line;
521
  widget_code += "function GTranslateFireEvent(element,event){try{if(document.createEventObject){var evt=document.createEventObject();element.fireEvent('on'+event,evt)}else{var evt=document.createEvent('HTMLEvents');evt.initEvent(event,true,true);element.dispatchEvent(evt)}}catch(e){}}"+new_line;
522
- 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;
 
 
 
523
  if(widget_look == 'dropdown_with_flags') {
524
  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;
525
  }
@@ -918,6 +921,7 @@ foreach($alt_flags as $flag)
918
  <div class="postbox">
919
  <h3 id="settings"><?php _e('Paid features', 'gtranslate'); ?></h3>
920
  <div class="inside">
 
921
  <ul style="list-style-type:square;padding-left:20px;">
922
  <li style="margin:0;"><?php _e('Enable search engine indexing', 'gtranslate'); ?></li>
923
  <li style="margin:0;"><?php _e('Search engine friendly (SEF) URLs', 'gtranslate'); ?></li>
@@ -1402,8 +1406,24 @@ if(!empty($data['show_in_menu'])) {
1402
  $data = get_option('GTranslate');
1403
  GTranslate::load_defaults($data);
1404
 
1405
- if($args->theme_location == $data['show_in_menu'])
1406
- $items .= '<li style="position:relative;" class="menu-item menu-item-gtranslate"><div style="position:absolute;">'.GTranslate::get_widget_code(false).'</div></li>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1407
  return $items;
1408
  }
1409
  }
@@ -1431,6 +1451,16 @@ if($data['floating_language_selector'] != 'no' and !is_admin()) {
1431
  }
1432
  }
1433
 
 
 
 
 
 
 
 
 
 
 
1434
  if($data['url_translation'] and ($data['pro_version'] or $data['enterprise_version'])) {
1435
  add_action('wp_head', 'gtranslate_url_translation_meta', 1);
1436
  function gtranslate_url_translation_meta() {
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.8
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
+ //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() {
519
  } else if(translation_method == 'onfly') {
520
  widget_code += "function GTranslateGetCurrentLang() {var keyValue = document.cookie.match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}"+new_line;
521
  widget_code += "function GTranslateFireEvent(element,event){try{if(document.createEventObject){var evt=document.createEventObject();element.fireEvent('on'+event,evt)}else{var evt=document.createEvent('HTMLEvents');evt.initEvent(event,true,true);element.dispatchEvent(evt)}}catch(e){}}"+new_line;
522
+ if(analytics)
523
+ 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;if(typeof ga!='undefined'){ga('send', 'event', 'GTranslate', lang, location.hostname+location.pathname+location.search);}else{if(typeof _gaq!='undefined')_gaq.push(['_trackEvent', 'GTranslate', lang, location.hostname+location.pathname+location.search]);}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;
524
+ else
525
+ 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;
526
  if(widget_look == 'dropdown_with_flags') {
527
  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;
528
  }
921
  <div class="postbox">
922
  <h3 id="settings"><?php _e('Paid features', 'gtranslate'); ?></h3>
923
  <div class="inside">
924
+ <p><?php _e('Prices starting from <b>$1.99/month</b>!', 'gtranslate'); ?></p>
925
  <ul style="list-style-type:square;padding-left:20px;">
926
  <li style="margin:0;"><?php _e('Enable search engine indexing', 'gtranslate'); ?></li>
927
  <li style="margin:0;"><?php _e('Search engine friendly (SEF) URLs', 'gtranslate'); ?></li>
1406
  $data = get_option('GTranslate');
1407
  GTranslate::load_defaults($data);
1408
 
1409
+ if($args->theme_location == $data['show_in_menu']) {
1410
+ $items .= '<li style="position:relative;" class="menu-item menu-item-gtranslate">';
1411
+ if($data['widget_look'] == 'dropdown_with_flags')
1412
+ $items .= '<div style="position:absolute;">';
1413
+ $items .= GTranslate::get_widget_code(false);
1414
+ if($data['widget_look'] == 'dropdown_with_flags')
1415
+ $items .= '</div>';
1416
+
1417
+ if($data['widget_look'] == 'flags' or $data['widget_look'] == 'flags_dropdown') {
1418
+ // adding css
1419
+ $items .= '<style type="text/css">';
1420
+ $items .= '.menu-item-gtranslate a {display:inline !important;padding:0 !important;margin:0 !important;}';
1421
+ $items .= '</style>';
1422
+ }
1423
+
1424
+ $items .= '</li>';
1425
+ }
1426
+
1427
  return $items;
1428
  }
1429
  }
1451
  }
1452
  }
1453
 
1454
+ if($data['pro_version'] or $data['enterprise_version']) {
1455
+ add_action('wp_head', 'gtranslate_request_uri_var');
1456
+ if(isset($_GET['page']) and $_GET['page'] == 'gtranslate_options')
1457
+ add_action('admin_head', 'gtranslate_request_uri_var');
1458
+
1459
+ function gtranslate_request_uri_var() {
1460
+ echo "<script type='text/javascript'>var gt_request_uri = '".addslashes($_SERVER['REQUEST_URI'])."';</script>";
1461
+ }
1462
+ }
1463
+
1464
  if($data['url_translation'] and ($data['pro_version'] or $data['enterprise_version'])) {
1465
  add_action('wp_head', 'gtranslate_url_translation_meta', 1);
1466
  function gtranslate_url_translation_meta() {
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.7
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
@@ -412,6 +412,11 @@ You need to go to the language you want to edit, for instance, French: http://do
412
 
413
  == Changelog ==
414
 
 
 
 
 
 
415
  = 2.8.7 =
416
  * Happy New Year! :)
417
  * Fix for mystery language change when selecting default language
@@ -643,6 +648,8 @@ You need to go to the language you want to edit, for instance, French: http://do
643
  * Initial version for WordPress
644
 
645
  == Upgrade Notice ==
 
 
646
 
647
  = 2.8.1 =
648
  A lot of new features added!
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.8
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
412
 
413
  == Changelog ==
414
 
415
+ = 2.8.8 =
416
+ * Fix for flags rendering issue in menu
417
+ * Fix for analytics code in onfly mode
418
+ * Fixed issue with some template conflicts
419
+
420
  = 2.8.7 =
421
  * Happy New Year! :)
422
  * Fix for mystery language change when selecting default language
648
  * Initial version for WordPress
649
 
650
  == Upgrade Notice ==
651
+ = 2.8.8 =
652
+ Make sure to regenerate the widget code from GTranslate Settings page by checking/unchecking Analytics feature and Saving changes.
653
 
654
  = 2.8.1 =
655
  A lot of new features added!