Translate WordPress with GTranslate - Version 2.8.2

Version Description

  • Floating language selector option added: Top left, Top right, Bottom left, Bottom right
Download this release

Release Info

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

Code changes from version 2.8.1 to 2.8.2

Files changed (3) hide show
  1. arrow_up.png +0 -0
  2. gtranslate.php +56 -9
  3. readme.txt +6 -3
arrow_up.png ADDED
Binary file
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.1
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
@@ -56,6 +56,29 @@ if($data['show_in_primary_menu']) {
56
  }
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  class GTranslate extends WP_Widget {
60
  public static function activate() {
61
  $data = array(
@@ -222,6 +245,7 @@ function RefreshDoWidgetCode() {
222
  var enterprise_version = jQuery('#enterprise_version:checked').length > 0 ? true : false;
223
  var new_window = jQuery('#new_window:checked').length > 0 ? true : false;
224
  var show_in_primary_menu = jQuery('#show_in_primary_menu:checked').length > 0 ? true : false;
 
225
  var analytics = jQuery('#analytics:checked').length > 0 ? true : false;
226
 
227
  if(pro_version || enterprise_version) {
@@ -264,6 +288,12 @@ function RefreshDoWidgetCode() {
264
  jQuery('#flag_size_option').show();
265
  }
266
 
 
 
 
 
 
 
267
  if(pro_version && enterprise_version)
268
  pro_version = false;
269
 
@@ -407,7 +437,7 @@ function RefreshDoWidgetCode() {
407
  x = centerPosition.left + Math.cos(angle) * r;
408
  y = centerPosition.top + Math.sin(angle) * r;
409
 
410
- var positionGSatelites = $('.gsatelites').offset(),
411
  vpHeight = $(window).height(),
412
  vpWidth = $(window).width(),
413
  tpViz = positionGSatelites.top + y >= 0 && positionGSatelites.top + y < vpHeight,
@@ -492,8 +522,8 @@ function hideGSatelites($) {
492
 
493
  // Adding slider javascript
494
  widget_preview += '<script type="text/javascript">'+new_line;
495
- widget_preview += "jQuery('.switcher .selected').click(function() {if(!(jQuery('.switcher .option').is(':visible'))) {jQuery('.switcher .option').stop(true,true).delay(50).slideDown(800);}});"+new_line;
496
- widget_preview += "jQuery('body').not('.switcher .selected').mousedown(function() {if(jQuery('.switcher .option').is(':visible')) {jQuery('.switcher .option').stop(true,true).delay(300).slideUp(800);}});"+new_line;
497
  widget_preview += '<\/script>'+new_line;
498
 
499
  // Adding slider css
@@ -505,6 +535,7 @@ function hideGSatelites($) {
505
  widget_preview += '.switcher a span.gflag {margin-right:3px;padding:0;display:block;float:left;}'+new_line;
506
  widget_preview += '.switcher .selected {background:#FFFFFF url($wp_plugin_url/switcher.png) repeat-x;position:relative;z-index:9999;}'+new_line;
507
  widget_preview += '.switcher .selected a {border:1px solid #CCCCCC;background:url($wp_plugin_url/arrow_down.png) 146px center no-repeat;color:#666666;padding:3px 5px;width:151px;}'+new_line;
 
508
  widget_preview += '.switcher .selected a:hover {background:#F0F0F0 url($wp_plugin_url/arrow_down.png) 146px center no-repeat;}'+new_line;
509
  widget_preview += '.switcher .option {position:relative;z-index:9998;border-left:1px solid #CCCCCC;border-right:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC;background-color:#EEEEEE;display:none;width:161px;max-height:198px;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;overflow-y:auto;overflow-x:hidden;}'+new_line;
510
  widget_preview += '.switcher .option a {color:#000;padding:3px 5px;}'+new_line;
@@ -595,6 +626,7 @@ jQuery('#pro_version').attr('checked', '$pro_version'.length > 0);
595
  jQuery('#enterprise_version').attr('checked', '$enterprise_version'.length > 0);
596
  jQuery('#new_window').attr('checked', '$new_window'.length > 0);
597
  jQuery('#show_in_primary_menu').attr('checked', '$show_in_primary_menu'.length > 0);
 
598
  jQuery('#analytics').attr('checked', '$analytics'.length > 0);
599
  jQuery('#load_jquery').attr('checked', '$load_jquery'.length > 0);
600
  jQuery('#add_new_line').attr('checked', '$add_new_line'.length > 0);
@@ -830,11 +862,11 @@ foreach($alt_flags as $flag)
830
  <td><input id="analytics" name="analytics" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/></td>
831
  </tr>
832
  <tr>
833
- <td class="option_name">* <?php _e('Sub-directory URL structure', 'gtranslate'); ?>:<br><small>http://example.com/<b>ru</b>/</small></td>
834
  <td><input id="pro_version" name="pro_version" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/> <a href="https://gtranslate.io/?xyz=998#pricing" target="_blank">* <?php _e('paid plans only', 'gtranslate'); ?></a></td>
835
  </tr>
836
  <tr>
837
- <td class="option_name">* <?php _e('Sub-domain URL structure', 'gtranslate'); ?>:<br><small>http://<b>es</b>.example.com/</small></td>
838
  <td><input id="enterprise_version" name="enterprise_version" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/> <a href="https://gtranslate.io/?xyz=998#pricing" target="_blank">* <?php _e('paid plans only', 'gtranslate'); ?></a></td>
839
  </tr>
840
  <tr id="new_window_option" style="display:none;">
@@ -843,7 +875,19 @@ foreach($alt_flags as $flag)
843
  </tr>
844
  <tr>
845
  <td class="option_name"><?php _e('Show in primary menu', 'gtranslate'); ?>:</td>
846
- <td><input id="show_in_primary_menu" name="show_in_primary_menu" value="1" type="checkbox"/></td>
 
 
 
 
 
 
 
 
 
 
 
 
847
  </tr>
848
 
849
  <!--tr>
@@ -917,9 +961,10 @@ foreach($alt_flags as $flag)
917
  <div class="postbox">
918
  <h3 id="settings"><?php _e('Widget code', 'gtranslate'); ?></h3>
919
  <div class="inside">
920
- <span style="color:red;"><?php _e('DO NOT COPY THIS INTO YOUR POSTS OR PAGES! Use [GTranslate] shortcode inside the post/page <br />or add a GTranslate widget into your sidebar from Appearance -> Widgets instead.', 'gtranslate'); ?></span><br /><br />
921
  <?php _e('You can edit this if you wish', 'gtranslate'); ?>:<br />
922
- <textarea id="widget_code" name="widget_code" onchange="ShowWidgetPreview(this.value)" style="font-family:Monospace;font-size:11px;height:150px;width:565px;"><?php echo $widget_code; ?></textarea>
 
 
923
  </div>
924
  </div>
925
  </div>
@@ -1038,6 +1083,7 @@ foreach($alt_flags as $flag)
1038
  $data['enterprise_version'] = isset($_POST['enterprise_version']) ? intval($_POST['enterprise_version']) : '';
1039
  $data['new_window'] = isset($_POST['new_window']) ? intval($_POST['new_window']) : '';
1040
  $data['show_in_primary_menu'] = isset($_POST['show_in_primary_menu']) ? intval($_POST['show_in_primary_menu']) : '';
 
1041
  $data['analytics'] = isset($_POST['analytics']) ? intval($_POST['analytics']) : '';
1042
  $data['load_jquery'] = isset($_POST['load_jquery']) ? intval($_POST['load_jquery']) : '';
1043
  $data['add_new_line'] = isset($_POST['add_new_line']) ? intval($_POST['add_new_line']) : '';
@@ -1061,6 +1107,7 @@ foreach($alt_flags as $flag)
1061
  $data['enterprise_version'] = isset($data['enterprise_version']) ? $data['enterprise_version'] : '';
1062
  $data['new_window'] = isset($data['new_window']) ? $data['new_window'] : '';
1063
  $data['show_in_primary_menu'] = isset($data['show_in_primary_menu']) ? $data['show_in_primary_menu'] : '';
 
1064
  $data['analytics'] = isset($data['analytics']) ? $data['analytics'] : '';
1065
  $data['load_jquery'] = isset($data['load_jquery']) ? $data['load_jquery'] : '1';
1066
  $data['add_new_line'] = isset($data['add_new_line']) ? $data['add_new_line'] : '1';
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.2
7
  Author: Edvard Ananyan
8
  Author URI: https://gtranslate.io
9
  Text Domain: gtranslate
56
  }
57
  }
58
 
59
+ if($data['floating_language_selector'] != 'no' and !$data['show_in_primary_menu'] and !is_admin()) {
60
+ add_action('wp_footer', 'gtranslate_display_floating');
61
+ function gtranslate_display_floating() {
62
+ $data = get_option('GTranslate');
63
+ GTranslate::load_defaults($data);
64
+
65
+ if($data['widget_look'] == 'dropdown_with_flags')
66
+ $vertical_location = '0';
67
+ else
68
+ $vertical_location = '5%';
69
+
70
+ switch($data['floating_language_selector']) {
71
+ case 'top_left': $html = '<div style="position:fixed;top:'.$vertical_location.';left:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
72
+ case 'top_right': $html = '<div style="position:fixed;top:'.$vertical_location.';right:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
73
+ case 'bottom_left': $html = '<div style="position:fixed;bottom:'.$vertical_location.';left:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
74
+ case 'bottom_right': $html = '<div style="position:fixed;bottom:'.$vertical_location.';right:8%;z-index:999999;">'.GTranslate::get_widget_code(false).'</div>'; break;
75
+ default: $html = ''; break;
76
+ }
77
+
78
+ echo $html;
79
+ }
80
+ }
81
+
82
  class GTranslate extends WP_Widget {
83
  public static function activate() {
84
  $data = array(
245
  var enterprise_version = jQuery('#enterprise_version:checked').length > 0 ? true : false;
246
  var new_window = jQuery('#new_window:checked').length > 0 ? true : false;
247
  var show_in_primary_menu = jQuery('#show_in_primary_menu:checked').length > 0 ? true : false;
248
+ var floating_language_selector = jQuery('#floating_language_selector').val();
249
  var analytics = jQuery('#analytics:checked').length > 0 ? true : false;
250
 
251
  if(pro_version || enterprise_version) {
288
  jQuery('#flag_size_option').show();
289
  }
290
 
291
+ if(show_in_primary_menu) {
292
+ jQuery('#floating_option').hide();
293
+ } else {
294
+ jQuery('#floating_option').show();
295
+ }
296
+
297
  if(pro_version && enterprise_version)
298
  pro_version = false;
299
 
437
  x = centerPosition.left + Math.cos(angle) * r;
438
  y = centerPosition.top + Math.sin(angle) * r;
439
 
440
+ var positionGSatelites = ($('.gsatelites').parent().css('position') == 'fixed' ? $('.gsatelites').parent().position() : $('.gsatelites').offset()),
441
  vpHeight = $(window).height(),
442
  vpWidth = $(window).width(),
443
  tpViz = positionGSatelites.top + y >= 0 && positionGSatelites.top + y < vpHeight,
522
 
523
  // Adding slider javascript
524
  widget_preview += '<script type="text/javascript">'+new_line;
525
+ 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;
526
+ 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;
527
  widget_preview += '<\/script>'+new_line;
528
 
529
  // Adding slider css
535
  widget_preview += '.switcher a span.gflag {margin-right:3px;padding:0;display:block;float:left;}'+new_line;
536
  widget_preview += '.switcher .selected {background:#FFFFFF url($wp_plugin_url/switcher.png) repeat-x;position:relative;z-index:9999;}'+new_line;
537
  widget_preview += '.switcher .selected a {border:1px solid #CCCCCC;background:url($wp_plugin_url/arrow_down.png) 146px center no-repeat;color:#666666;padding:3px 5px;width:151px;}'+new_line;
538
+ widget_preview += '.switcher .selected a.open {background-image:url($wp_plugin_url/arrow_up.png)}'+new_line;
539
  widget_preview += '.switcher .selected a:hover {background:#F0F0F0 url($wp_plugin_url/arrow_down.png) 146px center no-repeat;}'+new_line;
540
  widget_preview += '.switcher .option {position:relative;z-index:9998;border-left:1px solid #CCCCCC;border-right:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC;background-color:#EEEEEE;display:none;width:161px;max-height:198px;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;overflow-y:auto;overflow-x:hidden;}'+new_line;
541
  widget_preview += '.switcher .option a {color:#000;padding:3px 5px;}'+new_line;
626
  jQuery('#enterprise_version').attr('checked', '$enterprise_version'.length > 0);
627
  jQuery('#new_window').attr('checked', '$new_window'.length > 0);
628
  jQuery('#show_in_primary_menu').attr('checked', '$show_in_primary_menu'.length > 0);
629
+ jQuery('#floating_language_selector').val('$floating_language_selector');
630
  jQuery('#analytics').attr('checked', '$analytics'.length > 0);
631
  jQuery('#load_jquery').attr('checked', '$load_jquery'.length > 0);
632
  jQuery('#add_new_line').attr('checked', '$add_new_line'.length > 0);
862
  <td><input id="analytics" name="analytics" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/></td>
863
  </tr>
864
  <tr>
865
+ <td class="option_name">* <?php _e('Sub-directory URL structure', 'gtranslate'); ?>:<br><code><small>http://example.com/<b>ru</b>/</small></code></td>
866
  <td><input id="pro_version" name="pro_version" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/> <a href="https://gtranslate.io/?xyz=998#pricing" target="_blank">* <?php _e('paid plans only', 'gtranslate'); ?></a></td>
867
  </tr>
868
  <tr>
869
+ <td class="option_name">* <?php _e('Sub-domain URL structure', 'gtranslate'); ?>:<br><code><small>http://<b>es</b>.example.com/</small></code></td>
870
  <td><input id="enterprise_version" name="enterprise_version" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/> <a href="https://gtranslate.io/?xyz=998#pricing" target="_blank">* <?php _e('paid plans only', 'gtranslate'); ?></a></td>
871
  </tr>
872
  <tr id="new_window_option" style="display:none;">
875
  </tr>
876
  <tr>
877
  <td class="option_name"><?php _e('Show in primary menu', 'gtranslate'); ?>:</td>
878
+ <td><input id="show_in_primary_menu" name="show_in_primary_menu" value="1" type="checkbox" onclick="RefreshDoWidgetCode()" onchange="RefreshDoWidgetCode()"/></td>
879
+ </tr>
880
+ <tr id="floating_option">
881
+ <td class="option_name"><?php _e('Show floating language selector', 'gtranslate'); ?>:</td>
882
+ <td>
883
+ <select id="floating_language_selector" name="floating_language_selector">
884
+ <option value="no"><?php _e('No', 'gtranslate'); ?></option>
885
+ <option value="top_left"><?php _e('Top left', 'gtranslate'); ?></option>
886
+ <option value="top_right"><?php _e('Top right', 'gtranslate'); ?></option>
887
+ <option value="bottom_left"><?php _e('Bottom left', 'gtranslate'); ?></option>
888
+ <option value="bottom_right"><?php _e('Bottom right', 'gtranslate'); ?></option>
889
+ </select>
890
+ </td>
891
  </tr>
892
 
893
  <!--tr>
961
  <div class="postbox">
962
  <h3 id="settings"><?php _e('Widget code', 'gtranslate'); ?></h3>
963
  <div class="inside">
 
964
  <?php _e('You can edit this if you wish', 'gtranslate'); ?>:<br />
965
+ <textarea id="widget_code" name="widget_code" onchange="ShowWidgetPreview(this.value)" style="font-family:Monospace;font-size:11px;height:150px;width:565px;"><?php echo $widget_code; ?></textarea><br />
966
+ <span style="color:red;"><?php _e('DO NOT COPY THIS INTO YOUR POSTS OR PAGES! Use [GTranslate] shortcode inside the post/page <br />or add a GTranslate widget into your sidebar from Appearance -> Widgets instead.', 'gtranslate'); ?></span><br /><br />
967
+ <?php _e('You can also use <code>&lt;?php echo do_shortcode(\'[gtranslate]\'); ?&gt;</code> in your template header/footer files.', 'gtranslate'); ?>
968
  </div>
969
  </div>
970
  </div>
1083
  $data['enterprise_version'] = isset($_POST['enterprise_version']) ? intval($_POST['enterprise_version']) : '';
1084
  $data['new_window'] = isset($_POST['new_window']) ? intval($_POST['new_window']) : '';
1085
  $data['show_in_primary_menu'] = isset($_POST['show_in_primary_menu']) ? intval($_POST['show_in_primary_menu']) : '';
1086
+ $data['floating_language_selector'] = isset($_POST['floating_language_selector']) ? sanitize_text_field($_POST['floating_language_selector']) : 'no';
1087
  $data['analytics'] = isset($_POST['analytics']) ? intval($_POST['analytics']) : '';
1088
  $data['load_jquery'] = isset($_POST['load_jquery']) ? intval($_POST['load_jquery']) : '';
1089
  $data['add_new_line'] = isset($_POST['add_new_line']) ? intval($_POST['add_new_line']) : '';
1107
  $data['enterprise_version'] = isset($data['enterprise_version']) ? $data['enterprise_version'] : '';
1108
  $data['new_window'] = isset($data['new_window']) ? $data['new_window'] : '';
1109
  $data['show_in_primary_menu'] = isset($data['show_in_primary_menu']) ? $data['show_in_primary_menu'] : '';
1110
+ $data['floating_language_selector'] = isset($data['floating_language_selector']) ? $data['floating_language_selector'] : 'no';
1111
  $data['analytics'] = isset($data['analytics']) ? $data['analytics'] : '';
1112
  $data['load_jquery'] = isset($data['load_jquery']) ? $data['load_jquery'] : '1';
1113
  $data['add_new_line'] = isset($data['add_new_line']) ? $data['add_new_line'] : '1';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Author: Edvard Ananyan
4
  Tags: translation proxy, localization, translate, translation, localization, google translate, language, multilingual, multilanguage, bilingual, tradurre, traducir, traduire, traduzione, ubersetzung, mehrsprachig, oversette, oversatta, vertaling, vertaler, meertalig, polylang, qtranslate, transposh
5
  Requires at least: 2.8
6
  Tested up to: 4.7
7
- Stable tag: 2.8.1
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
@@ -33,7 +33,7 @@ Please check our [FAQ](https://gtranslate.io/?xyz=998#faq) to get quick answers.
33
  * Google language translator widget
34
  * Available styles Dropdown/Flags/Flags with dropdown/Nice dropdown with flags
35
  * Valid XHTML
36
- * Alternative for WPML, qtranslate, transposh and polylang
37
  * (paid) You can manually correct translations
38
  * (paid) You can have sub-directory (example.com/**es**/) or sub-domain (**es.**example.com) URL structure
39
  * (paid) URL Translation is possible (example.com/about-us -> example.es/sobre-nosotros)
@@ -49,7 +49,7 @@ Please check our [FAQ](https://gtranslate.io/?xyz=998#faq) to get quick answers.
49
  **Edit Translations Demo (paid)**
50
  [youtube https://www.youtube.com/watch?v=YwSy3VtQx3I]
51
 
52
- Keywords: polylang, prisna, gts, localize, lingotek, smartling, qtranslate, loco translate, google website translator, translate wordpress, translate, transposh, global translator, machine translate, wp translate
53
 
54
  == Installation ==
55
 
@@ -409,6 +409,9 @@ You need to go to the language you want to edit, for instance, French: http://do
409
 
410
  == Changelog ==
411
 
 
 
 
412
  = 2.8.1 =
413
  * New Globe widget look added
414
  * Plugin localization added
4
  Tags: translation proxy, localization, translate, translation, localization, google translate, language, multilingual, multilanguage, bilingual, tradurre, traducir, traduire, traduzione, ubersetzung, mehrsprachig, oversette, oversatta, vertaling, vertaler, meertalig, polylang, qtranslate, transposh
5
  Requires at least: 2.8
6
  Tested up to: 4.7
7
+ Stable tag: 2.8.2
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
33
  * Google language translator widget
34
  * Available styles Dropdown/Flags/Flags with dropdown/Nice dropdown with flags
35
  * Valid XHTML
36
+ * Alternative for WPML, qtranslate, transposh, loco translate and polylang
37
  * (paid) You can manually correct translations
38
  * (paid) You can have sub-directory (example.com/**es**/) or sub-domain (**es.**example.com) URL structure
39
  * (paid) URL Translation is possible (example.com/about-us -> example.es/sobre-nosotros)
49
  **Edit Translations Demo (paid)**
50
  [youtube https://www.youtube.com/watch?v=YwSy3VtQx3I]
51
 
52
+ Keywords: polylang, prisna, gts, localize, lingotek, smartling, qtranslate, loco translate, loco, google website translator, translate wordpress, translate, transposh, global translator, machine translate, wp translate
53
 
54
  == Installation ==
55
 
409
 
410
  == Changelog ==
411
 
412
+ = 2.8.2 =
413
+ * Floating language selector option added: Top left, Top right, Bottom left, Bottom right
414
+
415
  = 2.8.1 =
416
  * New Globe widget look added
417
  * Plugin localization added