Version Description
- Happy New Year! :)
- Fix for mystery language change when selecting default language
- .htaccess plugin_path now relative without http://example.com
- Bug fixed, scrolling for dropdown flags doesn't work on some templates
Download this release
Release Info
| Developer | edo888 |
| Plugin | |
| Version | 2.8.7 |
| Comparing to | |
| See all releases | |
Code changes from version 2.8.6 to 2.8.7
- gtranslate.php +7 -6
- readme.txt +7 -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 |
Author: Edvard Ananyan
|
| 8 |
Author URI: https://gtranslate.io
|
| 9 |
Text Domain: gtranslate
|
|
@@ -464,6 +464,7 @@ function hideGSatelites($) {
|
|
| 464 |
// Adding slider javascript
|
| 465 |
widget_preview += '<script type="text/javascript">'+new_line;
|
| 466 |
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;
|
|
|
|
| 467 |
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;
|
| 468 |
widget_preview += '<\/script>'+new_line;
|
| 469 |
|
|
@@ -516,9 +517,10 @@ function hideGSatelites($) {
|
|
| 516 |
else
|
| 517 |
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];var plang=location.hostname.split('.')[0];if(plang.length !=2 && plang.toLowerCase() != 'zh-cn' && plang.toLowerCase() != 'zh-tw')plang='"+default_language+"';location.href=location.protocol+'//'+(lang == '"+default_language+"' ? '' : lang+'.')+location.hostname.replace('www.', '').replace(RegExp('^' + plang + '\.'), '')+gt_request_uri;}"+new_line;
|
| 518 |
} else if(translation_method == 'onfly') {
|
| 519 |
-
widget_code += "function
|
|
|
|
|
|
|
| 520 |
if(widget_look == 'dropdown_with_flags') {
|
| 521 |
-
widget_code += "function GTranslateGetCurrentLang() {var keyValue = document.cookie.match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}"+new_line;
|
| 522 |
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;
|
| 523 |
}
|
| 524 |
}
|
|
@@ -538,7 +540,6 @@ function hideGSatelites($) {
|
|
| 538 |
function ShowWidgetPreview(widget_preview) {
|
| 539 |
widget_preview = widget_preview.replace(/javascript:doGTranslate/g, 'javascript:void')
|
| 540 |
widget_preview = widget_preview.replace('onchange="doGTranslate(this);"', '');
|
| 541 |
-
widget_preview = widget_preview.replace('if(jQuery.cookie', 'if(false && jQuery.cookie');
|
| 542 |
|
| 543 |
jQuery('head').append( jQuery('<link rel="stylesheet" type="text/css" />').attr('href', '$wp_plugin_url/gtranslate-style'+jQuery('#flag_size').val()+'.css') );
|
| 544 |
jQuery('#widget_preview').html(widget_preview);
|
|
@@ -1034,7 +1035,7 @@ foreach($alt_flags as $flag)
|
|
| 1034 |
$htaccess = file_get_contents($htaccess_file);
|
| 1035 |
if(strpos($htaccess, 'gtranslate.php') === false) { // no config rules
|
| 1036 |
$rewrite_rules = file_get_contents(dirname(__FILE__) . '/url_addon/rewrite.txt');
|
| 1037 |
-
$rewrite_rules = str_replace('GTRANSLATE_PLUGIN_PATH', plugins_url() . '/gtranslate', $rewrite_rules);
|
| 1038 |
|
| 1039 |
$htaccess = $rewrite_rules . "\r\n\r\n" . $htaccess;
|
| 1040 |
if(!empty($htaccess)) { // going to update .htaccess
|
|
@@ -1044,7 +1045,7 @@ foreach($alt_flags as $flag)
|
|
| 1044 |
}
|
| 1045 |
} else {
|
| 1046 |
$rewrite_rules = file_get_contents(dirname(__FILE__) . '/url_addon/rewrite.txt');
|
| 1047 |
-
$rewrite_rules = str_replace('GTRANSLATE_PLUGIN_PATH', plugins_url() . '/gtranslate', $rewrite_rules);
|
| 1048 |
|
| 1049 |
echo '<p style="color:red;">' . __('Please add the following rules to the top of your .htaccess file', 'gtranslate') . '</p>';
|
| 1050 |
echo '<pre style="background-color:#eaeaea;">' . $rewrite_rules . '</pre>';
|
| 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
|
| 464 |
// Adding slider javascript
|
| 465 |
widget_preview += '<script type="text/javascript">'+new_line;
|
| 466 |
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;
|
| 467 |
+
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;
|
| 468 |
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;
|
| 469 |
widget_preview += '<\/script>'+new_line;
|
| 470 |
|
| 517 |
else
|
| 518 |
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];var plang=location.hostname.split('.')[0];if(plang.length !=2 && plang.toLowerCase() != 'zh-cn' && plang.toLowerCase() != 'zh-tw')plang='"+default_language+"';location.href=location.protocol+'//'+(lang == '"+default_language+"' ? '' : lang+'.')+location.hostname.replace('www.', '').replace(RegExp('^' + plang + '\.'), '')+gt_request_uri;}"+new_line;
|
| 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 |
}
|
| 526 |
}
|
| 540 |
function ShowWidgetPreview(widget_preview) {
|
| 541 |
widget_preview = widget_preview.replace(/javascript:doGTranslate/g, 'javascript:void')
|
| 542 |
widget_preview = widget_preview.replace('onchange="doGTranslate(this);"', '');
|
|
|
|
| 543 |
|
| 544 |
jQuery('head').append( jQuery('<link rel="stylesheet" type="text/css" />').attr('href', '$wp_plugin_url/gtranslate-style'+jQuery('#flag_size').val()+'.css') );
|
| 545 |
jQuery('#widget_preview').html(widget_preview);
|
| 1035 |
$htaccess = file_get_contents($htaccess_file);
|
| 1036 |
if(strpos($htaccess, 'gtranslate.php') === false) { // no config rules
|
| 1037 |
$rewrite_rules = file_get_contents(dirname(__FILE__) . '/url_addon/rewrite.txt');
|
| 1038 |
+
$rewrite_rules = str_replace('GTRANSLATE_PLUGIN_PATH', str_replace(home_url(), '', plugins_url()) . '/gtranslate', $rewrite_rules);
|
| 1039 |
|
| 1040 |
$htaccess = $rewrite_rules . "\r\n\r\n" . $htaccess;
|
| 1041 |
if(!empty($htaccess)) { // going to update .htaccess
|
| 1045 |
}
|
| 1046 |
} else {
|
| 1047 |
$rewrite_rules = file_get_contents(dirname(__FILE__) . '/url_addon/rewrite.txt');
|
| 1048 |
+
$rewrite_rules = str_replace('GTRANSLATE_PLUGIN_PATH', str_replace(home_url(), '', plugins_url()) . '/gtranslate', $rewrite_rules);
|
| 1049 |
|
| 1050 |
echo '<p style="color:red;">' . __('Please add the following rules to the top of your .htaccess file', 'gtranslate') . '</p>';
|
| 1051 |
echo '<pre style="background-color:#eaeaea;">' . $rewrite_rules . '</pre>';
|
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.
|
| 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,12 @@ You need to go to the language you want to edit, for instance, French: http://do
|
|
| 412 |
|
| 413 |
== Changelog ==
|
| 414 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
= 2.8.6 =
|
| 416 |
* Fixed bug on options page related to native language names
|
| 417 |
* Plugin keywords added: multilanguage, multilingual, language, bilingual, l18n
|
| 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 |
|
| 413 |
== Changelog ==
|
| 414 |
|
| 415 |
+
= 2.8.7 =
|
| 416 |
+
* Happy New Year! :)
|
| 417 |
+
* Fix for mystery language change when selecting default language
|
| 418 |
+
* .htaccess plugin_path now relative without http://example.com
|
| 419 |
+
* Bug fixed, scrolling for dropdown flags doesn't work on some templates
|
| 420 |
+
|
| 421 |
= 2.8.6 =
|
| 422 |
* Fixed bug on options page related to native language names
|
| 423 |
* Plugin keywords added: multilanguage, multilingual, language, bilingual, l18n
|
