Version Description
- Changed static content paths to be relative to scheme
- Added "notranslate" class for dropdown widget look
- Added drodpown select wrapper id for easy CSS styling
- PHP URL rewriting added for some environments without .htaccess support: pantheon, flywheel, etc
- Fixed issue in url addon related to relative path location redirects
Download this release
Release Info
Developer | edo888 |
Plugin | Translate WordPress with GTranslate |
Version | 2.8.28 |
Comparing to | |
See all releases |
Code changes from version 2.8.27 to 2.8.28
- gtranslate.php +36 -16
- readme.txt +8 -1
- url_addon/gtranslate.php +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
|
@@ -200,7 +200,7 @@ class GTranslate extends WP_Widget {
|
|
200 |
wp_enqueue_script('jquery-effects-core');
|
201 |
|
202 |
$site_url = site_url();
|
203 |
-
$wp_plugin_url = plugins_url() . '/gtranslate';
|
204 |
|
205 |
extract($data);
|
206 |
|
@@ -378,10 +378,7 @@ function RefreshDoWidgetCode() {
|
|
378 |
widget_preview += '<br />';
|
379 |
else
|
380 |
widget_preview += ' ';
|
381 |
-
|
382 |
-
widget_preview += '<select onchange="doGTranslate(this);" class="notranslate">';
|
383 |
-
else
|
384 |
-
widget_preview += '<select onchange="doGTranslate(this);">';
|
385 |
|
386 |
widget_preview += '<option value="">Select Language</option>';
|
387 |
jQuery.each(language_codes2, function(i, val) {
|
@@ -1165,7 +1162,7 @@ EOT;
|
|
1165 |
|
1166 |
<p><?php _e('Prices starting from <b>$3.99/month</b>!', 'gtranslate'); ?></p>
|
1167 |
|
1168 |
-
<a href="https://gtranslate.io/?xyz=998#pricing" target="_blank"><?php _e('15
|
1169 |
</div>
|
1170 |
</div>
|
1171 |
</div>
|
@@ -1731,6 +1728,29 @@ if(is_admin()) {
|
|
1731 |
$data = get_option('GTranslate');
|
1732 |
GTranslate::load_defaults($data);
|
1733 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1734 |
if(!empty($data['show_in_menu'])) {
|
1735 |
add_filter('wp_nav_menu_items', 'gtranslate_menu_item', 10, 2);
|
1736 |
function gtranslate_menu_item($items, $args) {
|
@@ -1740,7 +1760,7 @@ if(!empty($data['show_in_menu'])) {
|
|
1740 |
if($args->theme_location == $data['show_in_menu']) {
|
1741 |
if($data['widget_look'] == 'dropdown_with_flags') {
|
1742 |
$items .= '<li style="position:relative;" class="menu-item menu-item-gtranslate">';
|
1743 |
-
$items .= '<div style="position:absolute;">';
|
1744 |
$items .= GTranslate::get_widget_code(false);
|
1745 |
$items .= '</div>';
|
1746 |
$items .= '</li>';
|
@@ -1792,14 +1812,14 @@ if($data['floating_language_selector'] != 'no' and !is_admin()) {
|
|
1792 |
$vertical_location = '5%';
|
1793 |
|
1794 |
switch($data['floating_language_selector']) {
|
1795 |
-
case 'top_left': $html = '<div style="position:fixed;top:'.$vertical_location.';left:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1796 |
-
case 'top_left_sticky': $html = '<div style="position:absolute;top:'.$vertical_location.';left:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1797 |
-
case 'top_right': $html = '<div style="position:fixed;top:'.$vertical_location.';right:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1798 |
-
case 'top_right_sticky': $html = '<div style="position:absolute;top:'.$vertical_location.';right:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1799 |
-
case 'bottom_left': $html = '<div style="position:fixed;bottom:'.$vertical_location.';left:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1800 |
-
case 'bottom_left_sticky': $html = '<div style="position:absolute;bottom:'.$vertical_location.';left:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1801 |
-
case 'bottom_right': $html = '<div style="position:fixed;bottom:'.$vertical_location.';right:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1802 |
-
case 'bottom_right_sticky': $html = '<div style="position:absolute;bottom:'.$vertical_location.';right:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1803 |
default: $html = ''; break;
|
1804 |
}
|
1805 |
|
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.28
|
7 |
Author: Edvard Ananyan
|
8 |
Author URI: https://gtranslate.io
|
9 |
Text Domain: gtranslate
|
200 |
wp_enqueue_script('jquery-effects-core');
|
201 |
|
202 |
$site_url = site_url();
|
203 |
+
$wp_plugin_url = preg_replace('/^https?:/i', '', plugins_url() . '/gtranslate');
|
204 |
|
205 |
extract($data);
|
206 |
|
378 |
widget_preview += '<br />';
|
379 |
else
|
380 |
widget_preview += ' ';
|
381 |
+
widget_preview += '<select onchange="doGTranslate(this);" class="notranslate" id="gtranslate_selector">';
|
|
|
|
|
|
|
382 |
|
383 |
widget_preview += '<option value="">Select Language</option>';
|
384 |
jQuery.each(language_codes2, function(i, val) {
|
1162 |
|
1163 |
<p><?php _e('Prices starting from <b>$3.99/month</b>!', 'gtranslate'); ?></p>
|
1164 |
|
1165 |
+
<a href="https://gtranslate.io/?xyz=998#pricing" target="_blank" class="button-primary"><?php _e('Try Now (15 days free)', 'gtranslate'); ?></a> <a href="https://gtranslate.io/?xyz=998#faq" target="_blank" class="button-primary"><?php _e('FAQ', 'gtranslate'); ?></a> <a href="https://gtranslate.io/?xyz=998#contact" target="_blank" class="button-primary"><?php _e('Live Chat', 'gtranslate'); ?></a>
|
1166 |
</div>
|
1167 |
</div>
|
1168 |
</div>
|
1728 |
$data = get_option('GTranslate');
|
1729 |
GTranslate::load_defaults($data);
|
1730 |
|
1731 |
+
if($data['pro_version']) { // gtranslate redirect rules with PHP (for environments with no .htaccess support (pantheon, flywheel, etc.), usually .htaccess rules override this)
|
1732 |
+
|
1733 |
+
@list($request_uri, $query_params) = explode('?', $_SERVER['REQUEST_URI']);
|
1734 |
+
|
1735 |
+
if(preg_match('/^\/(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)\/(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)\/(.*)$/', $request_uri, $matches)) {
|
1736 |
+
header('Location: ' . '/' . $matches[1] . '/' . $matches[3] . (empty($query_params) ? '' : '?'.$query_params), true, 301);
|
1737 |
+
exit;
|
1738 |
+
} // #1 redirect double language codes /es/en/...
|
1739 |
+
|
1740 |
+
if(preg_match('/^\/(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)$/', $request_uri)) {
|
1741 |
+
header('Location: ' . $request_uri . '/' . (empty($query_params) ? '' : '?'.$query_params), true, 301);
|
1742 |
+
exit;
|
1743 |
+
} // #2 add trailing slash
|
1744 |
+
|
1745 |
+
if(preg_match('/^\/(af|sq|am|ar|hy|az|eu|be|bn|bs|bg|ca|ceb|ny|zh-CN|zh-TW|co|hr|cs|da|nl|en|eo|et|tl|fi|fr|fy|gl|ka|de|el|gu|ht|ha|haw|iw|hi|hmn|hu|is|ig|id|ga|it|ja|jw|kn|kk|km|ko|ku|ky|lo|la|lv|lt|lb|mk|mg|ms|ml|mt|mi|mr|mn|my|ne|no|ps|fa|pl|pt|pa|ro|ru|sm|gd|sr|st|sn|sd|si|sk|sl|so|es|su|sw|sv|tg|ta|te|th|tr|uk|ur|uz|vi|cy|xh|yi|yo|zu)\/(.*)/', $request_uri, $matches)) {
|
1746 |
+
$_GET['glang'] = $matches[1];
|
1747 |
+
$_GET['gurl'] = rawurldecode($matches[2]);
|
1748 |
+
|
1749 |
+
require_once dirname(__FILE__) . '/url_addon/gtranslate.php';
|
1750 |
+
exit;
|
1751 |
+
} // #3 proxy translation
|
1752 |
+
}
|
1753 |
+
|
1754 |
if(!empty($data['show_in_menu'])) {
|
1755 |
add_filter('wp_nav_menu_items', 'gtranslate_menu_item', 10, 2);
|
1756 |
function gtranslate_menu_item($items, $args) {
|
1760 |
if($args->theme_location == $data['show_in_menu']) {
|
1761 |
if($data['widget_look'] == 'dropdown_with_flags') {
|
1762 |
$items .= '<li style="position:relative;" class="menu-item menu-item-gtranslate">';
|
1763 |
+
$items .= '<div style="position:absolute;" id="gtranslate_wrapper">';
|
1764 |
$items .= GTranslate::get_widget_code(false);
|
1765 |
$items .= '</div>';
|
1766 |
$items .= '</li>';
|
1812 |
$vertical_location = '5%';
|
1813 |
|
1814 |
switch($data['floating_language_selector']) {
|
1815 |
+
case 'top_left': $html = '<div style="position:fixed;top:'.$vertical_location.';left:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1816 |
+
case 'top_left_sticky': $html = '<div style="position:absolute;top:'.$vertical_location.';left:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1817 |
+
case 'top_right': $html = '<div style="position:fixed;top:'.$vertical_location.';right:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1818 |
+
case 'top_right_sticky': $html = '<div style="position:absolute;top:'.$vertical_location.';right:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1819 |
+
case 'bottom_left': $html = '<div style="position:fixed;bottom:'.$vertical_location.';left:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1820 |
+
case 'bottom_left_sticky': $html = '<div style="position:absolute;bottom:'.$vertical_location.';left:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1821 |
+
case 'bottom_right': $html = '<div style="position:fixed;bottom:'.$vertical_location.';right:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1822 |
+
case 'bottom_right_sticky': $html = '<div style="position:absolute;bottom:'.$vertical_location.';right:8%;z-index:999999;" id="gtranslate_wrapper">'.GTranslate::get_widget_code(false).'</div>'; break;
|
1823 |
default: $html = ''; break;
|
1824 |
}
|
1825 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Author: Edvard Ananyan
|
|
4 |
Tags: translate wordpress, multilingual, translate, translation, language, bilingual, localization, translation proxy, i18n, l10n, localisation, multilanguage, google translate
|
5 |
Requires at least: 2.8.1
|
6 |
Tested up to: 4.8
|
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
|
@@ -218,6 +218,13 @@ You need to go to the language you want to edit, for instance, French: http://do
|
|
218 |
|
219 |
== Changelog ==
|
220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
= 2.8.27 =
|
222 |
* Fixed issue for some mobile phones related to nice looking dropdown selector staying open
|
223 |
* Fixed issue related to Cloudflare 1000 error
|
4 |
Tags: translate wordpress, multilingual, translate, translation, language, bilingual, localization, translation proxy, i18n, l10n, localisation, multilanguage, google translate
|
5 |
Requires at least: 2.8.1
|
6 |
Tested up to: 4.8
|
7 |
+
Stable tag: 2.8.28
|
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
|
218 |
|
219 |
== Changelog ==
|
220 |
|
221 |
+
= 2.8.28 =
|
222 |
+
* Changed static content paths to be relative to scheme
|
223 |
+
* Added "notranslate" class for dropdown widget look
|
224 |
+
* Added drodpown select wrapper id for easy CSS styling
|
225 |
+
* PHP URL rewriting added for some environments without .htaccess support: pantheon, flywheel, etc
|
226 |
+
* Fixed issue in url addon related to relative path location redirects
|
227 |
+
|
228 |
= 2.8.27 =
|
229 |
* Fixed issue for some mobile phones related to nice looking dropdown selector staying open
|
230 |
* Fixed issue related to Cloudflare 1000 error
|
url_addon/gtranslate.php
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
include 'config.php';
|
3 |
|
4 |
if(!isset($_GET['glang']) or !isset($_GET['gurl']))
|
@@ -28,6 +30,8 @@ if(count($get_params)) {
|
|
28 |
$page_url .= '?' . http_build_query($get_params);
|
29 |
}
|
30 |
|
|
|
|
|
31 |
if($glang == $main_lang) {
|
32 |
$page_url = preg_replace('/^[\/]+/', '/', $page_url);
|
33 |
|
@@ -165,8 +169,10 @@ $headers_sent = '';
|
|
165 |
foreach($response_headers as $header) {
|
166 |
if(!empty($header) and !preg_match('/Content\-Length|Transfer\-Encoding|Content\-Encoding|Link/i', $header)) {
|
167 |
|
168 |
-
if(preg_match('/^Location:/i', $header))
|
169 |
$header = str_ireplace($host, $_SERVER['HTTP_HOST'] . '/' . $glang, $header);
|
|
|
|
|
170 |
|
171 |
$headers_sent .= $header;
|
172 |
header($header, false);
|
1 |
<?php
|
2 |
+
error_reporting(0);
|
3 |
+
|
4 |
include 'config.php';
|
5 |
|
6 |
if(!isset($_GET['glang']) or !isset($_GET['gurl']))
|
30 |
$page_url .= '?' . http_build_query($get_params);
|
31 |
}
|
32 |
|
33 |
+
$main_lang = isset($data['default_language']) ? $data['default_language'] : $main_lang;
|
34 |
+
|
35 |
if($glang == $main_lang) {
|
36 |
$page_url = preg_replace('/^[\/]+/', '/', $page_url);
|
37 |
|
169 |
foreach($response_headers as $header) {
|
170 |
if(!empty($header) and !preg_match('/Content\-Length|Transfer\-Encoding|Content\-Encoding|Link/i', $header)) {
|
171 |
|
172 |
+
if(preg_match('/^Location:/i', $header)) {
|
173 |
$header = str_ireplace($host, $_SERVER['HTTP_HOST'] . '/' . $glang, $header);
|
174 |
+
$header = str_ireplace('Location: /', 'Location: /' . $glang . '/', $header);
|
175 |
+
}
|
176 |
|
177 |
$headers_sent .= $header;
|
178 |
header($header, false);
|