Version Description
- Translate WooCommerce Emails feature added, now we are in beta testing stage.
- Minor issue solved related to http request headers in Sub-directory URL structure
- FAQ updated
Download this release
Release Info
Developer | edo888 |
Plugin | Translate WordPress with GTranslate |
Version | 2.8.51 |
Comparing to | |
See all releases |
Code changes from version 2.8.50 to 2.8.51
- gtranslate.php +108 -6
- readme.txt +57 -29
- url_addon/gtranslate-email.php +57 -0
- url_addon/gtranslate.php +1 -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: Translate AI Multilingual Solutions
|
8 |
Author URI: https://gtranslate.io
|
9 |
Text Domain: gtranslate
|
@@ -98,6 +98,8 @@ class GTranslate extends WP_Widget {
|
|
98 |
global $text_direction;
|
99 |
if(isset($_SERVER['HTTP_X_GT_LANG']) and in_array($_SERVER['HTTP_X_GT_LANG'], array('ar', 'iw', 'fa')))
|
100 |
$text_direction = 'rtl';
|
|
|
|
|
101 |
}
|
102 |
|
103 |
public function widget($args, $instance) {
|
@@ -321,11 +323,13 @@ function RefreshDoWidgetCode() {
|
|
321 |
jQuery('#new_window_option').show();
|
322 |
jQuery('#url_translation_option').show();
|
323 |
jQuery('#hreflang_tags_option').show();
|
|
|
324 |
//jQuery('#auto_switch_option').hide();
|
325 |
} else {
|
326 |
jQuery('#new_window_option').hide();
|
327 |
jQuery('#url_translation_option').hide();
|
328 |
jQuery('#hreflang_tags_option').hide();
|
|
|
329 |
//jQuery('#auto_switch_option').show();
|
330 |
}
|
331 |
|
@@ -782,6 +786,7 @@ jQuery('#pro_version').attr('checked', '$pro_version'.length > 0);
|
|
782 |
jQuery('#enterprise_version').attr('checked', '$enterprise_version'.length > 0);
|
783 |
jQuery('#url_translation').attr('checked', '$url_translation'.length > 0);
|
784 |
jQuery('#add_hreflang_tags').attr('checked', '$add_hreflang_tags'.length > 0);
|
|
|
785 |
jQuery('#new_window').attr('checked', '$new_window'.length > 0);
|
786 |
jQuery('#show_in_menu').val('$show_in_menu');
|
787 |
jQuery('#floating_language_selector').val('$floating_language_selector');
|
@@ -797,6 +802,7 @@ if(jQuery('#pro_version:checked').length || jQuery('#enterprise_version:checked'
|
|
797 |
jQuery('#new_window_option').show();
|
798 |
jQuery('#url_translation_option').show();
|
799 |
jQuery('#hreflang_tags_option').show();
|
|
|
800 |
//jQuery('#auto_switch_option').hide();
|
801 |
}
|
802 |
|
@@ -1032,6 +1038,10 @@ EOT;
|
|
1032 |
<td class="option_name"><?php _e('Add hreflang tags', 'gtranslate'); ?>:</td>
|
1033 |
<td><input id="add_hreflang_tags" name="add_hreflang_tags" value="1" type="checkbox"/></td>
|
1034 |
</tr>
|
|
|
|
|
|
|
|
|
1035 |
<tr id="new_window_option" style="display:none;">
|
1036 |
<td class="option_name"><?php _e('Open in new window', 'gtranslate'); ?>:</td>
|
1037 |
<td><input id="new_window" name="new_window" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/></td>
|
@@ -1195,6 +1205,7 @@ EOT;
|
|
1195 |
<li style="margin:0;"><?php _e('Search engine friendly (SEF) URLs', 'gtranslate'); ?></li>
|
1196 |
<li style="margin:0;"><?php _e('Human level neural translations', 'gtranslate'); ?></li>
|
1197 |
<li style="margin:0;"><?php _e('Edit translations manually', 'gtranslate'); ?></li>
|
|
|
1198 |
<li style="margin:0;"><?php _e('Meta data translation (keywords, page description, etc...)', 'gtranslate'); ?></li>
|
1199 |
<li style="margin:0;"><?php _e('URL/slug translation', 'gtranslate'); ?></li>
|
1200 |
<li style="margin:0;"><?php _e('Language hosting (custom domain like example.fr, example.es)', 'gtranslate'); ?></li>
|
@@ -1204,9 +1215,9 @@ EOT;
|
|
1204 |
<li style="margin:0;"><?php _e('Priority Live Chat support', 'gtranslate'); ?></li>
|
1205 |
</ul>
|
1206 |
|
1207 |
-
<p><?php _e('Prices starting from <b>$
|
1208 |
|
1209 |
-
<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>
|
1210 |
</div>
|
1211 |
</div>
|
1212 |
</div>
|
@@ -1236,13 +1247,14 @@ EOT;
|
|
1236 |
<h3 id="settings"><?php _e('Useful links', 'gtranslate'); ?></h3>
|
1237 |
<div class="inside">
|
1238 |
<ul style="list-style-type:square;padding-left:20px;">
|
1239 |
-
<li style="margin:0;"><a style="text-decoration:none;" href="https://wordpress.org/plugins/gtranslate/#installation" target="_blank"><?php _e('Quick instructions', 'gtranslate'); ?></a></li>
|
1240 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/videos" target="_blank"><?php _e('Videos', 'gtranslate'); ?></a></li>
|
|
|
|
|
|
|
1241 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/?xyz=998#faq" target="_blank"><?php _e('FAQ', 'gtranslate'); ?></a></li>
|
1242 |
-
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/forum/" target="_blank"><?php _e('Support forum', 'gtranslate'); ?></a></li>
|
1243 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://my.gtranslate.io/" target="_blank"><?php _e('User dashboard', 'gtranslate'); ?></a></li>
|
1244 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/?xyz=998#pricing" target="_blank"><?php _e('Compare plans', 'gtranslate'); ?></a></li>
|
1245 |
-
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/
|
1246 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://wordpress.org/support/plugin/gtranslate/reviews/" target="_blank"><?php _e('Reviews', 'gtranslate'); ?></a></li>
|
1247 |
</ul>
|
1248 |
</div>
|
@@ -1304,6 +1316,7 @@ EOT;
|
|
1304 |
$data['enterprise_version'] = isset($_POST['enterprise_version']) ? intval($_POST['enterprise_version']) : '';
|
1305 |
$data['url_translation'] = isset($_POST['url_translation']) ? intval($_POST['url_translation']) : '';
|
1306 |
$data['add_hreflang_tags'] = isset($_POST['add_hreflang_tags']) ? intval($_POST['add_hreflang_tags']) : '';
|
|
|
1307 |
$data['new_window'] = isset($_POST['new_window']) ? intval($_POST['new_window']) : '';
|
1308 |
$data['show_in_menu'] = isset($_POST['show_in_menu']) ? sanitize_text_field($_POST['show_in_menu']) : '';
|
1309 |
$data['floating_language_selector'] = isset($_POST['floating_language_selector']) ? sanitize_text_field($_POST['floating_language_selector']) : 'no';
|
@@ -1372,6 +1385,7 @@ EOT;
|
|
1372 |
$data['enterprise_version'] = isset($data['enterprise_version']) ? $data['enterprise_version'] : '';
|
1373 |
$data['url_translation'] = isset($data['url_translation']) ? $data['url_translation'] : '';
|
1374 |
$data['add_hreflang_tags'] = isset($data['add_hreflang_tags']) ? $data['add_hreflang_tags'] : '';
|
|
|
1375 |
$data['new_window'] = isset($data['new_window']) ? $data['new_window'] : '';
|
1376 |
$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' : '');
|
1377 |
$data['floating_language_selector'] = isset($data['floating_language_selector']) ? $data['floating_language_selector'] : 'no';
|
@@ -2216,6 +2230,94 @@ if($data['pro_version'] or $data['enterprise_version']) {
|
|
2216 |
add_filter('woocommerce_get_script_data', 'gt_filter_woocommerce_scripts_data', 10, 2 );
|
2217 |
|
2218 |
add_filter('woocommerce_geolocate_ip', 'gt_woocommerce_geolocate_ip', 10, 4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2219 |
}
|
2220 |
|
2221 |
if($data['enterprise_version']) {
|
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.51
|
7 |
Author: Translate AI Multilingual Solutions
|
8 |
Author URI: https://gtranslate.io
|
9 |
Text Domain: gtranslate
|
98 |
global $text_direction;
|
99 |
if(isset($_SERVER['HTTP_X_GT_LANG']) and in_array($_SERVER['HTTP_X_GT_LANG'], array('ar', 'iw', 'fa')))
|
100 |
$text_direction = 'rtl';
|
101 |
+
elseif(isset($_SERVER['HTTP_X_GT_LANG']))
|
102 |
+
$text_direction = 'ltr';
|
103 |
}
|
104 |
|
105 |
public function widget($args, $instance) {
|
323 |
jQuery('#new_window_option').show();
|
324 |
jQuery('#url_translation_option').show();
|
325 |
jQuery('#hreflang_tags_option').show();
|
326 |
+
jQuery('#email_translation_option').show();
|
327 |
//jQuery('#auto_switch_option').hide();
|
328 |
} else {
|
329 |
jQuery('#new_window_option').hide();
|
330 |
jQuery('#url_translation_option').hide();
|
331 |
jQuery('#hreflang_tags_option').hide();
|
332 |
+
jQuery('#email_translation_option').hide();
|
333 |
//jQuery('#auto_switch_option').show();
|
334 |
}
|
335 |
|
786 |
jQuery('#enterprise_version').attr('checked', '$enterprise_version'.length > 0);
|
787 |
jQuery('#url_translation').attr('checked', '$url_translation'.length > 0);
|
788 |
jQuery('#add_hreflang_tags').attr('checked', '$add_hreflang_tags'.length > 0);
|
789 |
+
jQuery('#email_translation').attr('checked', '$email_translation'.length > 0);
|
790 |
jQuery('#new_window').attr('checked', '$new_window'.length > 0);
|
791 |
jQuery('#show_in_menu').val('$show_in_menu');
|
792 |
jQuery('#floating_language_selector').val('$floating_language_selector');
|
802 |
jQuery('#new_window_option').show();
|
803 |
jQuery('#url_translation_option').show();
|
804 |
jQuery('#hreflang_tags_option').show();
|
805 |
+
jQuery('#email_translation_option').show();
|
806 |
//jQuery('#auto_switch_option').hide();
|
807 |
}
|
808 |
|
1038 |
<td class="option_name"><?php _e('Add hreflang tags', 'gtranslate'); ?>:</td>
|
1039 |
<td><input id="add_hreflang_tags" name="add_hreflang_tags" value="1" type="checkbox"/></td>
|
1040 |
</tr>
|
1041 |
+
<tr id="email_translation_option" style="display:none;">
|
1042 |
+
<td class="option_name"><?php _e('Enable WooCommerce Email Translation', 'gtranslate'); ?> (beta):</td>
|
1043 |
+
<td><input id="email_translation" name="email_translation" value="1" type="checkbox"/></td>
|
1044 |
+
</tr>
|
1045 |
<tr id="new_window_option" style="display:none;">
|
1046 |
<td class="option_name"><?php _e('Open in new window', 'gtranslate'); ?>:</td>
|
1047 |
<td><input id="new_window" name="new_window" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/></td>
|
1205 |
<li style="margin:0;"><?php _e('Search engine friendly (SEF) URLs', 'gtranslate'); ?></li>
|
1206 |
<li style="margin:0;"><?php _e('Human level neural translations', 'gtranslate'); ?></li>
|
1207 |
<li style="margin:0;"><?php _e('Edit translations manually', 'gtranslate'); ?></li>
|
1208 |
+
<li style="margin:0;"><a href="https://gtranslate.io/website-translation-quote" title="Website Translation Price Calculator" target="_blank"><?php _e('Automatic translation post-editing service and professional translations', 'gtranslate'); ?></a></li>
|
1209 |
<li style="margin:0;"><?php _e('Meta data translation (keywords, page description, etc...)', 'gtranslate'); ?></li>
|
1210 |
<li style="margin:0;"><?php _e('URL/slug translation', 'gtranslate'); ?></li>
|
1211 |
<li style="margin:0;"><?php _e('Language hosting (custom domain like example.fr, example.es)', 'gtranslate'); ?></li>
|
1215 |
<li style="margin:0;"><?php _e('Priority Live Chat support', 'gtranslate'); ?></li>
|
1216 |
</ul>
|
1217 |
|
1218 |
+
<p><?php _e('Prices starting from <b>$7.99/month</b>!', 'gtranslate'); ?></p>
|
1219 |
|
1220 |
+
<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/website-translation-quote" target="_blank" class="button-primary"><?php _e('Website Translation Quote', 'gtranslate'); ?></a> <a href="https://gtranslate.io/?xyz=998#contact" target="_blank" class="button-primary"><?php _e('Live Chat', 'gtranslate'); ?></a>
|
1221 |
</div>
|
1222 |
</div>
|
1223 |
</div>
|
1247 |
<h3 id="settings"><?php _e('Useful links', 'gtranslate'); ?></h3>
|
1248 |
<div class="inside">
|
1249 |
<ul style="list-style-type:square;padding-left:20px;">
|
|
|
1250 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/videos" target="_blank"><?php _e('Videos', 'gtranslate'); ?></a></li>
|
1251 |
+
<li style="margin:0;"><a style="text-decoration:none;" href="https://docs.gtranslate.io/how-tos" target="_blank"><?php _e('How-tos', 'gtranslate'); ?></a></li>
|
1252 |
+
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/blog" target="_blank"><?php _e('Blog', 'gtranslate'); ?></a></li>
|
1253 |
+
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/about-us" target="_blank"><?php _e('About GTranslate team', 'gtranslate'); ?></a></li>
|
1254 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/?xyz=998#faq" target="_blank"><?php _e('FAQ', 'gtranslate'); ?></a></li>
|
|
|
1255 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://my.gtranslate.io/" target="_blank"><?php _e('User dashboard', 'gtranslate'); ?></a></li>
|
1256 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/?xyz=998#pricing" target="_blank"><?php _e('Compare plans', 'gtranslate'); ?></a></li>
|
1257 |
+
<li style="margin:0;"><a style="text-decoration:none;" href="https://gtranslate.io/website-translation-quote" target="_blank"><?php _e('Website Translation Quote', 'gtranslate'); ?></a></li>
|
1258 |
<li style="margin:0;"><a style="text-decoration:none;" href="https://wordpress.org/support/plugin/gtranslate/reviews/" target="_blank"><?php _e('Reviews', 'gtranslate'); ?></a></li>
|
1259 |
</ul>
|
1260 |
</div>
|
1316 |
$data['enterprise_version'] = isset($_POST['enterprise_version']) ? intval($_POST['enterprise_version']) : '';
|
1317 |
$data['url_translation'] = isset($_POST['url_translation']) ? intval($_POST['url_translation']) : '';
|
1318 |
$data['add_hreflang_tags'] = isset($_POST['add_hreflang_tags']) ? intval($_POST['add_hreflang_tags']) : '';
|
1319 |
+
$data['email_translation'] = isset($_POST['email_translation']) ? intval($_POST['email_translation']) : '';
|
1320 |
$data['new_window'] = isset($_POST['new_window']) ? intval($_POST['new_window']) : '';
|
1321 |
$data['show_in_menu'] = isset($_POST['show_in_menu']) ? sanitize_text_field($_POST['show_in_menu']) : '';
|
1322 |
$data['floating_language_selector'] = isset($_POST['floating_language_selector']) ? sanitize_text_field($_POST['floating_language_selector']) : 'no';
|
1385 |
$data['enterprise_version'] = isset($data['enterprise_version']) ? $data['enterprise_version'] : '';
|
1386 |
$data['url_translation'] = isset($data['url_translation']) ? $data['url_translation'] : '';
|
1387 |
$data['add_hreflang_tags'] = isset($data['add_hreflang_tags']) ? $data['add_hreflang_tags'] : '';
|
1388 |
+
$data['email_translation'] = isset($data['email_translation']) ? $data['email_translation'] : '';
|
1389 |
$data['new_window'] = isset($data['new_window']) ? $data['new_window'] : '';
|
1390 |
$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' : '');
|
1391 |
$data['floating_language_selector'] = isset($data['floating_language_selector']) ? $data['floating_language_selector'] : 'no';
|
2230 |
add_filter('woocommerce_get_script_data', 'gt_filter_woocommerce_scripts_data', 10, 2 );
|
2231 |
|
2232 |
add_filter('woocommerce_geolocate_ip', 'gt_woocommerce_geolocate_ip', 10, 4);
|
2233 |
+
|
2234 |
+
// translate emails
|
2235 |
+
if($data['email_translation']) {
|
2236 |
+
function gt_translate_emails($args) {
|
2237 |
+
$subject = $args['subject'];
|
2238 |
+
$message = $args['message'];
|
2239 |
+
|
2240 |
+
if(function_exists('curl_init') and isset($_SERVER['HTTP_X_GT_LANG'])) {
|
2241 |
+
//file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', date('Y-m-d H:i:s') . " - <subject>$subject</subject><message>$message</message>\n", FILE_APPEND);
|
2242 |
+
|
2243 |
+
// translate woocommerce
|
2244 |
+
if(strpos($message, 'woocommerce') !== false) {
|
2245 |
+
include dirname(__FILE__) . '/url_addon/config.php';
|
2246 |
+
$server_id = intval(substr(md5(preg_replace('/^www\./', '', $_SERVER['HTTP_HOST'])), 0, 5), 16) % count($servers);
|
2247 |
+
$server = $servers[$server_id];
|
2248 |
+
$host = $_SERVER['HTTP_X_GT_LANG'] . '.' . preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
|
2249 |
+
$protocol = ((isset($_SERVER['HTTPS']) and ($_SERVER['HTTPS'] == 'on' or $_SERVER['HTTPS'] == 1)) or (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https' : 'http';
|
2250 |
+
|
2251 |
+
$headers = array();
|
2252 |
+
$headers[] = 'Host: ' . $host;
|
2253 |
+
// add real visitor IP header
|
2254 |
+
if(isset($_SERVER['HTTP_CLIENT_IP']) and !empty($_SERVER['HTTP_CLIENT_IP']))
|
2255 |
+
$viewer_ip_address = $_SERVER['HTTP_CLIENT_IP'];
|
2256 |
+
if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) and !empty($_SERVER['HTTP_CF_CONNECTING_IP']))
|
2257 |
+
$viewer_ip_address = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
2258 |
+
if(isset($_SERVER['HTTP_X_SUCURI_CLIENTIP']) and !empty($_SERVER['HTTP_X_SUCURI_CLIENTIP']))
|
2259 |
+
$viewer_ip_address = $_SERVER['HTTP_X_SUCURI_CLIENTIP'];
|
2260 |
+
if(!isset($viewer_ip_address))
|
2261 |
+
$viewer_ip_address = $_SERVER['REMOTE_ADDR'];
|
2262 |
+
|
2263 |
+
$headers[] = 'X-GT-Viewer-IP: ' . $viewer_ip_address;
|
2264 |
+
|
2265 |
+
// add X-Forwarded-For
|
2266 |
+
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) and !empty($_SERVER['HTTP_X_FORWARDED_FOR']))
|
2267 |
+
$headers[] = 'X-GT-Forwarded-For: ' . $_SERVER['HTTP_X_FORWARDED_FOR'];
|
2268 |
+
|
2269 |
+
//file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Request URL: ' . $protocol.'://'.$server.'.tdn.gtranslate.net'.wp_make_link_relative(plugins_url('gtranslate/url_addon/gtranslate-email.php')) . "\n", FILE_APPEND);
|
2270 |
+
|
2271 |
+
$ch = curl_init();
|
2272 |
+
curl_setopt($ch, CURLOPT_URL, $protocol.'://'.$server.'.tdn.gtranslate.net'.wp_make_link_relative(plugins_url('gtranslate/url_addon/gtranslate-email.php').'?glang='.$_SERVER['HTTP_X_GT_LANG']));
|
2273 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
2274 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
2275 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
2276 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
2277 |
+
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/url_addon/cacert.pem');
|
2278 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
2279 |
+
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))));
|
2280 |
+
|
2281 |
+
// Debug
|
2282 |
+
if(false) {
|
2283 |
+
$fh = fopen(dirname(__FILE__) . '/url_addon/debug.txt', 'a');
|
2284 |
+
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
2285 |
+
curl_setopt($ch, CURLOPT_STDERR, $fh);
|
2286 |
+
}
|
2287 |
+
|
2288 |
+
$response = curl_exec($ch);
|
2289 |
+
$response_info = curl_getinfo($ch);
|
2290 |
+
curl_close($ch);
|
2291 |
+
|
2292 |
+
//file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Response: ' . $response . "\n", FILE_APPEND);
|
2293 |
+
//file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Response_info: ' . print_r($response_info, true) . "\n", FILE_APPEND);
|
2294 |
+
|
2295 |
+
if(isset($response_info['http_code']) and $response_info['http_code'] == 200) {
|
2296 |
+
if($data['pro_version'])
|
2297 |
+
$response = str_ireplace($host, $_SERVER['HTTP_HOST'] . '/' . $_SERVER['HTTP_X_GT_LANG'], $response);
|
2298 |
+
|
2299 |
+
preg_match_all('/<subject>(.*?)<\/subject><message>(.*?)<\/message>/s', $response, $matches);
|
2300 |
+
//file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Matches: ' . print_r($matches, true) . "\n", FILE_APPEND);
|
2301 |
+
|
2302 |
+
if(isset($matches[1][0], $matches[2][0])) {
|
2303 |
+
$subject = $matches[1][0];
|
2304 |
+
$message = $matches[2][0];
|
2305 |
+
|
2306 |
+
//file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Translated Subject: ' . $subject . "\n", FILE_APPEND);
|
2307 |
+
//file_put_contents(dirname(__FILE__) . '/url_addon/debug.txt', 'Translated Message: ' . $message . "\n", FILE_APPEND);
|
2308 |
+
|
2309 |
+
$args['subject'] = $subject;
|
2310 |
+
$args['message'] = $message;
|
2311 |
+
}
|
2312 |
+
}
|
2313 |
+
}
|
2314 |
+
}
|
2315 |
+
|
2316 |
+
return $args;
|
2317 |
+
}
|
2318 |
+
|
2319 |
+
add_filter('wp_mail', 'gt_translate_emails', 10, 1);
|
2320 |
+
}
|
2321 |
}
|
2322 |
|
2323 |
if($data['enterprise_version']) {
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Translate Wordpress with GTranslate ===
|
2 |
Contributors: edo888
|
3 |
Author: Translate AI Multilingual Solutions
|
4 |
-
Tags: translate wordpress, multilingual,
|
5 |
Requires at least: 2.8.1
|
6 |
Tested up to: 5.3
|
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
|
@@ -29,9 +29,9 @@ Please check our [FAQ](https://gtranslate.io/?xyz=998#faq) to get quick answers.
|
|
29 |
* Hides Google top frame after translation
|
30 |
* Mouse over effect
|
31 |
* Google Analytics integration
|
32 |
-
*
|
33 |
-
*
|
34 |
-
*
|
35 |
* Menus and widgets translation
|
36 |
* Themes and plugins translation
|
37 |
* Right to left language support
|
@@ -64,6 +64,7 @@ Please check our [FAQ](https://gtranslate.io/?xyz=998#faq) to get quick answers.
|
|
64 |
* Translating schema.org microdata for better search engine appearance
|
65 |
* Seamless updates (cloud service updated on our side - SaaS, you do not need to worry about backups on your side)
|
66 |
* JSON format translation
|
|
|
67 |
* AMP translation (Accelerated Mobile Pages translation)
|
68 |
* Image localization - Media translation
|
69 |
* Translation Proxy (aka Translation Delivery Network)
|
@@ -132,35 +133,51 @@ GTranslate is a multilingual solution for your website.
|
|
132 |
|
133 |
= Is it FREE? =
|
134 |
Yes! We have free version and paid versions with [advanced features](https://gtranslate.io/?xyz=998#pricing).
|
|
|
135 |
|
136 |
= What is the quality of translation? =
|
137 |
-
|
138 |
-
|
139 |
-
You can
|
140 |
|
141 |
= Are the translations provided free of charge? =
|
142 |
-
Yes, we use Google Translate widget for website which provides free machine translations which makes it possible to make your wordpress website multilingual instantly upon installation.
|
|
|
|
|
|
|
|
|
143 |
|
144 |
= Can I modify the translations? =
|
145 |
-
That feature is available in our paid version. You will be able to make edits directly on the page without losing the context.
|
|
|
|
|
|
|
|
|
146 |
|
147 |
= Which languages are supported? =
|
148 |
Here is the list: Afrikaans, Albanian, Amharic, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chichewa, Chinese (Simplified), Chinese (Traditional), Corsican, Croatian, Czech, Danish, Dutch, English, Esperanto, Estonian, Filipino, Finnish, French, Frisian, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hausa, Hawaiian, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Korean, Kurdish (Kurmanji), Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malagasy, Malay, Malayalam, Maltese, Maori, Marathi, Mongolian, Myanmar (Burmese), Nepali, Norwegian, Pashto, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Samoan, Scottish Gaelic, Serbian, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenian, Somali, Spanish, Sudanese, Swahili, Swedish, Tajik, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese, Welsh, Xhosa, Yiddish, Yoruba, Zulu
|
149 |
|
150 |
= Is it SEO compatible? =
|
151 |
-
Our free version doesn't give any SEO advantage.
|
|
|
|
|
|
|
152 |
|
153 |
= What is multilingual SEO? =
|
154 |
-
Multilingual SEO is a SEO strategy which uses new content generation technique by translating your original content and making your website multilingual.
|
155 |
|
156 |
= Is URL Translation available? =
|
157 |
-
In our paid versions we have a feature to translate URL of your website which will give you more SEO advantage.
|
|
|
|
|
|
|
158 |
|
159 |
= Does it translate emails too? =
|
160 |
-
Email
|
|
|
161 |
|
162 |
= How the free version differs from the paid versions? =
|
163 |
-
Free vesion is a nice looking language selector you can place on your website. It has a built in Javascript engine which allows to translate your website automatically to multiple languages. With free
|
164 |
|
165 |
= What is a Translation Delivery Network? =
|
166 |
Translation Delivery Network is a translation proxy which mirrors your website in different languages.
|
@@ -169,18 +186,27 @@ GTranslate TDN technology is a cloud-based approach to the website translation t
|
|
169 |
|
170 |
We will translate your content and host your translations in our cloud network. All the visits to your translated versions will be proxied through our network to your original website, so you will have a translated mirror of your website.
|
171 |
|
|
|
|
|
172 |
= Can I exclude some parts from being translated? =
|
173 |
Yes, you need to wrap the text you don't want to be translated with <span class="notranslate"></span>.
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
-
|
176 |
-
|
|
|
|
|
177 |
|
178 |
[vimeo http://vimeo.com/38686858]
|
179 |
|
180 |
= How Translation Delivery Network works? =
|
181 |
You just need to change your DNS records to add sub-domains or domains dedicated to your languages to our Translation Delivery Network.
|
182 |
|
183 |
-
So when someone visits the new added sub-domain
|
184 |
|
185 |
After that you can just configure and place the GTranslate Free widget on your site to enable language selection.
|
186 |
|
@@ -193,25 +219,22 @@ Updates are done seamlessly. Since the translations are hosted on our server we
|
|
193 |
= Do I need to pay for Google Translate API key usage? =
|
194 |
No, we provide the automatic translations for free.
|
195 |
|
|
|
|
|
|
|
196 |
= Can I test before making a payment? =
|
197 |
Yes, we have a 15 days free trial for our new customers.
|
198 |
|
199 |
-
=
|
200 |
-
Absolutely! You can use it for our free and paid versions.
|
201 |
-
|
202 |
-
Recently we have added support for Let's Encrypt certificates which are provided for free if you use sub-domain URL structure.
|
203 |
-
|
204 |
-
= Can I exclude some parts from being translated? =
|
205 |
-
Yes, you need to wrap the text you don't want to be translated with <span class="notranslate"></span>. You can add class="nturl" to the "a" tag if you don't want the destination URL to contain the language code.
|
206 |
-
|
207 |
-
= How does the 15 day free trial work? =
|
208 |
Trial is available for new customers only. If you do not wish to continue you may cancel any time during the trial period and you will not be charged anything.
|
209 |
|
210 |
-
= How can I be sure that search engines will index my website? =
|
211 |
You can check that this website is indexed in Google by searching for site:gtranslate.io.
|
212 |
|
213 |
= How I can edit the translations or order professional human translations? =
|
214 |
-
You need to go to the language you want to edit, for instance, French: http://domain.com/fr/ and add ?language_edit=1 to the end of the URL: http://domain.com/fr/?language_edit=1 and you will see the Edit
|
|
|
|
|
215 |
|
216 |
== Screenshots ==
|
217 |
1. Dropdown with flags
|
@@ -224,6 +247,11 @@ You need to go to the language you want to edit, for instance, French: http://do
|
|
224 |
8. User Dashboard
|
225 |
|
226 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
227 |
= 2.8.50 =
|
228 |
* Solved issue with wp_get_referer checks not passing on translated sub-domains
|
229 |
* Solved issue with http Refresh header which was not redirecting to correct URL in translated version
|
1 |
=== Translate Wordpress with GTranslate ===
|
2 |
Contributors: edo888
|
3 |
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.3
|
7 |
+
Stable tag: 2.8.51
|
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
|
29 |
* Hides Google top frame after translation
|
30 |
* Mouse over effect
|
31 |
* Google Analytics integration
|
32 |
+
* Translate website on the fly
|
33 |
+
* Translate posts and pages
|
34 |
+
* Translate categories and tags
|
35 |
* Menus and widgets translation
|
36 |
* Themes and plugins translation
|
37 |
* Right to left language support
|
64 |
* Translating schema.org microdata for better search engine appearance
|
65 |
* Seamless updates (cloud service updated on our side - SaaS, you do not need to worry about backups on your side)
|
66 |
* JSON format translation
|
67 |
+
* Translate WooCommerce emails
|
68 |
* AMP translation (Accelerated Mobile Pages translation)
|
69 |
* Image localization - Media translation
|
70 |
* Translation Proxy (aka Translation Delivery Network)
|
133 |
|
134 |
= Is it FREE? =
|
135 |
Yes! We have free version and paid versions with [advanced features](https://gtranslate.io/?xyz=998#pricing).
|
136 |
+
Unlike other translate plugins, which require you to pay for Google Translate API usage or other translate API usage, we also provide automatic translations for free.
|
137 |
|
138 |
= What is the quality of translation? =
|
139 |
+
In our free version we use Phrase Based Machine Translations provided by Google Translate, while in our paid versions use Google Translate Neural Translations which are very accurate for popular language pairs.
|
140 |
+
In the paid versions you can refine the automatic translations yourself or order professional translations or proofreading of a translated content.
|
141 |
+
You can get a translation cost estimate by using our [Website Translation Cost Calculator](https://gtranslate.io/website-translation-quote)
|
142 |
|
143 |
= Are the translations provided free of charge? =
|
144 |
+
Yes, we use Google Translate widget for website which provides free phrase based machine translations, which makes it possible to make your wordpress website multilingual instantly upon installation.
|
145 |
+
In our paid versions we use Google Translate state of the art Neural Translations which are included in the service price and there are no limits on the word count.
|
146 |
+
|
147 |
+
Besides we offer cost effective automatic translation proofreading service and also professional translation service.
|
148 |
+
You can get an estimate from our [Website Translation Price Calculator](https://gtranslate.io/website-translation-quote)
|
149 |
|
150 |
= Can I modify the translations? =
|
151 |
+
That feature is available only in our paid version. You will be able to make edits directly on the page without losing the context.
|
152 |
+
|
153 |
+
By the way, we can help you to translate your website with a cost effective approach by post-editing your automatic translated content.
|
154 |
+
The proofreading service will be done by a native speakers and if you want to take the quality to another service, we also have a professional website translation service available.
|
155 |
+
You can get an instant website translation estimate by using our [Website Word Counter](https://gtranslate.io/website-translation-quote) tool.
|
156 |
|
157 |
= Which languages are supported? =
|
158 |
Here is the list: Afrikaans, Albanian, Amharic, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chichewa, Chinese (Simplified), Chinese (Traditional), Corsican, Croatian, Czech, Danish, Dutch, English, Esperanto, Estonian, Filipino, Finnish, French, Frisian, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hausa, Hawaiian, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Kazakh, Khmer, Korean, Kurdish (Kurmanji), Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malagasy, Malay, Malayalam, Maltese, Maori, Marathi, Mongolian, Myanmar (Burmese), Nepali, Norwegian, Pashto, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Samoan, Scottish Gaelic, Serbian, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenian, Somali, Spanish, Sudanese, Swahili, Swedish, Tajik, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese, Welsh, Xhosa, Yiddish, Yoruba, Zulu
|
159 |
|
160 |
= Is it SEO compatible? =
|
161 |
+
Our free version doesn't give any SEO advantage.
|
162 |
+
For SEO features and multilingual SEO you need to use our paid versions which have all the SEO advantages.
|
163 |
+
Unlike other translate plugins, we provide you all the possible tools to match with your multilingual SEO strategy.
|
164 |
+
For example you can have your translated content available via sub-directories (https://example.com/es, https://example.com/fr) or sub-domains (https://it.example.com, https://fr.example.com) or even you can host the translated versions on a top level country specific domain or any other domain like (https://example.fr, https://example.de), which will increase your chances to rank higher in local search engine's results pages.
|
165 |
|
166 |
= What is multilingual SEO? =
|
167 |
+
Multilingual SEO is a SEO strategy which uses new content generation technique by translating your original content and making your website multilingual. When you translate your website into many languages you actually create many new multilingual keywords targeted for international market. It helps to increase your search appearnce or impressions count on search engines results pages (SERPs), which can generate more traffic, increase sales and rise the conversion rate, because when the wording is in the correct language it is more effective.
|
168 |
|
169 |
= Is URL Translation available? =
|
170 |
+
In our paid versions we have a feature to translate URL of your website which will give you more SEO advantage.
|
171 |
+
For example http://example.com/*about-us* → http://example.com/*sobre-nosotros*
|
172 |
+
|
173 |
+
This is an important part of multilingual SEO strategy. When you have URL Translate option and translate also your website URLs also known us slugs, you are creating more keywords, which count as an improvement in your page rank for that keywords.
|
174 |
|
175 |
= Does it translate emails too? =
|
176 |
+
Yes, you can now translate WooCommerce emails too. Email translate feature is in beta testing stage, so if you notice any problems, please contact our live chat and let us know.
|
177 |
+
Please note that it is possible to notice partially translated emails at the beginning, but when our system learns more about your email templates everything will be translated.
|
178 |
|
179 |
= How the free version differs from the paid versions? =
|
180 |
+
Free vesion is a nice looking language selector you can place on your website. It has a built in Javascript engine which allows to translate your website automatically to multiple languages. With our free translate plugin your website URL doesn't change and the translations are not stored. While paid versions are a translation proxy also known as Translation Delivery Network. We host the translated versions of your website on our cloud network under a language specific domain. In that case every language will have a separate domain or separate URL and be indexed in search engines, which will help you to increase international traffic and sales.
|
181 |
|
182 |
= What is a Translation Delivery Network? =
|
183 |
Translation Delivery Network is a translation proxy which mirrors your website in different languages.
|
186 |
|
187 |
We will translate your content and host your translations in our cloud network. All the visits to your translated versions will be proxied through our network to your original website, so you will have a translated mirror of your website.
|
188 |
|
189 |
+
This keeps away the need to use additional resources on your server like storage to store translations, compute time to render the translated pages or network bandwidth to deliver the translated pages to your website visitors. All is done through our network.
|
190 |
+
|
191 |
= Can I exclude some parts from being translated? =
|
192 |
Yes, you need to wrap the text you don't want to be translated with <span class="notranslate"></span>.
|
193 |
+
With our paid versions you will have more control on the content which you do not want to translate. We have Skip Phrases, Skip Translations by CSS selectors and also Skip Pages features available.
|
194 |
+
You can read more about skipping translations on [How to skip translations?](https://docs.gtranslate.io/en/articles/1349930-how-to-skip-translations)
|
195 |
+
|
196 |
+
= Which plugins are supported? =
|
197 |
+
All plugins are supported.
|
198 |
|
199 |
+
Our technology allows us to translate what is visible on the page, since we are parsing the end result when your website is already generated and it doesn't matter how the content is generated and by which plugin. We can translate all HTML websites.
|
200 |
+
If you notice that something is not translated, please contact our live chat and we will be happy to solve any issues. Usually the not translated content is being loaded on your website from 3rd party sources.
|
201 |
+
|
202 |
+
We also offer you to change the images and media content on the translated versions and by doing that you can also translate the texts inside images and videos.
|
203 |
|
204 |
[vimeo http://vimeo.com/38686858]
|
205 |
|
206 |
= How Translation Delivery Network works? =
|
207 |
You just need to change your DNS records to add sub-domains or domains dedicated to your languages to our Translation Delivery Network.
|
208 |
|
209 |
+
So when someone visits the new added sub-domain we will show the translated clone of your website.
|
210 |
|
211 |
After that you can just configure and place the GTranslate Free widget on your site to enable language selection.
|
212 |
|
219 |
= Do I need to pay for Google Translate API key usage? =
|
220 |
No, we provide the automatic translations for free.
|
221 |
|
222 |
+
In our free version we provide Phrase Based machine translations from Google Translate. While in our paid versions we provide you state of the art Neural Translations from Google Translate. We also do not have limits on the number of words on your website unlike other translate plugins.
|
223 |
+
By the way we alse offer a cost effective approach for improving the website translations. You can get a automatic translation post-editing service from us, which will be done by a native speaker or order a professional translation. You can get an instant estimate for your website on [Website Translation Quote](https://gtranslate.io/website-translation-quote)
|
224 |
+
|
225 |
= Can I test before making a payment? =
|
226 |
Yes, we have a 15 days free trial for our new customers.
|
227 |
|
228 |
+
= How does the 15 day free trial work for your paid version? =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
Trial is available for new customers only. If you do not wish to continue you may cancel any time during the trial period and you will not be charged anything.
|
230 |
|
231 |
+
= How can I be sure that search engines will index my website translations? =
|
232 |
You can check that this website is indexed in Google by searching for site:gtranslate.io.
|
233 |
|
234 |
= How I can edit the translations or order professional human translations? =
|
235 |
+
You need to go to the language you want to edit, for instance, French: http://domain.com/fr/ and add ?language_edit=1 to the end of the URL: http://domain.com/fr/?language_edit=1 and you will see the Edit buttons near each text. Read more at [How to edit translations?](https://docs.gtranslate.io/en/articles/1348921-how-to-edit-translations)
|
236 |
+
|
237 |
+
If you want us to translate your website professionally or provide you a proofreading service for automatic translated content, you can get an instant estimate from [Website Translation Quote](https://gtranslate.io/website-translation-quote), where you will get a detailed document with the list of pages, unique word count and prices to translate them.
|
238 |
|
239 |
== Screenshots ==
|
240 |
1. Dropdown with flags
|
247 |
8. User Dashboard
|
248 |
|
249 |
== Changelog ==
|
250 |
+
= 2.8.51 =
|
251 |
+
* Translate WooCommerce Emails feature added, now we are in beta testing stage.
|
252 |
+
* Minor issue solved related to http request headers in Sub-directory URL structure
|
253 |
+
* FAQ updated
|
254 |
+
|
255 |
= 2.8.50 =
|
256 |
* Solved issue with wp_get_referer checks not passing on translated sub-domains
|
257 |
* Solved issue with http Refresh header which was not redirecting to correct URL in translated version
|
url_addon/gtranslate-email.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
error_reporting(0);
|
3 |
+
|
4 |
+
include 'config.php';
|
5 |
+
|
6 |
+
if(!isset($_GET['glang']))
|
7 |
+
exit;
|
8 |
+
|
9 |
+
$glang = $_GET['glang'];
|
10 |
+
|
11 |
+
$main_lang = isset($data['default_language']) ? $data['default_language'] : $main_lang;
|
12 |
+
|
13 |
+
if($glang == $main_lang) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
$wp_config_dir = dirname(__FILE__, 5) . '/wp-config.php';
|
18 |
+
if(file_exists($wp_config_dir) and isset($_POST['access_key'])) {
|
19 |
+
include $wp_config_dir;
|
20 |
+
if(md5(substr(NONCE_SALT, 0, 10) . substr(NONCE_KEY, 0, 5)) != $_POST['access_key'])
|
21 |
+
exit;
|
22 |
+
} else {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
if(!isset($_POST['subject']) or isset($_POST['body'])) {
|
27 |
+
die($_POST['body']);
|
28 |
+
}
|
29 |
+
|
30 |
+
if(!function_exists('curl_init')) {
|
31 |
+
if(function_exists('http_response_code'))
|
32 |
+
http_response_code(500);
|
33 |
+
|
34 |
+
echo 'PHP Curl library is required';
|
35 |
+
exit;
|
36 |
+
}
|
37 |
+
|
38 |
+
$ch = curl_init();
|
39 |
+
curl_setopt($ch, CURLOPT_URL, 'https://tdns.gtranslate.net/tdn-bin/email-translate?lang='.$glang);
|
40 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
41 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
|
42 |
+
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
43 |
+
curl_setopt($ch, CURLOPT_POST, 1);
|
44 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST['body']);
|
45 |
+
|
46 |
+
// Debug
|
47 |
+
if($debug or isset($_GET['enable_debug'])) {
|
48 |
+
$fh = fopen(dirname(__FILE__).'/debug.txt', 'a');
|
49 |
+
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
50 |
+
curl_setopt($ch, CURLOPT_STDERR, $fh);
|
51 |
+
}
|
52 |
+
|
53 |
+
$response = curl_exec($ch);
|
54 |
+
$response_info = curl_getinfo($ch);
|
55 |
+
curl_close($ch);
|
56 |
+
|
57 |
+
echo $response;
|
url_addon/gtranslate.php
CHANGED
@@ -219,7 +219,7 @@ $response_headers = explode(PHP_EOL, $header);
|
|
219 |
//print_r($response_headers);
|
220 |
$headers_sent = '';
|
221 |
foreach($response_headers as $header) {
|
222 |
-
if(!empty($header) and !preg_match('/Content\-Length:|Transfer\-Encoding:|Content\-Encoding:|Link:/i', $header)) {
|
223 |
|
224 |
if(preg_match('/^(Location|Refresh):/i', $header)) {
|
225 |
$header = str_ireplace($host, $_SERVER['HTTP_HOST'] . '/' . $glang, $header);
|
219 |
//print_r($response_headers);
|
220 |
$headers_sent = '';
|
221 |
foreach($response_headers as $header) {
|
222 |
+
if(!empty(trim($header)) and !preg_match('/Content\-Length:|Transfer\-Encoding:|Content\-Encoding:|Link:/i', $header)) {
|
223 |
|
224 |
if(preg_match('/^(Location|Refresh):/i', $header)) {
|
225 |
$header = str_ireplace($host, $_SERVER['HTTP_HOST'] . '/' . $glang, $header);
|