Google Language Translator - Version 2.6

Version Description

Download this release

Release Info

Developer rm2773
Plugin Icon wp plugin Google Language Translator
Version 2.6
Comparing to
See all releases

Code changes from version 2.5 to 2.6

Files changed (2) hide show
  1. google-language-translator.php +80 -7
  2. readme.txt +6 -1
google-language-translator.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Google Language Translator
4
  Plugin URI: http://www.studio88design.com/plugins/google-language-translator
5
- Version: 2.5
6
  Description: The MOST SIMPLE Google Translator plugin. This plugin adds Google Translator to your website by using a single shortcode, [google-translator]. Settings include: layout style, hide/show specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
7
  Author: Rob Myrick
8
  Author URI: http://www.studio88design.com/
@@ -114,7 +114,7 @@ function page_cb() { ?>
114
  </tr>
115
 
116
  <tr class="notranslate">
117
- <td class="choose_flags_intro">Show flag images?<br/>(Display up to 7 flags above the translator)</td>
118
  <td class="choose_flags_intro"><?php googlelanguagetranslator_flags_cb(); ?></td>
119
  </tr>
120
 
@@ -259,12 +259,26 @@ function initialize_settings() {
259
  register_setting( 'google_language_translator','googlelanguagetranslator_flags_alignment');
260
 
261
  function googlelanguagetranslator_active_cb() {
 
 
 
 
 
 
 
262
  $options = get_option( 'googlelanguagetranslator_active');
 
263
  $html = '<input type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" '.checked(1,$options,false).'/> &nbsp; Activate Google Language Translator?';
264
  echo $html;
265
  }
266
 
267
  function googlelanguagetranslator_language_cb() {
 
 
 
 
 
 
268
  $options = get_option( 'googlelanguagetranslator_language' ); ?>
269
  <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
270
  <option value="af" <?php if($options=='af'){echo "selected";}?>>Afrikaans</option>
@@ -344,7 +358,14 @@ function initialize_settings() {
344
  }
345
 
346
  function googlelanguagetranslator_language_option_cb() {
347
- $options = get_option('googlelanguagetranslator_language_option','all'); ?>
 
 
 
 
 
 
 
348
  <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="all" <?php if($options=='all'){echo "checked";}?>/> All Languages<br/>
349
  <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="specific" <?php if($options=='specific'){echo "checked";}?>/> Specific Languages
350
  <?php }
@@ -352,6 +373,16 @@ function initialize_settings() {
352
 
353
 
354
  function language_display_settings_cb() {
 
 
 
 
 
 
 
 
 
 
355
  $get_language_choices = get_option ('language_display_settings'); ?>
356
  <div class="languages" style="width:25%; float:left">
357
  <div><input type="checkbox" name="language_display_settings[af]" value="1"<?php if ( 1 == $get_language_choices['af'] ) echo 'checked="checked"'; ?> /> Afrikaans</div>
@@ -441,7 +472,16 @@ function initialize_settings() {
441
  <?php }
442
 
443
  function googlelanguagetranslator_flags_cb() {
 
 
 
 
 
 
 
 
444
  $options = get_option('googlelanguagetranslator_flags','hide_flags'); ?>
 
445
  <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="show_flags" <?php if($options=='show_flags'){echo "checked";}?>/> Yes, show flag images<br/>
446
  <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="hide_flags" <?php if($options=='hide_flags'){echo "checked";}?>/> No, hide flag images
447
  <?php }
@@ -451,11 +491,15 @@ function initialize_settings() {
451
  $defaults = array(
452
  'flag-en' => 1
453
  );
454
- add_option('flag_display_settings', $defaults);
455
 
456
- $get_flag_choices = get_option('flag_display_settings');
 
 
 
 
457
 
458
- //$get_flag_choices = get_option ('flag_display_settings',array('flag-en' => 1));
459
 
460
  if (!isset ( $get_flag_choices ['flag-af'] ) ) {
461
  $get_flag_choices['flag-af'] = 0;
@@ -838,6 +882,12 @@ function initialize_settings() {
838
  <?php }
839
 
840
  function googlelanguagetranslator_translatebox_cb() {
 
 
 
 
 
 
841
  $options = get_option('googlelanguagetranslator_translatebox'); ?>
842
 
843
  <select name="googlelanguagetranslator_translatebox" id="googlelanguagetranslator_translatebox" style="width:170px">
@@ -847,6 +897,12 @@ function initialize_settings() {
847
  <?php }
848
 
849
  function googlelanguagetranslator_display_cb() {
 
 
 
 
 
 
850
  $options = get_option('googlelanguagetranslator_display'); ?>
851
  <select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:170px;">
852
  <option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
@@ -855,6 +911,12 @@ function initialize_settings() {
855
  <?php }
856
 
857
  function googlelanguagetranslator_toolbar_cb() {
 
 
 
 
 
 
858
  $options = get_option('googlelanguagetranslator_toolbar'); ?>
859
  <select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:170px;">
860
  <option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
@@ -863,6 +925,12 @@ function initialize_settings() {
863
  <?php }
864
 
865
  function googlelanguagetranslator_showbranding_cb() {
 
 
 
 
 
 
866
  $options = get_option('googlelanguagetranslator_showbranding'); ?>
867
  <select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:170px;">
868
  <option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
@@ -871,7 +939,12 @@ function initialize_settings() {
871
  <?php }
872
 
873
  function googlelanguagetranslator_flags_alignment_cb() {
874
-
 
 
 
 
 
875
 
876
 
877
  $options = get_option('googlelanguagetranslator_flags_alignment','flags_left');
2
  /*
3
  Plugin Name: Google Language Translator
4
  Plugin URI: http://www.studio88design.com/plugins/google-language-translator
5
+ Version: 2.6
6
  Description: The MOST SIMPLE Google Translator plugin. This plugin adds Google Translator to your website by using a single shortcode, [google-translator]. Settings include: layout style, hide/show specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
7
  Author: Rob Myrick
8
  Author URI: http://www.studio88design.com/
114
  </tr>
115
 
116
  <tr class="notranslate">
117
+ <td class="choose_flags_intro">Show flag images?<br/>(Display up to 70 flags above the translator)</td>
118
  <td class="choose_flags_intro"><?php googlelanguagetranslator_flags_cb(); ?></td>
119
  </tr>
120
 
259
  register_setting( 'google_language_translator','googlelanguagetranslator_flags_alignment');
260
 
261
  function googlelanguagetranslator_active_cb() {
262
+ add_option ('googlelanguagetranslator_active',1);
263
+
264
+ if ( get_option( 'googlelanguagetranslator_active' ) !== false ) {
265
+ // The option already exists, so we just update it.
266
+ update_option( 'googlelanguagetranslator_active', 1);
267
+ }
268
+
269
  $options = get_option( 'googlelanguagetranslator_active');
270
+
271
  $html = '<input type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" '.checked(1,$options,false).'/> &nbsp; Activate Google Language Translator?';
272
  echo $html;
273
  }
274
 
275
  function googlelanguagetranslator_language_cb() {
276
+ add_option ('googlelanguagetranslator_language','en');
277
+
278
+ if ( get_option( 'googlelanguagetranslator_language' ) == false ) {
279
+ // The option already exists, so we just update it.
280
+ update_option( 'googlelanguagetranslator_language','en');
281
+ }
282
  $options = get_option( 'googlelanguagetranslator_language' ); ?>
283
  <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
284
  <option value="af" <?php if($options=='af'){echo "selected";}?>>Afrikaans</option>
358
  }
359
 
360
  function googlelanguagetranslator_language_option_cb() {
361
+ add_option ('googlelanguagetranslator_language_option','all');
362
+
363
+ if ( get_option( 'googlelanguagetranslator_language_option' ) == false ) {
364
+ // The option already exists, so we just update it.
365
+ update_option( 'googlelanguagetranslator_flags', 'all' );
366
+ }
367
+ $options = get_option('googlelanguagetranslator_language_option'); ?>
368
+
369
  <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="all" <?php if($options=='all'){echo "checked";}?>/> All Languages<br/>
370
  <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="specific" <?php if($options=='specific'){echo "checked";}?>/> Specific Languages
371
  <?php }
373
 
374
 
375
  function language_display_settings_cb() {
376
+ $defaults = array (
377
+ 'en' => 1
378
+ );
379
+ add_option ('language_display_settings',$defaults);
380
+
381
+ if ( get_option( 'language_display_settings' ) == false ) {
382
+ // The option already exists, so we just update it.
383
+ update_option( 'language_display_settings', $defaults );
384
+ }
385
+
386
  $get_language_choices = get_option ('language_display_settings'); ?>
387
  <div class="languages" style="width:25%; float:left">
388
  <div><input type="checkbox" name="language_display_settings[af]" value="1"<?php if ( 1 == $get_language_choices['af'] ) echo 'checked="checked"'; ?> /> Afrikaans</div>
472
  <?php }
473
 
474
  function googlelanguagetranslator_flags_cb() {
475
+
476
+ add_option ('googlelanguagetranslator_flags','hide_flags');
477
+
478
+ if ( get_option( 'googlelanguagetranslator_flags' ) == false ) {
479
+ // The option already exists, so we just update it.
480
+ update_option( 'googlelanguagetranslator_flags', 'hide_flags' );
481
+ }
482
+
483
  $options = get_option('googlelanguagetranslator_flags','hide_flags'); ?>
484
+
485
  <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="show_flags" <?php if($options=='show_flags'){echo "checked";}?>/> Yes, show flag images<br/>
486
  <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="hide_flags" <?php if($options=='hide_flags'){echo "checked";}?>/> No, hide flag images
487
  <?php }
491
  $defaults = array(
492
  'flag-en' => 1
493
  );
494
+ add_option ('flag_display_settings', $defaults);
495
 
496
+
497
+ if ( get_option( 'flag_display_settings' ) == false ) {
498
+ // The option already exists, so we just update it.
499
+ update_option( 'flag_display_settings', $defaults );
500
+ }
501
 
502
+ $get_flag_choices = get_option('flag_display_settings');
503
 
504
  if (!isset ( $get_flag_choices ['flag-af'] ) ) {
505
  $get_flag_choices['flag-af'] = 0;
882
  <?php }
883
 
884
  function googlelanguagetranslator_translatebox_cb() {
885
+ add_option ('googlelanguagetranslator_translatebox','yes');
886
+
887
+ if ( get_option( 'googlelanguagetranslator_translatebox' ) == false ) {
888
+ // The option already exists, so we just update it.
889
+ update_option( 'googlelanguagetranslator_translatebox', 'yes' );
890
+ }
891
  $options = get_option('googlelanguagetranslator_translatebox'); ?>
892
 
893
  <select name="googlelanguagetranslator_translatebox" id="googlelanguagetranslator_translatebox" style="width:170px">
897
  <?php }
898
 
899
  function googlelanguagetranslator_display_cb() {
900
+ add_option ('googlelanguagetranslator_display','Vertical');
901
+
902
+ if ( get_option( 'googlelanguagetranslator_display' ) == false ) {
903
+ // The option already exists, so we just update it.
904
+ update_option( 'googlelanguagetranslator_display', 'Vertical' );
905
+ }
906
  $options = get_option('googlelanguagetranslator_display'); ?>
907
  <select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:170px;">
908
  <option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
911
  <?php }
912
 
913
  function googlelanguagetranslator_toolbar_cb() {
914
+ add_option ('googlelanguagetranslator_toolbar','Yes');
915
+
916
+ if ( get_option( 'googlelanguagetranslator_toolbar' ) == false ) {
917
+ // The option already exists, so we just update it.
918
+ update_option( 'googlelanguagetranslator_toolbar', 'Yes' );
919
+ }
920
  $options = get_option('googlelanguagetranslator_toolbar'); ?>
921
  <select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:170px;">
922
  <option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
925
  <?php }
926
 
927
  function googlelanguagetranslator_showbranding_cb() {
928
+ add_option ('googlelanguagetranslator_showbranding','Yes');
929
+
930
+ if ( get_option( 'googlelanguagetranslator_showbranding' ) == false ) {
931
+ // The option already exists, so we just update it.
932
+ update_option( 'googlelanguagetranslator_showbranding', 'Yes' );
933
+ }
934
  $options = get_option('googlelanguagetranslator_showbranding'); ?>
935
  <select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:170px;">
936
  <option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
939
  <?php }
940
 
941
  function googlelanguagetranslator_flags_alignment_cb() {
942
+ add_option ('googlelanguagetranslator_flags_alignment','flags_left');
943
+
944
+ if ( get_option( 'googlelanguagetranslator_flags_alignment' ) == false ) {
945
+ // The option already exists, so we just update it.
946
+ update_option( 'googlelanguagetranslator_flags_alignment', 'flags_left' );
947
+ }
948
 
949
 
950
  $options = get_option('googlelanguagetranslator_flags_alignment','flags_left');
readme.txt CHANGED
@@ -5,7 +5,7 @@ Plugin link: http://www.studio88design.com/plugins/google-language-translator
5
  Tags: language translator, google translator, language translate, google, google language translator, translation, translate, multi language
6
  Requires at least: 2.9
7
  Tested up to: 3.6
8
- stable tag: 2.5
9
 
10
  Welcome to Google Language Tranlator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
11
 
@@ -96,6 +96,11 @@ Settings include: inline or vertical layout, show/hide specific languages, hide/
96
 
97
  - Added a default option for the Translator alingment. Previously, this was causing the plugin to disapppear.
98
 
 
 
 
 
 
99
  == Screenshots ==
100
 
101
  1. Settings include: inline or vertical layout, hide/show Google toolbar, display specific languages, and show/hide Google branding. Add the shortcode to pages, posts, and widgets.
5
  Tags: language translator, google translator, language translate, google, google language translator, translation, translate, multi language
6
  Requires at least: 2.9
7
  Tested up to: 3.6
8
+ stable tag: 2.6
9
 
10
  Welcome to Google Language Tranlator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
11
 
96
 
97
  - Added a default option for the Translator alingment. Previously, this was causing the plugin to disapppear.
98
 
99
+ 2.6
100
+
101
+ - Added defaults to all options to ensure there are no more issues with the translator displaying upon installation. Again, sorry for any inconvenience.
102
+
103
+
104
  == Screenshots ==
105
 
106
  1. Settings include: inline or vertical layout, hide/show Google toolbar, display specific languages, and show/hide Google branding. Add the shortcode to pages, posts, and widgets.