Google Language Translator - Version 4.0.4

Version Description

Download this release

Release Info

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

Code changes from version 4.0.3 to 4.0.4

Files changed (5) hide show
  1. css/style.css +29 -14
  2. google-language-translator.php +287 -948
  3. js/admin.js +1 -0
  4. readme.txt +8 -1
  5. widget.php +39 -51
css/style.css CHANGED
@@ -9,7 +9,8 @@ select.goog-te-combo {
9
  border:1px solid lightgray !important;
10
  border-radius:0px !important;
11
  -webkit-border-radius:0px;
12
- -moz-border-radius:0px !important;
 
13
  }
14
 
15
  #flags ul {
@@ -17,11 +18,17 @@ select.goog-te-combo {
17
  }
18
 
19
  #flags li {
20
- float:left;
21
- margin-bottom:0;
22
- padding:0;
23
- border:none;
24
- list-style:none;
 
 
 
 
 
 
25
  }
26
 
27
  #flags a {
@@ -72,20 +79,20 @@ p.hello {
72
  }
73
 
74
  .flag{
75
- font-size:16px;
76
- padding:1px 0;
77
  }
78
 
79
- .flag img,.alt_flag img{
80
- border:0px !important;
81
- margin-top:2px !important;
 
82
  padding:0px !important;
83
  }
84
 
85
  .attribution {
86
  width:152px;
87
- line-height:1em;
88
- margin-top:4px;
89
  }
90
 
91
  span.goog-branding {
@@ -135,7 +142,7 @@ span.vertical-translator {
135
 
136
  .tool-items .flag img {
137
  width:24px !important;
138
- height:24px !important;
139
  margin-top:1px !important;
140
  }
141
 
@@ -145,4 +152,12 @@ span.vertical-translator {
145
 
146
  .tool-container {
147
  line-height:1;
 
 
 
 
 
 
 
 
148
  }
9
  border:1px solid lightgray !important;
10
  border-radius:0px !important;
11
  -webkit-border-radius:0px;
12
+ -moz-border-radius:0px !important;
13
+ -o-border-radius:0px !important;
14
  }
15
 
16
  #flags ul {
18
  }
19
 
20
  #flags li {
21
+ float:left !important;
22
+ margin-bottom:0 !important;
23
+ padding:0 !important;
24
+ border:none !important;
25
+ list-style:none !important;
26
+ content:none !important;
27
+ }
28
+
29
+ #flags li:before {
30
+ content:none !important;
31
+ border:none !important;
32
  }
33
 
34
  #flags a {
79
  }
80
 
81
  .flag{
82
+ padding:1px 0;
 
83
  }
84
 
85
+ .flag img,
86
+ .alt_flag img{
87
+ border:0px !important;
88
+ margin-top:2px !important;
89
  padding:0px !important;
90
  }
91
 
92
  .attribution {
93
  width:152px;
94
+ line-height:1em;
95
+ margin-top:4px;
96
  }
97
 
98
  span.goog-branding {
142
 
143
  .tool-items .flag img {
144
  width:24px !important;
145
+ height:24px !important;
146
  margin-top:1px !important;
147
  }
148
 
152
 
153
  .tool-container {
154
  line-height:1;
155
+ }
156
+
157
+ #footer-instance {
158
+ display:none !important;
159
+ }
160
+
161
+ code {
162
+ border:1px solid lightgray;
163
  }
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: 4.0.3
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/
@@ -12,143 +12,69 @@ include( plugin_dir_path( __FILE__ ) . 'widget.php');
12
 
13
  class google_language_translator {
14
 
15
- public $languages_array = array(
16
- 'af' => 'Afrikaans',
17
- 'sq' => 'Albanian',
18
- 'ar' => 'Arabic',
19
- 'hy' => 'Armenian',
20
- 'az' => 'Azerbaijani',
21
- 'eu' => 'Basque',
22
- 'be' => 'Belarusian',
23
- 'bn' => 'Bengali',
24
- 'bs' => 'Bosnian',
25
- 'bg' => 'Bulgarian',
26
- 'ca' => 'Catalan',
27
- 'ceb' => 'Cebuano',
28
- 'zh-CN' => 'Chinese(Simplified)',
29
- 'zh-TW' => 'Chinese(Traditional)',
30
- 'hr' => 'Croatian',
31
- 'cs' => 'Czech',
32
- 'da' => 'Danish',
33
- 'nl' => 'Dutch',
34
- 'en' => 'English',
35
- 'eo' => 'Esperanto',
36
- 'et' => 'Estonian',
37
- 'tl' => 'Filipino',
38
- 'fi' => 'Finnish',
39
- 'fr' => 'French',
40
- 'gl' => 'Galician',
41
- 'ka' => 'Georgian',
42
- 'de' => 'German',
43
- 'el' => 'Greek',
44
- 'gu' => 'Gujarati',
45
- 'ht' => 'Haitian',
46
- 'ha' => 'Hausa',
47
- 'iw' => 'Hebrew',
48
- 'hi' => 'Hindi',
49
- 'hmn' => 'Hmong',
50
- 'hu' => 'Hungarian',
51
- 'is' => 'Icelandic',
52
- 'ig' => 'Igbo',
53
- 'id' => 'Indonesian',
54
- 'ga' => 'Irish',
55
- 'it' => 'Italian',
56
- 'ja' => 'Japanese',
57
- 'jw' => 'Javanese',
58
- 'kn' => 'Kannada',
59
- 'km' => 'Khmer',
60
- 'ko' => 'Korean',
61
- 'lo' => 'Lao',
62
- 'la' => 'Latin',
63
- 'lv' => 'Latvian',
64
- 'lt' => 'Lithuanian',
65
- 'mk' => 'Macedonian',
66
- 'ms' => 'Malay',
67
- 'mt' => 'Maltese',
68
- 'mi' => 'Maori',
69
- 'mr' => 'Marathi',
70
- 'mn' => 'Mongolian',
71
- 'ne' => 'Nepali',
72
- 'no' => 'Norwegian',
73
- 'fa' => 'Persian',
74
- 'pl' => 'Polish',
75
- 'pt' => 'Portuguese',
76
- 'pa' => 'Punjabi',
77
- 'ro' => 'Romanian',
78
- 'ru' => 'Russian',
79
- 'sr' => 'Serbian',
80
- 'sk' => 'Slovak',
81
- 'sl' => 'Slovenian',
82
- 'so' => 'Somali',
83
- 'es' => 'Spanish',
84
- 'sw' => 'Swahili',
85
- 'sv' => 'Swedish',
86
- 'ta' => 'Tamil',
87
- 'te' => 'Telugu',
88
- 'th' => 'Thai',
89
- 'tr' => 'Turkish',
90
- 'uk' => 'Ukranian',
91
- 'ur' => 'Urdu',
92
- 'vi' => 'Vietnamese',
93
- 'cy' => 'Welsh',
94
- 'yi' => 'Yiddish',
95
- 'yo' => 'Yoruba',
96
- 'zu' => 'Zulu'
97
- );
98
 
99
  public function __construct(){
100
  register_activation_hook( __FILE__, array( &$this, 'glt_activate' ));
101
- register_deactivation_hook( __FILE__, array( &$this, 'glt_deactivate' ));
102
- add_action( 'admin_menu', array( &$this, 'add_my_admin_menus'));
103
  add_action('admin_init',array(&$this, 'initialize_settings'));
104
- add_action('wp_head',array(&$this, 'load_css'));
 
105
  add_shortcode( 'google-translator',array(&$this, 'google_translator_shortcode'));
 
106
  add_filter('widget_text','do_shortcode');
107
-
 
108
  if (!is_admin()) {
109
  add_action('init',array(&$this, 'flags'));
110
  }
111
  }
112
 
113
  public function glt_activate() {
114
- update_option('googlelanguagetranslator_active', 1);
115
- update_option('googlelanguagetranslator_language','en');
116
- update_option('googlelanguagetranslator_language_option','all');
117
- update_option('language_display_settings',array ('en' => 1));
118
- update_option('googlelanguagetranslator_flags','show_flags');
119
- update_option('flag_display_settings',array ('flag-en' => 1));
120
- update_option('googlelanguagetranslator_translatebox','yes');
121
- update_option('googlelanguagetranslator_display','Vertical');
122
- update_option('googlelanguagetranslator_toolbar','Yes');
123
- update_option('googlelanguagetranslator_showbranding','Yes');
124
- update_option('googlelanguagetranslator_flags_alignment','flags_left');
125
- update_option('googlelanguagetranslator_analytics',1);
126
- update_option('googlelanguagetranslator_manage_translations',0);
127
- update_option('googlelanguagetranslator_multilanguage',0);
128
- update_option('googlelanguagetranslator_floating_widget','yes');
129
- update_option('googlelanguagetranslator_flag_size','18');
 
 
 
130
  }
131
 
132
  public function glt_deactivate() {
133
- delete_option('googlelanguagetranslator_active');
134
- delete_option('googlelanguagetranslator_language');
135
- delete_option('googlelanguagetranslator_language_option');
136
- delete_option('language_display_settings');
137
- delete_option('googlelanguagetranslator_flags');
138
- delete_option('flag_display_settings');
139
- delete_option('googlelanguagetranslator_translatebox');
140
- delete_option('googlelanguagetranslator_display');
141
- delete_option('googlelanguagetranslator_toolbar');
142
- delete_option('googlelanguagetranslator_showbranding');
143
- delete_option('googlelanguagetranslator_flags_alignment');
144
- delete_option('googlelanguagetranslator_analytics');
145
- delete_option('googlelanguagetranslator_manage_translations');
146
- delete_option('googlelanguagetranslator_multilanguage');
147
- delete_option('googlelanguagetranslator_floating_widget');
148
- delete_option('googlelanguagetranslator_flag_size');
149
- delete_option('googlelanguagetranslator_flags_order');
150
- delete_option('googlelanguagetranslator_disable_mootools');
151
- delete_option('googlelanguagetranslator_disable_modal');
152
  }
153
 
154
  public function add_my_admin_menus(){
@@ -159,25 +85,26 @@ class google_language_translator {
159
 
160
  public function load_admin_js(){
161
  add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_admin_js' ));
 
162
  }
163
 
164
  public function enqueue_admin_js(){
165
- wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
166
- wp_enqueue_script( 'my-flag-script', plugins_url('js/flags.js',__FILE__), array('jquery'));
167
 
168
  if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
169
  wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
170
  wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
171
- wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
172
- wp_enqueue_style( 'toolbar.css' );
173
  }
174
 
175
- wp_enqueue_script( 'jquery-ui.js', plugins_url('js/jquery-ui.js',__FILE__), array('jquery'));
176
- wp_enqueue_script( 'jquery-ui-sortable.js', plugins_url('js/jquery-ui-sortable.js',__FILE__), array('jquery'));
177
- wp_enqueue_script( 'jquery-ui-widget.js', plugins_url('js/jquery-ui-widget.js',__FILE__), array('jquery'));
178
- wp_enqueue_script( 'jquery-ui-mouse.js', plugins_url('js/jquery-ui-mouse.js',__FILE__), array('jquery'));
179
- wp_enqueue_script( 'load_sortable_flags', plugins_url('js/load-sortable-flags.js',__FILE__), array('jquery'));
180
- wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
181
  wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
182
  wp_enqueue_style( 'style.css' );
183
  wp_enqueue_style( 'jquery-ui.css' );
@@ -186,35 +113,33 @@ class google_language_translator {
186
  public function flags() {
187
  wp_enqueue_script( 'flags', plugins_url('js/flags.js',__FILE__), array('jquery'));
188
 
189
- if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
190
- wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
191
- wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
192
- wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
193
- wp_enqueue_style( 'toolbar.css' );
194
- }
195
 
196
  wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
197
  wp_enqueue_style( 'style.css' );
198
  }
199
 
200
  public function load_css() {
201
- include( plugin_dir_path( __FILE__ ) . '/css/style.php');
202
  }
203
 
204
  public function google_translator_shortcode() {
205
  if (get_option('googlelanguagetranslator_display')=='Vertical'){
206
- return $this->googlelanguagetranslator_vertical();
207
  }
208
-
209
  elseif(get_option('googlelanguagetranslator_display')=='Horizontal'){
210
- return $this->googlelanguagetranslator_horizontal();
211
  }
212
  }
213
 
214
  public function googlelanguagetranslator_included_languages() {
215
  if ( get_option('googlelanguagetranslator_language_option')=='specific') {
216
- $get_language_choices = get_option ('language_display_settings');
217
-
218
  foreach ($get_language_choices as $key=>$value) {
219
  if($value == 1) {
220
  $items[] = $key;
@@ -229,7 +154,7 @@ class google_language_translator {
229
  } elseif ( get_option('googlelanguagetranslator_display') == 'Horizontal') {
230
  $lang = ', includedLanguages:\''.$comma_separated.'\'';
231
  return $lang;
232
- }
233
  }
234
  }
235
 
@@ -240,6 +165,50 @@ class google_language_translator {
240
  return ', '.$analytics;
241
  }
242
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
 
244
  public function googlelanguagetranslator_vertical(){
245
  $get_flag_choices = get_option ('flag_display_settings');
@@ -250,21 +219,20 @@ class google_language_translator {
250
  $get_flag_choices_count = count($get_flag_choices);
251
  $get_language_choices = get_option ('language_display_settings');
252
  $flag_width = get_option('googlelanguagetranslator_flag_size');
253
- $default_language_code = get_option('googlelanguagetranslator_language');
254
- $is_active = get_option ( 'googlelanguagetranslator_active' );
255
  $get_language_option = get_option('googlelanguagetranslator_language_option');
256
- $language_choices = $this->googlelanguagetranslator_included_languages();
257
- $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
258
  $str = '';
259
 
260
-
261
  if( $is_active == 1){
262
 
263
  foreach ($get_flag_choices as $flag_choice_key) {}
264
 
265
  if ($floating_widget=='yes' && $get_language_option != 'specific') {
266
  $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
267
- $str.='<div id="glt-toolbar"></div>';
268
  } //endif $floating_widget
269
 
270
  $str.='<div id="flags">';
@@ -275,201 +243,114 @@ class google_language_translator {
275
  $language_code = $key;
276
  $language_name = $value;
277
  $language_name_flag = $language_name;
278
-
279
- if ($flag_choice_key == '1') {
280
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
281
- $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$language_name.'"/></a></li>';
282
- }
283
- } //$key
284
- }//foreach
285
  } else {
286
- foreach ($new_languages_array_codes as $value) {
287
-
288
- $language_name = $value;
289
- $language_code = array_search ($language_name,$this->languages_array);
290
- $language_name_flag = $language_name;
291
-
292
  if ($flag_choice_key == '1') {
293
  if (in_array($language_name,$this->languages_array)) {
294
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
295
- $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$flag_width.'"/></a></li>';
296
- } //isset
297
  } //in_array
298
- }//flag_choice_key
299
- }//foreach
300
- }//else
301
-
302
  $str.='</ul>';
303
- $str.='</div>';
304
-
305
- $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
306
- $auto_display = ', autoDisplay: false';
307
-
308
- if ($is_multilanguage == 1) {
309
- $multilanguagePage = ', multilanguagePage:true';
310
-
311
- $str.='<script type="text/javascript">
312
- function GoogleLanguageTranslatorInit() {
313
- new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\''.$language_choices . $auto_display . $multilanguagePage . $this->analytics().'}, \'google_language_translator\');}
314
- </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>
315
- <div id="google_language_translator"></div>';
316
- return $str;
317
- } elseif ($is_multilanguage == 0) {
318
-
319
- $str.='<script type="text/javascript">
320
- function GoogleLanguageTranslatorInit() {
321
- new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\''.$language_choices . $auto_display . $this->analytics().'}, \'google_language_translator\');}
322
- </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>
323
- <div id="google_language_translator"></div>';
324
- return $str;
325
- }
326
- } //End is_active
327
  } // End glt_vertical
328
 
329
  public function googlelanguagetranslator_horizontal(){
330
  $get_flag_choices = get_option ('flag_display_settings');
331
- $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
332
- $new_languages_array = explode(",",$new_languages_array_string);
333
- $new_languages_array_codes = array_values($new_languages_array);
334
- $new_languages_array_count = count($new_languages_array);
335
- $get_flag_choices_count = count($get_flag_choices);
336
- $get_language_choices = get_option ('language_display_settings');
337
- $flag_width = get_option('googlelanguagetranslator_flag_size');
338
- $default_language_code = get_option('googlelanguagetranslator_language');
339
  $is_active = get_option ( 'googlelanguagetranslator_active' );
340
- $get_language_option = get_option('googlelanguagetranslator_language_option');
341
  $language_choices = $this->googlelanguagetranslator_included_languages();
342
  $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
343
- $str = '';
344
 
345
  if( $is_active == 1) {
346
  foreach ($get_flag_choices as $flag_choice_key) {}
347
 
348
  if ($floating_widget=='yes' && $get_language_option != 'specific') {
349
- $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
350
- $str.='<div id="glt-toolbar"></div>';
351
  } //endif $floating_widget
352
 
353
  $str.='<div id="flags">';
354
  $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
355
 
356
  if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
357
- foreach ($this->languages_array as $key=>$value) {
358
- $language_code = $key;
359
- $language_name = $value;
360
- $language_name_flag = $language_name;
361
 
362
- if ($flag_choice_key == '1') {
363
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
364
- $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$language_name.'"/></a></li>';
365
- }
366
- } //$key
367
- }//foreach
 
368
  } else {
369
- foreach ($new_languages_array_codes as $value) {
370
 
371
- $language_name = $value;
372
- $language_code = array_search ($language_name,$this->languages_array);
373
- $language_name_flag = $language_name;
374
-
375
- if ($flag_choice_key == '1') {
376
- if (in_array($language_name,$this->languages_array)) {
377
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
378
- $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$flag_width.'"/></a></li>';
379
- } //isset
380
- } //in_array
381
- }//flag_choice_key
382
- }//foreach
383
- }//else
384
-
385
  $str.='</ul>';
386
- $str.='</div>';
387
-
388
- $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
389
- $horizontal_layout = ', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL';
390
- $auto_display = ', autoDisplay: false';
391
-
392
- if ($is_multilanguage == 1) {
393
- $multilanguagePage = ', multilanguagePage:true';
394
-
395
- $str.='<script type="text/javascript">
396
- function GoogleLanguageTranslatorInit() {
397
- new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\''. $language_choices . $horizontal_layout . $auto_display . $multilanguagePage . $this->analytics().'}, \'google_language_translator\');}
398
- </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>
399
- <div id="google_language_translator"></div>';
400
- return $str;
401
- } elseif ($is_multilanguage == 0) {
402
-
403
- $str.='<script type="text/javascript">
404
- function GoogleLanguageTranslatorInit() {
405
- new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\''. $language_choices . $horizontal_layout . $auto_display . $this->analytics().'}, \'google_language_translator\');}
406
- </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>
407
- <div id="google_language_translator"></div>';
408
- return $str;
409
- }
410
  }
411
  } // End glt_horizontal
412
 
413
- public function initialize_settings() {
414
-
415
- // First, we register a section. This is necessary since all future options must belong to one.
416
- add_settings_section(
417
- 'glt_settings', // ID used to identify this section and with which to register options
418
- 'Settings', // Title to be displayed on the administration page
419
- '', // Callback used to render the description of the section
420
- 'google_language_translator' // Page on which to add this section of options
421
- );
422
-
423
- //Fieldset 1
424
- add_settings_field( 'googlelanguagetranslator_active','Plugin status:','googlelanguagetranslator_active_cb','google_language_translator','glt_settings');
425
- add_settings_field( 'googlelanguagetranslator_language','Choose the original language of your website','','googlelanguagetranslator_language_cb','glt_settings');
426
- add_settings_field( 'googlelanguagetranslator_language_option','What translation languages will you display to website visitors?','googlelanguagetranslator_language_option_cb','google_language_translator','glt_settings');
427
- add_settings_field( 'language_display_settings','Your language choices','language_display_settings_cb','google_language_translator','glt_settings');
428
- add_settings_field( 'googlelanguagetranslator_flags','Show Flag Images?','googlelanguagetranslator_flags_cb','google_language_translator','glt_settings');
429
- add_settings_field( 'flag_display_settings','Flag Options','flag_display_settings_cb','google_language_translator','glt_settings');
430
- add_settings_field( 'googlelanguagetranslator_translatebox','Show Translate Box?','googlelanguagetranslator_translatebox_cb','google_language_translator','glt_settings');
431
- add_settings_field( 'googlelanguagetranslator_display', 'Layout Options','googlelanguagetranslator_display_cb','google_language_translator','glt_settings');
432
- add_settings_field( 'googlelanguagetranslator_toolbar', 'Show Toolbar','googlelanguagetranslator_toolbar_cb','google_language_translator','glt_settings');
433
- add_settings_field( 'googlelanguagetranslator_showbranding', 'Show Google Branding','googlelanguagetranslator_showbranding_cb','google_language_translator','glt_settings');
434
- add_settings_field( 'googlelanguagetranslator_flags_alignment', 'Align Flags Right or Left', 'googlelanguagetranslator_flags_alignment_cb','google_language_translator','glt_settings');
435
- add_settings_field( 'googlelanguagetranslator_analytics','Activate Google Analytics tracking?','googlelanguagetranslator_analytics_cb','google_language_translator','glt_settings');
436
- add_settings_field( 'googlelanguagetranslator_analytics_id','Enter your Google Analytics ID','googlelanguagetranslator_analytics_id_cb','google_language_translator','glt_settings');
437
- add_settings_field( 'googlelanguagetranslator_css','Custom CSS Overrides','googlelanguagetranslator_css_cb','google_language_translator','glt_settings');
438
- add_settings_field( 'googlelanguagetranslator_manage_translations','Turn on translation management?','googlelanguagetranslator_manage_translations_cb','google_language_translator','glt_settings');
439
- add_settings_field( 'googlelanguagetranslator_multilanguage','Multilanguage webpages?','googlelanguagetranslator_multilanguage_cb','google_language_translator','glt_settings');
440
- add_settings_field( 'googlelanguagetranslator_floating_widget','Show floating translation widget?','googlelanguagetranslator_floating_widget_cb','google_language_translator','glt_settings');
441
- add_settings_field( 'googlelanguagetranslator_flag_size','Flag sizes:','googlelanguagetranslator_flag_size_cb','google_language_translator','glt_settings');
442
- add_settings_field( 'googlelanguagetranslator_flags_order','The order of flag positions','googlelanguagetranslator_flags_order_cb','google_language_translator','glt_settings');
443
 
444
- //Register Fieldset 1
445
- register_setting( 'google_language_translator','googlelanguagetranslator_active');
446
- register_setting( 'google_language_translator','googlelanguagetranslator_language');
447
- register_setting( 'google_language_translator','googlelanguagetranslator_language_option');
448
- register_setting( 'google_language_translator','language_display_settings');
449
- register_setting( 'google_language_translator','googlelanguagetranslator_flags');
450
- register_setting( 'google_language_translator','flag_display_settings');
451
- register_setting( 'google_language_translator','googlelanguagetranslator_translatebox');
452
- register_setting( 'google_language_translator','googlelanguagetranslator_display');
453
- register_setting( 'google_language_translator','googlelanguagetranslator_toolbar');
454
- register_setting( 'google_language_translator','googlelanguagetranslator_showbranding');
455
- register_setting( 'google_language_translator','googlelanguagetranslator_flags_alignment');
456
- register_setting( 'google_language_translator','googlelanguagetranslator_disable_mootools');
457
- register_setting( 'google_language_translator','googlelanguagetranslator_disable_modal');
458
- register_setting( 'google_language_translator','googlelanguagetranslator_analytics');
459
- register_setting( 'google_language_translator','googlelanguagetranslator_analytics_id');
460
- register_setting( 'google_language_translator','googlelanguagetranslator_css');
461
- register_setting( 'google_language_translator','googlelanguagetranslator_manage_translations');
462
- register_setting( 'google_language_translator','googlelanguagetranslator_multilanguage');
463
- register_setting( 'google_language_translator','googlelanguagetranslator_floating_widget');
464
- register_setting( 'google_language_translator','googlelanguagetranslator_flag_size');
465
- register_setting( 'google_language_translator','googlelanguagetranslator_flags_order');
466
  }
467
 
468
- public function googlelanguagetranslator_active_cb() {
469
-
470
- $option_name = 'googlelanguagetranslator_active' ;
471
  $new_value = 1;
472
-
473
  if ( get_option( $option_name ) === false ) {
474
 
475
  // The option does not exist, so we update it.
@@ -494,90 +375,17 @@ class google_language_translator {
494
  }
495
 
496
  $options = get_option (''.$option_name.''); ?>
497
- <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
498
- <option value="af" <?php if($options=='af'){echo "selected";}?>>Afrikaans</option>
499
- <option value="sq" <?php if($options=='sq'){echo "selected";}?>>Albanian</option>
500
- <option value="ar" <?php if($options=='ar'){echo "selected";}?>>Arabic</option>
501
- <option value="hy" <?php if($options=='hy'){echo "selected";}?>>Armenian</option>
502
- <option value="az" <?php if($options=='az'){echo "selected";}?>>Azerbaijani</option>
503
- <option value="eu" <?php if($options=='eu'){echo "selected";}?>>Basque</option>
504
- <option value="be" <?php if($options=='be'){echo "selected";}?>>Belarusian</option>
505
- <option value="bn" <?php if($options=='bn'){echo "selected";}?>>Bengali</option>
506
- <option value="bs" <?php if($options=='bs'){echo "selected";}?>>Bosnian</option>
507
- <option value="bg" <?php if($options=='bg'){echo "selected";}?>>Bulgarian</option>
508
- <option value="ca" <?php if($options=='ca'){echo "selected";}?>>Catalan</option>
509
- <option value="ceb" <?php if($options=='ceb'){echo "selected";}?>>Cebuano</option>
510
- <option value="zh-CN" <?php if($options=='zh-CN'){echo "selected";}?>>Chinese</option>
511
- <option value="zh-TW" <?php if($options=='zh-TW'){echo "selected";}?>>Chinese (Han)</option>
512
- <option value="hr" <?php if($options=='hr'){echo "selected";}?>>Croatian</option>
513
- <option value="cs" <?php if($options=='cs'){echo "selected";}?>>Czech</option>
514
- <option value="da" <?php if($options=='da'){echo "selected";}?>>Danish</option>
515
- <option value="nl" <?php if($options=='nl'){echo "selected";}?>>Dutch</option>
516
- <option value="en" <?php if($options=='en'){echo "selected";}?>>English</option>
517
- <option value="eo" <?php if($options=='eo'){echo "selected";}?>>Esperanto</option>
518
- <option value="et" <?php if($options=='et'){echo "selected";}?>>Estonian</option>
519
- <option value="tl" <?php if($options=='tl'){echo "selected";}?>>Filipino</option>
520
- <option value="fi" <?php if($options=='fi'){echo "selected";}?>>Finnish</option>
521
- <option value="fr" <?php if($options=='fr'){echo "selected";}?>>French</option>
522
- <option value="gl" <?php if($options=='gl'){echo "selected";}?>>Galician</option>
523
- <option value="ka" <?php if($options=='ka'){echo "selected";}?>>Georgian</option>
524
- <option value="de" <?php if($options=='de'){echo "selected";}?>>German</option>
525
- <option value="el" <?php if($options=='el'){echo "selected";}?>>Greek</option>
526
- <option value="gu" <?php if($options=='gu'){echo "selected";}?>>Gujarati</option>
527
- <option value="ht" <?php if($options=='ht'){echo "selected";}?>>Haitian Creole</option>
528
- <option value="ha" <?php if($options=='ha'){echo "selected";}?>>Hausa</option>
529
- <option value="iw" <?php if($options=='iw'){echo "selected";}?>>Hebrew</option>
530
- <option value="hi" <?php if($options=='hi'){echo "selected";}?>>Hindi</option>
531
- <option value="hmn" <?php if($options=='hmn'){echo "selected";}?>>Hmong</option>
532
- <option value="hu" <?php if($options=='hu'){echo "selected";}?>>Hungarian</option>
533
- <option value="is" <?php if($options=='is'){echo "selected";}?>>Icelandic</option>
534
- <option value="ig" <?php if($options=='ig'){echo "selected";}?>>Igbo</option>
535
- <option value="id" <?php if($options=='id'){echo "selected";}?>>Indonesian</option>
536
- <option value="ga" <?php if($options=='ga'){echo "selected";}?>>Irish</option>
537
- <option value="it" <?php if($options=='it'){echo "selected";}?>>Italian</option>
538
- <option value="ja" <?php if($options=='ja'){echo "selected";}?>>Japanese</option>
539
- <option value="jw" <?php if($options=='jw'){echo "selected";}?>>Javanese</option>
540
- <option value="kn" <?php if($options=='kn'){echo "selected";}?>>Kannada</option>
541
- <option value="km" <?php if($options=='km'){echo "selected";}?>>Khmer</option>
542
- <option value="ko" <?php if($options=='ko'){echo "selected";}?>>Korean</option>
543
- <option value="lo" <?php if($options=='lo'){echo "selected";}?>>Lao</option>
544
- <option value="la" <?php if($options=='la'){echo "selected";}?>>Latin</option>
545
- <option value="lv" <?php if($options=='lv'){echo "selected";}?>>Latvian</option>
546
- <option value="lt" <?php if($options=='lt'){echo "selected";}?>>Lithuanian</option>
547
- <option value="mk" <?php if($options=='mk'){echo "selected";}?>>Macedonian</option>
548
- <option value="ms" <?php if($options=='ms'){echo "selected";}?>>Malay</option>
549
- <option value="mt" <?php if($options=='mt'){echo "selected";}?>>Maltese</option>
550
- <option value="mi" <?php if($options=='mi'){echo "selected";}?>>Maori</option>
551
- <option value="mr" <?php if($options=='mr'){echo "selected";}?>>Marathi</option>
552
- <option value="mn" <?php if($options=='mn'){echo "selected";}?>>Mongolian</option>
553
- <option value="ne" <?php if($options=='ne'){echo "selected";}?>>Nepali</option>
554
- <option value="no" <?php if($options=='no'){echo "selected";}?>>Norwegian</option>
555
- <option value="fa" <?php if($options=='fa'){echo "selected";}?>>Persian</option>
556
- <option value="pl" <?php if($options=='pl'){echo "selected";}?>>Polish</option>
557
- <option value="pt" <?php if($options=='pt'){echo "selected";}?>>Portuguese</option>
558
- <option value="pa" <?php if($options=='pa'){echo "selected";}?>>Punjabi</option>
559
- <option value="ro" <?php if($options=='ro'){echo "selected";}?>>Romanian</option>
560
- <option value="ru" <?php if($options=='ru'){echo "selected";}?>>Russian</option>
561
- <option value="sr" <?php if($options=='sr'){echo "selected";}?>>Serbian</option>
562
- <option value="sk" <?php if($options=='sk'){echo "selected";}?>>Slovak</option>
563
- <option value="sl" <?php if($options=='sl'){echo "selected";}?>>Slovenian</option>
564
- <option value="so" <?php if($options=='so'){echo "selected";}?>>Somali</option>
565
- <option value="es" <?php if($options=='es'){echo "selected";}?>>Spanish</option>
566
- <option value="sw" <?php if($options=='sw'){echo "selected";}?>>Swahili</option>
567
- <option value="sv" <?php if($options=='sv'){echo "selected";}?>>Swedish</option>
568
- <option value="ta" <?php if($options=='ta'){echo "selected";}?>>Tamil</option>
569
- <option value="te" <?php if($options=='te'){echo "selected";}?>>Telugu</option>
570
- <option value="th" <?php if($options=='th'){echo "selected";}?>>Thai</option>
571
- <option value="tr" <?php if($options=='tr'){echo "selected";}?>>Turkish</option>
572
- <option value="uk" <?php if($options=='uk'){echo "selected";}?>>Ukranian</option>
573
- <option value="ur" <?php if($options=='ur'){echo "selected";}?>>Urdu</option>
574
- <option value="vi" <?php if($options=='vi'){echo "selected";}?>>Vietnamese</option>
575
- <option value="cy" <?php if($options=='cy'){echo "selected";}?>>Welsh</option>
576
- <option value="yi" <?php if($options=='yi'){echo "selected";}?>>Yiddish</option>
577
- <option value="cy" <?php if($options=='cy'){echo "selected";}?>>Yoruba</option>
578
- <option value="yi" <?php if($options=='yi'){echo "selected";}?>>Zulu</option>
579
-
580
- </select>
581
  <?php
582
  }
583
 
@@ -600,441 +408,42 @@ class google_language_translator {
600
  }
601
 
602
  public function language_display_settings_cb() {
603
- $defaults = array (
604
- 'en' => 1
605
- );
606
-
607
- $option_name = 'language_display_settings' ;
608
- $new_value = $defaults;
609
-
610
- if ( get_option( $option_name ) === false ) {
611
-
612
- // The option does not exist, so we update it.
613
- update_option( $option_name, $new_value );
614
- }
615
-
616
- $get_language_choices = get_option (''.$option_name.'');
617
-
618
- if (!isset ( $get_language_choices ['af'] ) ) {
619
- $get_language_choices['af'] = 0;
620
- }
621
-
622
- if (!isset ( $get_language_choices ['sq'] ) ) {
623
- $get_language_choices['sq'] = 0;
624
- }
625
-
626
- if (!isset ( $get_language_choices ['ar'] ) ) {
627
- $get_language_choices['ar'] = 0;
628
- }
629
-
630
- if (!isset ( $get_language_choices ['hy'] ) ) {
631
- $get_language_choices['hy'] = 0;
632
- }
633
-
634
- if (!isset ( $get_language_choices ['az'] ) ) {
635
- $get_language_choices['az'] = 0;
636
- }
637
-
638
- if (!isset ( $get_language_choices ['eu'] ) ) {
639
- $get_language_choices['eu'] = 0;
640
- }
641
-
642
- if (!isset ( $get_language_choices ['be'] ) ) {
643
- $get_language_choices['be'] = 0;
644
- }
645
-
646
- if (!isset ( $get_language_choices ['bn'] ) ) {
647
- $get_language_choices['bn'] = 0;
648
- }
649
-
650
- if (!isset ( $get_language_choices ['bs'] ) ) {
651
- $get_language_choices['bs'] = 0;
652
- }
653
-
654
- if (!isset ( $get_language_choices ['bg'] ) ) {
655
- $get_language_choices['bg'] = 0;
656
- }
657
-
658
- if (!isset ( $get_language_choices ['ca'] ) ) {
659
- $get_language_choices['ca'] = 0;
660
- }
661
-
662
- if (!isset ( $get_language_choices ['ceb'] ) ) {
663
- $get_language_choices['ceb'] = 0;
664
- }
665
 
666
- if (!isset ( $get_language_choices ['zh-CN'] ) ) {
667
- $get_language_choices['zh-CN'] = 0;
668
- }
669
-
670
- if (!isset ( $get_language_choices ['zh-TW'] ) ) {
671
- $get_language_choices['zh-TW'] = 0;
672
- }
673
-
674
- if (!isset ( $get_language_choices ['hr'] ) ) {
675
- $get_language_choices['hr'] = 0;
676
- }
677
-
678
- if (!isset ( $get_language_choices ['cs'] ) ) {
679
- $get_language_choices['cs'] = 0;
680
- }
681
-
682
- if (!isset ( $get_language_choices ['da'] ) ) {
683
- $get_language_choices['da'] = 0;
684
- }
685
-
686
- if (!isset ( $get_language_choices ['nl'] ) ) {
687
- $get_language_choices['nl'] = 0;
688
- }
689
-
690
- if (!isset ( $get_language_choices ['en'] ) ) {
691
- $get_language_choices['en'] = 1;
692
- }
693
-
694
- if (!isset ( $get_language_choices ['eo'] ) ) {
695
- $get_language_choices['eo'] = 0;
696
- }
697
-
698
- if (!isset ( $get_language_choices ['et'] ) ) {
699
- $get_language_choices['et'] = 0;
700
- }
701
-
702
- if (!isset ( $get_language_choices ['tl'] ) ) {
703
- $get_language_choices['tl'] = 0;
704
- }
705
-
706
- if (!isset ( $get_language_choices ['fi'] ) ) {
707
- $get_language_choices['fi'] = 0;
708
- }
709
-
710
- if (!isset ( $get_language_choices ['fr'] ) ) {
711
- $get_language_choices['fr'] = 0;
712
- }
713
-
714
- if (!isset ( $get_language_choices ['gl'] ) ) {
715
- $get_language_choices['gl'] = 0;
716
- }
717
-
718
- if (!isset ( $get_language_choices ['ka'] ) ) {
719
- $get_language_choices['ka'] = 0;
720
- }
721
-
722
- if (!isset ( $get_language_choices ['de'] ) ) {
723
- $get_language_choices['de'] = 0;
724
- }
725
-
726
- if (!isset ( $get_language_choices ['el'] ) ) {
727
- $get_language_choices['el'] = 0;
728
- }
729
-
730
- if (!isset ( $get_language_choices ['gu'] ) ) {
731
- $get_language_choices['gu'] = 0;
732
- }
733
-
734
- if (!isset ( $get_language_choices ['ht'] ) ) {
735
- $get_language_choices['ht'] = 0;
736
- }
737
-
738
- if (!isset ( $get_language_choices ['ha'] ) ) {
739
- $get_language_choices['ha'] = 0;
740
- }
741
-
742
- if (!isset ( $get_language_choices ['iw'] ) ) {
743
- $get_language_choices['iw'] = 0;
744
- }
745
-
746
- if (!isset ( $get_language_choices ['hi'] ) ) {
747
- $get_language_choices['hi'] = 0;
748
- }
749
-
750
- if (!isset ( $get_language_choices ['hmn'] ) ) {
751
- $get_language_choices['hmn'] = 0;
752
- }
753
-
754
- if (!isset ( $get_language_choices ['hu'] ) ) {
755
- $get_language_choices['hu'] = 0;
756
- }
757
-
758
- if (!isset ( $get_language_choices ['is'] ) ) {
759
- $get_language_choices['is'] = 0;
760
- }
761
-
762
- if (!isset ( $get_language_choices ['ig'] ) ) {
763
- $get_language_choices['ig'] = 0;
764
- }
765
-
766
- if (!isset ( $get_language_choices ['id'] ) ) {
767
- $get_language_choices['id'] = 0;
768
- }
769
-
770
- if (!isset ( $get_language_choices ['ga'] ) ) {
771
- $get_language_choices['ga'] = 0;
772
- }
773
-
774
- if (!isset ( $get_language_choices ['it'] ) ) {
775
- $get_language_choices['it'] = 0;
776
- }
777
-
778
- if (!isset ( $get_language_choices ['ja'] ) ) {
779
- $get_language_choices['ja'] = 0;
780
- }
781
-
782
- if (!isset ( $get_language_choices ['jw'] ) ) {
783
- $get_language_choices['jw'] = 0;
784
- }
785
-
786
- if (!isset ( $get_language_choices ['kn'] ) ) {
787
- $get_language_choices['kn'] = 0;
788
- }
789
-
790
- if (!isset ( $get_language_choices ['km'] ) ) {
791
- $get_language_choices['km'] = 0;
792
- }
793
-
794
- if (!isset ( $get_language_choices ['ko'] ) ) {
795
- $get_language_choices['ko'] = 0;
796
- }
797
-
798
- if (!isset ( $get_language_choices ['lo'] ) ) {
799
- $get_language_choices['lo'] = 0;
800
- }
801
-
802
- if (!isset ( $get_language_choices ['la'] ) ) {
803
- $get_language_choices['la'] = 0;
804
- }
805
-
806
- if (!isset ( $get_language_choices ['lv'] ) ) {
807
- $get_language_choices['lv'] = 0;
808
- }
809
-
810
- if (!isset ( $get_language_choices ['lt'] ) ) {
811
- $get_language_choices['lt'] = 0;
812
- }
813
-
814
- if (!isset ( $get_language_choices ['mk'] ) ) {
815
- $get_language_choices['mk'] = 0;
816
- }
817
-
818
- if (!isset ( $get_language_choices ['ms'] ) ) {
819
- $get_language_choices['ms'] = 0;
820
- }
821
-
822
- if (!isset ( $get_language_choices ['mt'] ) ) {
823
- $get_language_choices['mt'] = 0;
824
- }
825
-
826
- if (!isset ( $get_language_choices ['mi'] ) ) {
827
- $get_language_choices['mi'] = 0;
828
- }
829
-
830
- if (!isset ( $get_language_choices ['mr'] ) ) {
831
- $get_language_choices['mr'] = 0;
832
- }
833
-
834
- if (!isset ( $get_language_choices ['mn'] ) ) {
835
- $get_language_choices['mn'] = 0;
836
- }
837
-
838
- if (!isset ( $get_language_choices ['ne'] ) ) {
839
- $get_language_choices['ne'] = 0;
840
- }
841
-
842
- if (!isset ( $get_language_choices ['no'] ) ) {
843
- $get_language_choices['no'] = 0;
844
- }
845
-
846
- if (!isset ( $get_language_choices ['fa'] ) ) {
847
- $get_language_choices['fa'] = 0;
848
- }
849
-
850
- if (!isset ( $get_language_choices ['pl'] ) ) {
851
- $get_language_choices['pl'] = 0;
852
- }
853
-
854
- if (!isset ( $get_language_choices ['pt'] ) ) {
855
- $get_language_choices['pt'] = 0;
856
- }
857
-
858
- if (!isset ( $get_language_choices ['pa'] ) ) {
859
- $get_language_choices['pa'] = 0;
860
- }
861
-
862
- if (!isset ( $get_language_choices ['ro'] ) ) {
863
- $get_language_choices['ro'] = 0;
864
- }
865
-
866
- if (!isset ( $get_language_choices ['ru'] ) ) {
867
- $get_language_choices['ru'] = 0;
868
- }
869
-
870
- if (!isset ( $get_language_choices ['sr'] ) ) {
871
- $get_language_choices['sr'] = 0;
872
- }
873
-
874
- if (!isset ( $get_language_choices ['sk'] ) ) {
875
- $get_language_choices['sk'] = 0;
876
- }
877
-
878
- if (!isset ( $get_language_choices ['sl'] ) ) {
879
- $get_language_choices['sl'] = 0;
880
- }
881
-
882
- if (!isset ( $get_language_choices ['so'] ) ) {
883
- $get_language_choices['so'] = 0;
884
- }
885
-
886
- if (!isset ( $get_language_choices ['es'] ) ) {
887
- $get_language_choices['es'] = 0;
888
- }
889
-
890
- if (!isset ( $get_language_choices ['sw'] ) ) {
891
- $get_language_choices['sw'] = 0;
892
- }
893
-
894
- if (!isset ( $get_language_choices ['sv'] ) ) {
895
- $get_language_choices['sv'] = 0;
896
- }
897
-
898
- if (!isset ( $get_language_choices ['ta'] ) ) {
899
- $get_language_choices['ta'] = 0;
900
- }
901
-
902
- if (!isset ( $get_language_choices ['te'] ) ) {
903
- $get_language_choices['te'] = 0;
904
- }
905
-
906
- if (!isset ( $get_language_choices ['th'] ) ) {
907
- $get_language_choices['th'] = 0;
908
- }
909
-
910
- if (!isset ( $get_language_choices ['tr'] ) ) {
911
- $get_language_choices['tr'] = 0;
912
- }
913
-
914
- if (!isset ( $get_language_choices ['uk'] ) ) {
915
- $get_language_choices['uk'] = 0;
916
- }
917
-
918
- if (!isset ( $get_language_choices ['ur'] ) ) {
919
- $get_language_choices['ur'] = 0;
920
- }
921
-
922
- if (!isset ( $get_language_choices ['vi'] ) ) {
923
- $get_language_choices['vi'] = 0;
924
- }
925
-
926
- if (!isset ( $get_language_choices ['cy'] ) ) {
927
- $get_language_choices['cy'] = 0;
928
- }
929
 
930
- if (!isset ( $get_language_choices ['yi'] ) ) {
931
- $get_language_choices['yi'] = 0;
932
- }
933
-
934
- if (!isset ( $get_language_choices ['yo'] ) ) {
935
- $get_language_choices['yo'] = 0;
936
- }
937
 
938
- if (!isset ( $get_language_choices ['zu'] ) ) {
939
- $get_language_choices['zu'] = 0;
940
- } ?>
941
-
942
- <div class="languages" style="width:25%; float:left">
943
- <div><input type="checkbox" name="language_display_settings[af]" value="1" <?php if ( 1 == $get_language_choices['af'] ) echo 'checked="checked"'; ?>/> Afrikaans</div>
944
- <div><input type="checkbox" name="language_display_settings[sq]" value="1" <?php if ( 1 == $get_language_choices['sq'] ) echo 'checked="checked"'; ?>/> Albanian</div>
945
- <div><input type="checkbox" name="language_display_settings[ar]" value="1" <?php if ( 1 == $get_language_choices['ar'] ) echo 'checked="checked"'; ?>/> Arabic</div>
946
- <div><input type="checkbox" name="language_display_settings[hy]" value="1" <?php if ( 1 == $get_language_choices['hy'] ) echo 'checked="checked"'; ?>/> Armenian</div>
947
- <div><input type="checkbox" name="language_display_settings[az]" value="1" <?php if ( 1 == $get_language_choices['az'] ) echo 'checked="checked"'; ?>/> Azerbaijani</div>
948
- <div><input type="checkbox" name="language_display_settings[eu]" value="1" <?php if ( 1 == $get_language_choices['eu'] ) echo 'checked="checked"'; ?>/> Basque</div>
949
- <div><input type="checkbox" name="language_display_settings[be]" value="1" <?php if ( 1 == $get_language_choices['be'] ) echo 'checked="checked"'; ?>/> Belarusian</div>
950
- <div><input type="checkbox" name="language_display_settings[bn]" value="1" <?php if ( 1 == $get_language_choices['bn'] ) echo 'checked="checked"'; ?>/> Bengali</div>
951
- <div><input type="checkbox" name="language_display_settings[bs]" value="1" <?php if ( 1 == $get_language_choices['bs'] ) echo 'checked="checked"'; ?>/> Bosnian</div>
952
- <div><input type="checkbox" name="language_display_settings[bg]" value="1" <?php if ( 1 == $get_language_choices['bg'] ) echo 'checked="checked"'; ?>/> Bulgarian</div>
953
- <div><input type="checkbox" name="language_display_settings[ca]" value="1" <?php if ( 1 == $get_language_choices['ca'] ) echo 'checked="checked"'; ?>/> Catalan</div>
954
- <div><input type="checkbox" name="language_display_settings[ceb]" value="1" <?php if ( 1 == $get_language_choices['ceb'] ) echo 'checked="checked"'; ?>/> Cebuano</div>
955
- <div><input type="checkbox" name="language_display_settings[zh-CN]" value="1" <?php if ( 1 == $get_language_choices['zh-CN'] ) echo 'checked="checked"'; ?>/> Chinese</div>
956
- <div><input type="checkbox" name="language_display_settings[zh-TW]" value="1" <?php if ( 1 == $get_language_choices['zh-TW'] ) echo 'checked="checked"'; ?>/> Chinese (Han)</div>
957
- <div><input type="checkbox" name="language_display_settings[hr]" value="1" <?php if ( 1 == $get_language_choices['hr'] ) echo 'checked="checked"'; ?>/> Croatian</div>
958
- <div><input type="checkbox" name="language_display_settings[cs]" value="1" <?php if ( 1 == $get_language_choices['cs'] ) echo 'checked="checked"'; ?>/> Czech</div>
959
- <div><input type="checkbox" name="language_display_settings[da]" value="1" <?php if ( 1 == $get_language_choices['da'] ) echo 'checked="checked"'; ?>/> Danish</div>
960
- <div><input type="checkbox" name="language_display_settings[nl]" value="1" <?php if ( 1 == $get_language_choices['nl'] ) echo 'checked="checked"'; ?>/> Dutch</div>
961
- <div><input type="checkbox" name="language_display_settings[en]" value="1" <?php if ( 1 == $get_language_choices['en'] ) echo 'checked="checked"'; ?>/> English</div>
962
- <div><input type="checkbox" name="language_display_settings[eo]" value="1" <?php if ( 1 == $get_language_choices['eo'] ) echo 'checked="checked"'; ?>/> Esperanto</div>
963
- <div><input type="checkbox" name="language_display_settings[et]" value="1" <?php if ( 1 == $get_language_choices['et'] ) echo 'checked="checked"'; ?>/> Estonian</div>
964
- </div>
965
-
966
- <div class="languages" style="width:25%; float:left">
967
- <div><input type="checkbox" name="language_display_settings[tl]" value="1" <?php if ( 1 == $get_language_choices['tl'] ) echo 'checked="checked"'; ?>/> Filipino</div>
968
- <div><input type="checkbox" name="language_display_settings[fi]" value="1" <?php if ( 1 == $get_language_choices['fi'] ) echo 'checked="checked"'; ?>/> Finnish</div>
969
- <div><input type="checkbox" name="language_display_settings[fr]" value="1" <?php if ( 1 == $get_language_choices['fr'] ) echo 'checked="checked"'; ?>/> French</div>
970
- <div><input type="checkbox" name="language_display_settings[gl]" value="1" <?php if ( 1 == $get_language_choices['gl'] ) echo 'checked="checked"'; ?>/> Galician</div>
971
- <div><input type="checkbox" name="language_display_settings[ka]" value="1" <?php if ( 1 == $get_language_choices['ka'] ) echo 'checked="checked"'; ?>/> Georgian</div>
972
- <div><input type="checkbox" name="language_display_settings[de]" value="1" <?php if ( 1 == $get_language_choices['de'] ) echo 'checked="checked"'; ?>/> German</div>
973
- <div><input type="checkbox" name="language_display_settings[el]" value="1" <?php if ( 1 == $get_language_choices['el'] ) echo 'checked="checked"'; ?>/> Greek</div>
974
- <div><input type="checkbox" name="language_display_settings[gu]" value="1" <?php if ( 1 == $get_language_choices['gu'] ) echo 'checked="checked"'; ?>/> Gujarati</div>
975
- <div><input type="checkbox" name="language_display_settings[ht]" value="1" <?php if ( 1 == $get_language_choices['ht'] ) echo 'checked="checked"'; ?>/> Haitian Creole</div>
976
- <div><input type="checkbox" name="language_display_settings[ha]" value="1" <?php if ( 1 == $get_language_choices['ha'] ) echo 'checked="checked"'; ?>/> Hausa</div>
977
- <div><input type="checkbox" name="language_display_settings[iw]" value="1" <?php if ( 1 == $get_language_choices['iw'] ) echo 'checked="checked"'; ?>/> Hebrew</div>
978
- <div><input type="checkbox" name="language_display_settings[hi]" value="1" <?php if ( 1 == $get_language_choices['hi'] ) echo 'checked="checked"'; ?>/> Hindi</div>
979
- <div><input type="checkbox" name="language_display_settings[hmn]" value="1" <?php if ( 1 == $get_language_choices['hmn'] ) echo 'checked="checked"'; ?>/> Hmong</div>
980
- <div><input type="checkbox" name="language_display_settings[hu]" value="1" <?php if ( 1 == $get_language_choices['hu'] ) echo 'checked="checked"'; ?>/> Hungarian</div>
981
- <div><input type="checkbox" name="language_display_settings[is]" value="1" <?php if ( 1 == $get_language_choices['is'] ) echo 'checked="checked"'; ?>/> Icelandic</div>
982
- <div><input type="checkbox" name="language_display_settings[ig]" value="1" <?php if ( 1 == $get_language_choices['ig'] ) echo 'checked="checked"'; ?>/> Igbo</div>
983
- <div><input type="checkbox" name="language_display_settings[id]" value="1" <?php if ( 1 == $get_language_choices['id'] ) echo 'checked="checked"'; ?>/> Indonesian</div>
984
- <div><input type="checkbox" name="language_display_settings[ga]" value="1" <?php if ( 1 == $get_language_choices['ga'] ) echo 'checked="checked"'; ?>/> Irish</div>
985
- <div><input type="checkbox" name="language_display_settings[it]" value="1" <?php if ( 1 == $get_language_choices['it'] ) echo 'checked="checked"'; ?>/> Italian</div>
986
- <div><input type="checkbox" name="language_display_settings[ja]" value="1" <?php if ( 1 == $get_language_choices['ja'] ) echo 'checked="checked"'; ?>/> Japanese</div>
987
- <div><input type="checkbox" name="language_display_settings[jw]" value="1" <?php if ( 1 == $get_language_choices['jw'] ) echo 'checked="checked"'; ?>/> Javanese</div>
988
- </div>
989
-
990
- <div class="languages" style="width:25%; float:left">
991
- <div><input type="checkbox" name="language_display_settings[kn]" value="1" <?php if ( 1 == $get_language_choices['kn'] ) echo 'checked="checked"'; ?>/> Kannada</div>
992
- <div><input type="checkbox" name="language_display_settings[km]" value="1" <?php if ( 1 == $get_language_choices['km'] ) echo 'checked="checked"'; ?>/> Khmer</div>
993
- <div><input type="checkbox" name="language_display_settings[ko]" value="1" <?php if ( 1 == $get_language_choices['ko'] ) echo 'checked="checked"'; ?>/> Korean</div>
994
- <div><input type="checkbox" name="language_display_settings[lo]" value="1" <?php if ( 1 == $get_language_choices['lo'] ) echo 'checked="checked"'; ?>/> Lao</div>
995
- <div><input type="checkbox" name="language_display_settings[la]" value="1" <?php if ( 1 == $get_language_choices['la'] ) echo 'checked="checked"'; ?>/> Latin</div>
996
- <div><input type="checkbox" name="language_display_settings[lv]" value="1" <?php if ( 1 == $get_language_choices['lv'] ) echo 'checked="checked"'; ?>/> Latvian</div>
997
- <div><input type="checkbox" name="language_display_settings[lt]" value="1" <?php if ( 1 == $get_language_choices['lt'] ) echo 'checked="checked"'; ?>/> Lithuanian</div>
998
- <div><input type="checkbox" name="language_display_settings[mk]" value="1" <?php if ( 1 == $get_language_choices['mk'] ) echo 'checked="checked"'; ?>/> Macedonian</div>
999
- <div><input type="checkbox" name="language_display_settings[ms]" value="1" <?php if ( 1 == $get_language_choices['ms'] ) echo 'checked="checked"'; ?>/> Malay</div>
1000
- <div><input type="checkbox" name="language_display_settings[mt]" value="1" <?php if ( 1 == $get_language_choices['mt'] ) echo 'checked="checked"'; ?>/> Maltese</div>
1001
- <div><input type="checkbox" name="language_display_settings[mi]" value="1" <?php if ( 1 == $get_language_choices['mi'] ) echo 'checked="checked"'; ?>/> Maori</div>
1002
- <div><input type="checkbox" name="language_display_settings[mr]" value="1" <?php if ( 1 == $get_language_choices['mr'] ) echo 'checked="checked"'; ?>/> Marathi</div>
1003
- <div><input type="checkbox" name="language_display_settings[mn]" value="1" <?php if ( 1 == $get_language_choices['mn'] ) echo 'checked="checked"'; ?>/> Mongolian</div>
1004
- <div><input type="checkbox" name="language_display_settings[ne]" value="1" <?php if ( 1 == $get_language_choices['ne'] ) echo 'checked="checked"'; ?>/> Nepali</div>
1005
- <div><input type="checkbox" name="language_display_settings[no]" value="1" <?php if ( 1 == $get_language_choices['no'] ) echo 'checked="checked"'; ?>/> Norwegian</div>
1006
- <div><input type="checkbox" name="language_display_settings[fa]" value="1" <?php if ( 1 == $get_language_choices['fa'] ) echo 'checked="checked"'; ?>/> Persian</div>
1007
- <div><input type="checkbox" name="language_display_settings[pl]" value="1" <?php if ( 1 == $get_language_choices['pl'] ) echo 'checked="checked"'; ?>/> Polish</div>
1008
- <div><input type="checkbox" name="language_display_settings[pt]" value="1" <?php if ( 1 == $get_language_choices['pt'] ) echo 'checked="checked"'; ?>/> Portuguese</div>
1009
- <div><input type="checkbox" name="language_display_settings[pa]" value="1" <?php if ( 1 == $get_language_choices['pa'] ) echo 'checked="checked"'; ?>/> Punjabi</div>
1010
- <div><input type="checkbox" name="language_display_settings[ro]" value="1" <?php if ( 1 == $get_language_choices['ro'] ) echo 'checked="checked"'; ?>/> Romanian</div>
1011
- <div><input type="checkbox" name="language_display_settings[ru]" value="1" <?php if ( 1 == $get_language_choices['ru'] ) echo 'checked="checked"'; ?>/> Russian</div>
1012
- </div>
1013
-
1014
- <div class="languages" style="width:25%; float:left">
1015
- <div><input type="checkbox" name="language_display_settings[sr]" value="1" <?php if ( 1 == $get_language_choices['sr'] ) echo 'checked="checked"'; ?>/> Serbian</div>
1016
- <div><input type="checkbox" name="language_display_settings[sk]" value="1" <?php if ( 1 == $get_language_choices['sk'] ) echo 'checked="checked"'; ?>/> Slovak</div>
1017
- <div><input type="checkbox" name="language_display_settings[sl]" value="1" <?php if ( 1 == $get_language_choices['sl'] ) echo 'checked="checked"'; ?>/> Slovenian</div>
1018
- <div><input type="checkbox" name="language_display_settings[so]" value="1" <?php if ( 1 == $get_language_choices['so'] ) echo 'checked="checked"'; ?>/> Somali</div>
1019
- <div><input type="checkbox" name="language_display_settings[es]" value="1" <?php if ( 1 == $get_language_choices['es'] ) echo 'checked="checked"'; ?>/> Spanish</div>
1020
- <div><input type="checkbox" name="language_display_settings[sw]" value="1" <?php if ( 1 == $get_language_choices['sw'] ) echo 'checked="checked"'; ?>/> Swahili</div>
1021
- <div><input type="checkbox" name="language_display_settings[sv]" value="1" <?php if ( 1 == $get_language_choices['sv'] ) echo 'checked="checked"'; ?>/> Swedish</div>
1022
- <div><input type="checkbox" name="language_display_settings[ta]" value="1" <?php if ( 1 == $get_language_choices['ta'] ) echo 'checked="checked"'; ?>/> Tamil</div>
1023
- <div><input type="checkbox" name="language_display_settings[te]" value="1" <?php if ( 1 == $get_language_choices['te'] ) echo 'checked="checked"'; ?>/> Telugu</div>
1024
- <div><input type="checkbox" name="language_display_settings[th]" value="1" <?php if ( 1 == $get_language_choices['th'] ) echo 'checked="checked"'; ?>/> Thai</div>
1025
- <div><input type="checkbox" name="language_display_settings[tr]" value="1" <?php if ( 1 == $get_language_choices['tr'] ) echo 'checked="checked"'; ?>/> Turkish</div>
1026
- <div><input type="checkbox" name="language_display_settings[uk]" value="1" <?php if ( 1 == $get_language_choices['uk'] ) echo 'checked="checked"'; ?>/> Ukranian</div>
1027
- <div><input type="checkbox" name="language_display_settings[ur]" value="1" <?php if ( 1 == $get_language_choices['ur'] ) echo 'checked="checked"'; ?>/> Urdu</div>
1028
- <div><input type="checkbox" name="language_display_settings[vi]" value="1" <?php if ( 1 == $get_language_choices['vi'] ) echo 'checked="checked"'; ?>/> Vietnamese</div>
1029
- <div><input type="checkbox" name="language_display_settings[cy]" value="1" <?php if ( 1 == $get_language_choices['cy'] ) echo 'checked="checked"'; ?>/> Welsh</div>
1030
- <div><input type="checkbox" name="language_display_settings[yi]" value="1" <?php if ( 1 == $get_language_choices['yi'] ) echo 'checked="checked"'; ?>/> Yiddish</div>
1031
- <div><input type="checkbox" name="language_display_settings[yo]" value="1" <?php if ( 1 == $get_language_choices['yo'] ) echo 'checked="checked"'; ?>/> Yoruba</div>
1032
- <div><input type="checkbox" name="language_display_settings[zu]" value="1" <?php if ( 1 == $get_language_choices['zu'] ) echo 'checked="checked"'; ?>/> Zulu</div>
1033
-
1034
- </div>
1035
-
1036
- <div style="clear:both"></div>
1037
- <?php }
1038
 
1039
  public function googlelanguagetranslator_flags_cb() {
1040
 
@@ -1055,124 +464,44 @@ class google_language_translator {
1055
  }
1056
 
1057
  public function flag_display_settings_cb() {
1058
- $get_flag_choices = get_option ('flag_display_settings');
1059
- $default_language_code = get_option ('googlelanguagetranslator_language');
1060
- $option_name = 'flag_display_settings' ;
1061
  $new_value = array('flag-'.$default_language_code.'' => 1);
1062
-
1063
- foreach ($this->languages_array as $key => $value) {
1064
- $language_code = $key;
1065
-
1066
- if (!isset ( $get_flag_choices ['flag'-$language_code] ) ) {
1067
- $get_flag_choices ['flag'-$language_code] == 0;
1068
- }
1069
- }
1070
 
1071
- if ( get_option( $option_name ) == false ) {
1072
  // The option does not exist, so we update it.
1073
  update_option( $option_name, $new_value );
1074
  }
1075
 
1076
- $get_flag_choices = get_option (''.$option_name.'');
1077
 
1078
- ?>
1079
- <div class="flagdisplay" style="width:25%; float:left">
1080
- <div><input type="checkbox" name="flag_display_settings[flag-af]" value="1" <?php checked( 1,$get_flag_choices['flag-af']); ?>/> Afrikaans</div>
1081
- <div><input type="checkbox" name="flag_display_settings[flag-sq]" value="1" <?php checked( 1,$get_flag_choices['flag-sq']); ?>/> Albanian</div>
1082
- <div><input type="checkbox" name="flag_display_settings[flag-ar]" value="1" <?php checked( 1,$get_flag_choices['flag-ar']); ?>/> Arabic</div>
1083
- <div><input type="checkbox" name="flag_display_settings[flag-hy]" value="1" <?php checked( 1,$get_flag_choices['flag-hy']); ?>/> Armenian</div>
1084
- <div><input type="checkbox" name="flag_display_settings[flag-az]" value="1" <?php checked( 1,$get_flag_choices['flag-az']); ?>/> Azerbaijani</div>
1085
- <div><input type="checkbox" name="flag_display_settings[flag-eu]" value="1" <?php checked( 1,$get_flag_choices['flag-eu']); ?>/> Basque</div>
1086
- <div><input type="checkbox" name="flag_display_settings[flag-be]" value="1" <?php checked( 1,$get_flag_choices['flag-be']); ?>/> Belarusian</div>
1087
- <div><input type="checkbox" name="flag_display_settings[flag-bn]" value="1" <?php checked( 1,$get_flag_choices['flag-bn']); ?>/> Bengali</div>
1088
- <div><input type="checkbox" name="flag_display_settings[flag-bs]" value="1" <?php checked( 1,$get_flag_choices['flag-bs']); ?>/> Bosnian</div>
1089
- <div><input type="checkbox" name="flag_display_settings[flag-bg]" value="1" <?php checked( 1,$get_flag_choices['flag-bg']); ?>/> Bulgarian</div>
1090
- <div><input type="checkbox" name="flag_display_settings[flag-ca]" value="1" <?php checked( 1,$get_flag_choices['flag-ca']); ?>/> Catalan</div>
1091
- <div><input type="checkbox" name="flag_display_settings[flag-ceb]" value="1" <?php checked( 1,$get_flag_choices['flag-ceb']); ?>/> Cebuano</div>
1092
- <div><input type="checkbox" name="flag_display_settings[flag-zh-CN]" value="1" <?php checked( 1,$get_flag_choices['flag-zh-CN']); ?>/> Chinese</div>
1093
- <div><input type="checkbox" name="flag_display_settings[flag-zh-TW]" value="1" <?php checked( 1,$get_flag_choices['flag-zh-TW']); ?>/> Chinese (Han)</div>
1094
- <div><input type="checkbox" name="flag_display_settings[flag-hr]" value="1" <?php checked( 1,$get_flag_choices['flag-hr']); ?>/> Croatian</div>
1095
- <div><input type="checkbox" name="flag_display_settings[flag-cs]" value="1" <?php checked( 1,$get_flag_choices['flag-cs']); ?>/> Czech</div>
1096
- <div><input type="checkbox" name="flag_display_settings[flag-da]" value="1" <?php checked( 1,$get_flag_choices['flag-da']); ?>/> Danish</div>
1097
- <div><input type="checkbox" name="flag_display_settings[flag-nl]" value="1" <?php checked( 1,$get_flag_choices['flag-nl']); ?>/> Dutch</div>
1098
- <div><input type="checkbox" name="flag_display_settings[flag-en]" value="1" <?php checked(1,$get_flag_choices['flag-en']); ?>/> English</div>
1099
- <div><input type="checkbox" name="flag_display_settings[flag-eo]" value="1" <?php checked( 1,$get_flag_choices['flag-eo']); ?>/> Esperanto</div>
1100
- <div><input type="checkbox" name="flag_display_settings[flag-et]" value="1" <?php checked( 1,$get_flag_choices['flag-et']); ?>/> Estonian</div>
1101
- </div>
1102
-
1103
- <div class="flagdisplay" style="width:25%; float:left">
1104
- <div><input type="checkbox" name="flag_display_settings[flag-tl]" value="1" <?php checked( 1,$get_flag_choices['flag-tl']); ?>/> Filipino</div>
1105
- <div><input type="checkbox" name="flag_display_settings[flag-fi]" value="1" <?php checked( 1,$get_flag_choices['flag-fi']); ?>/> Finnish</div>
1106
- <div><input type="checkbox" name="flag_display_settings[flag-fr]" value="1" <?php checked( 1,$get_flag_choices['flag-fr']); ?>/> French</div>
1107
- <div><input type="checkbox" name="flag_display_settings[flag-gl]" value="1" <?php checked( 1,$get_flag_choices['flag-gl']); ?>/> Galician</div>
1108
- <div><input type="checkbox" name="flag_display_settings[flag-ka]" value="1" <?php checked( 1,$get_flag_choices['flag-ka']); ?>/> Georgian</div>
1109
- <div><input type="checkbox" name="flag_display_settings[flag-de]" value="1" <?php checked( 1,$get_flag_choices['flag-de']); ?>/> German</div>
1110
- <div><input type="checkbox" name="flag_display_settings[flag-el]" value="1" <?php checked( 1,$get_flag_choices['flag-el']); ?>/> Greek</div>
1111
- <div><input type="checkbox" name="flag_display_settings[flag-gu]" value="1" <?php checked( 1,$get_flag_choices['flag-gu']); ?>/> Gujarati</div>
1112
- <div><input type="checkbox" name="flag_display_settings[flag-ht]" value="1" <?php checked( 1,$get_flag_choices['flag-ht']); ?>/> Haitian Creole</div>
1113
- <div><input type="checkbox" name="flag_display_settings[flag-ha]" value="1" <?php checked( 1,$get_flag_choices['flag-ha']); ?>/> Hausa</div>
1114
- <div><input type="checkbox" name="flag_display_settings[flag-iw]" value="1" <?php checked( 1,$get_flag_choices['flag-iw']); ?>/> Hebrew</div>
1115
- <div><input type="checkbox" name="flag_display_settings[flag-hi]" value="1" <?php checked( 1,$get_flag_choices['flag-hi']); ?>/> Hindi</div>
1116
- <div><input type="checkbox" name="flag_display_settings[flag-hmn]" value="1" <?php checked( 1,$get_flag_choices['flag-hmn']); ?>/> Hmong</div>
1117
- <div><input type="checkbox" name="flag_display_settings[flag-hu]" value="1" <?php checked( 1,$get_flag_choices['flag-hu']); ?>/> Hungarian</div>
1118
- <div><input type="checkbox" name="flag_display_settings[flag-is]" value="1" <?php checked( 1,$get_flag_choices['flag-is']); ?>/> Icelandic</div>
1119
- <div><input type="checkbox" name="flag_display_settings[flag-ig]" value="1" <?php checked( 1,$get_flag_choices['flag-ig']); ?>/> Igbo</div>
1120
- <div><input type="checkbox" name="flag_display_settings[flag-id]" value="1" <?php checked( 1,$get_flag_choices['flag-id']); ?>/> Indonesian</div>
1121
- <div><input type="checkbox" name="flag_display_settings[flag-ga]" value="1" <?php checked( 1,$get_flag_choices['flag-ga']); ?>/> Irish</div>
1122
- <div><input type="checkbox" name="flag_display_settings[flag-it]" value="1" <?php checked( 1,$get_flag_choices['flag-it']); ?>/> Italian</div>
1123
- <div><input type="checkbox" name="flag_display_settings[flag-ja]" value="1" <?php checked( 1,$get_flag_choices['flag-ja']); ?>/> Japanese</div>
1124
- <div><input type="checkbox" name="flag_display_settings[flag-jw]" value="1" <?php checked( 1,$get_flag_choices['flag-jw']); ?>/> Javanese</div>
1125
- </div>
1126
-
1127
- <div class="flagdisplay" style="width:25%; float:left">
1128
- <div><input type="checkbox" name="flag_display_settings[flag-kn]" value="1" <?php checked( 1,$get_flag_choices['flag-kn']); ?>/> Kannada</div>
1129
- <div><input type="checkbox" name="flag_display_settings[flag-km]" value="1" <?php checked( 1,$get_flag_choices['flag-km']); ?>/> Khmer</div>
1130
- <div><input type="checkbox" name="flag_display_settings[flag-ko]" value="1" <?php checked( 1,$get_flag_choices['flag-ko']); ?>/> Korean</div>
1131
- <div><input type="checkbox" name="flag_display_settings[flag-lo]" value="1" <?php checked( 1,$get_flag_choices['flag-lo']); ?>/> Lao</div>
1132
- <div><input type="checkbox" name="flag_display_settings[flag-la]" value="1" <?php checked( 1,$get_flag_choices['flag-la']); ?>/> Latin</div>
1133
- <div><input type="checkbox" name="flag_display_settings[flag-lv]" value="1" <?php checked( 1,$get_flag_choices['flag-lv']); ?>/> Latvian</div>
1134
- <div><input type="checkbox" name="flag_display_settings[flag-lt]" value="1" <?php checked( 1,$get_flag_choices['flag-lt']); ?>/> Lithuanian</div>
1135
- <div><input type="checkbox" name="flag_display_settings[flag-mk]" value="1" <?php checked( 1,$get_flag_choices['flag-mk']); ?>/> Macedonian</div>
1136
- <div><input type="checkbox" name="flag_display_settings[flag-ms]" value="1" <?php checked( 1,$get_flag_choices['flag-ms']); ?>/> Malay</div>
1137
- <div><input type="checkbox" name="flag_display_settings[flag-mt]" value="1" <?php checked( 1,$get_flag_choices['flag-mt']); ?>/> Maltese</div>
1138
- <div><input type="checkbox" name="flag_display_settings[flag-mi]" value="1" <?php checked( 1,$get_flag_choices['flag-mi']); ?>/> Maori</div>
1139
- <div><input type="checkbox" name="flag_display_settings[flag-mr]" value="1" <?php checked( 1,$get_flag_choices['flag-mr']); ?>/> Marathi</div>
1140
- <div><input type="checkbox" name="flag_display_settings[flag-mn]" value="1" <?php checked( 1,$get_flag_choices['flag-mn']); ?>/> Mongolian</div>
1141
- <div><input type="checkbox" name="flag_display_settings[flag-ne]" value="1" <?php checked( 1,$get_flag_choices['flag-ne']); ?>/> Nepali</div>
1142
- <div><input type="checkbox" name="flag_display_settings[flag-no]" value="1" <?php checked( 1,$get_flag_choices['flag-no']); ?>/> Norwegian</div>
1143
- <div><input type="checkbox" name="flag_display_settings[flag-fa]" value="1" <?php checked( 1,$get_flag_choices['flag-fa']); ?>/> Persian</div>
1144
- <div><input type="checkbox" name="flag_display_settings[flag-pl]" value="1" <?php checked( 1,$get_flag_choices['flag-pl']); ?>/> Polish</div>
1145
- <div><input type="checkbox" name="flag_display_settings[flag-pt]" value="1" <?php checked( 1,$get_flag_choices['flag-pt']); ?>/> Portuguese</div>
1146
- <div><input type="checkbox" name="flag_display_settings[flag-pa]" value="1" <?php checked( 1,$get_flag_choices['flag-pa']); ?>/> Punjabi</div>
1147
- <div><input type="checkbox" name="flag_display_settings[flag-ro]" value="1" <?php checked( 1,$get_flag_choices['flag-ro']); ?>/> Romanian</div>
1148
- <div><input type="checkbox" name="flag_display_settings[flag-ru]" value="1" <?php checked( 1,$get_flag_choices['flag-ru']); ?>/> Russian</div>
1149
- </div>
1150
-
1151
- <div class="flagdisplay" style="width:25%; float:left">
1152
- <div><input type="checkbox" name="flag_display_settings[flag-sr]" value="1" <?php checked( 1,$get_flag_choices['flag-sr']); ?>/> Serbian</div>
1153
- <div><input type="checkbox" name="flag_display_settings[flag-sk]" value="1" <?php checked( 1,$get_flag_choices['flag-sk']); ?>/> Slovak</div>
1154
- <div><input type="checkbox" name="flag_display_settings[flag-sl]" value="1" <?php checked( 1,$get_flag_choices['flag-sl']); ?>/> Slovenian</div>
1155
- <div><input type="checkbox" name="flag_display_settings[flag-so]" value="1" <?php checked( 1,$get_flag_choices['flag-so']); ?>/> Somali</div>
1156
- <div><input type="checkbox" name="flag_display_settings[flag-es]" value="1" <?php checked( 1,$get_flag_choices['flag-es']); ?>/> Spanish</div>
1157
- <div><input type="checkbox" name="flag_display_settings[flag-sw]" value="1" <?php checked( 1,$get_flag_choices['flag-sw']); ?>/> Swahili</div>
1158
- <div><input type="checkbox" name="flag_display_settings[flag-sv]" value="1" <?php checked( 1,$get_flag_choices['flag-sv']); ?>/> Swedish</div>
1159
- <div><input type="checkbox" name="flag_display_settings[flag-ta]" value="1" <?php checked( 1,$get_flag_choices['flag-ta']); ?>/> Tamil</div>
1160
- <div><input type="checkbox" name="flag_display_settings[flag-te]" value="1" <?php checked( 1,$get_flag_choices['flag-te']); ?>/> Telugu</div>
1161
- <div><input type="checkbox" name="flag_display_settings[flag-th]" value="1" <?php checked( 1,$get_flag_choices['flag-th']); ?>/> Thai</div>
1162
- <div><input type="checkbox" name="flag_display_settings[flag-tr]" value="1" <?php checked( 1,$get_flag_choices['flag-tr']); ?>/> Turkish</div>
1163
- <div><input type="checkbox" name="flag_display_settings[flag-uk]" value="1" <?php checked( 1,$get_flag_choices['flag-uk']); ?>/> Ukranian</div>
1164
- <div><input type="checkbox" name="flag_display_settings[flag-ur]" value="1" <?php checked( 1,$get_flag_choices['flag-ur']); ?>/> Urdu</div>
1165
- <div><input type="checkbox" name="flag_display_settings[flag-vi]" value="1" <?php checked( 1,$get_flag_choices['flag-vi']); ?>/> Vietnamese</div>
1166
- <div><input type="checkbox" name="flag_display_settings[flag-cy]" value="1" <?php checked( 1,$get_flag_choices['flag-cy']); ?>/> Welsh</div>
1167
- <div><input type="checkbox" name="flag_display_settings[flag-yi]" value="1" <?php checked( 1,$get_flag_choices['flag-yi']); ?>/> Yiddish</div>
1168
- <div><input type="checkbox" name="flag_display_settings[flag-yo]" value="1" <?php checked( 1,$get_flag_choices['flag-yo']); ?>/> Yoruba</div>
1169
- <div><input type="checkbox" name="flag_display_settings[flag-zu]" value="1" <?php checked( 1,$get_flag_choices['flag-zu']); ?>/> Zulu</div>
1170
-
1171
- </div>
1172
- <div style="clear:both"></div>
1173
- <?php }
1174
 
1175
- public function googlelanguagetranslator_floating_widget_cb() {
1176
 
1177
  $option_name = 'googlelanguagetranslator_floating_widget' ;
1178
  $new_value = 'yes';
@@ -1405,7 +734,7 @@ class google_language_translator {
1405
  $html = '<input type="checkbox" name="googlelanguagetranslator_multilanguage" id="googlelanguagetranslator_multilanguage" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on multilanguage mode?';
1406
  echo $html;
1407
  }
1408
-
1409
  public function page_layout_cb() {
1410
  include( plugin_dir_path( __FILE__ ) . '/css/style.php'); ?>
1411
  <div class="wrap">
@@ -1506,16 +835,25 @@ class google_language_translator {
1506
  </tr>
1507
 
1508
  <tr class="notranslate">
1509
- <td>Copy/Paste this shortcode if adding to pages/posts:</td>
1510
  <td><code>[google-translator]</code></td>
1511
- </tr>
1512
  </table>
1513
 
1514
  <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1515
  <tr class="notranslate">
1516
- <td style="width:40%">For usage in header/footer:</td>
1517
  <td style="width:60%"><code>&lt;?php echo do_shortcode('[google-translator]'); ?&gt;</code></td>
1518
  </tr>
 
 
 
 
 
 
 
 
 
1519
 
1520
  <tr class="notranslate">
1521
  <td><?php submit_button(); ?></td>
@@ -1576,13 +914,15 @@ class google_language_translator {
1576
  <div class="inside"><a href="http://www.wp-studio.net/" target="_blank"><img style="background:#444; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px" src="<?php echo plugins_url('google-language-translator/images/logo.png'); ?>"></a><br />
1577
  <ul id="features">
1578
  <li>81 Languages</li>
1579
- <li>"Elegant" language switcher theme</li>
1580
- <li>Loads inline with page content</li>
 
 
1581
  <li>Custom flag choices for English, Spanish and Portuguese</li>
1582
- <li>User-friendly URLs, reloads with <code>lang</code> attribute</li>
1583
  <li>Drag/drop flags to re-arrange their order</li>
1584
  <li>Full access to our support forum</li>
1585
- <li>Full access to all future updates</li>
1586
  </ul>
1587
  </div>
1588
  </div>
@@ -1612,5 +952,4 @@ class google_language_translator {
1612
  <?php
1613
  }
1614
  }
1615
-
1616
  $google_language_translator = new google_language_translator();
2
  /*
3
  Plugin Name: Google Language Translator
4
  Plugin URI: http://www.studio88design.com/plugins/google-language-translator
5
+ Version: 4.0.4
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/
12
 
13
  class google_language_translator {
14
 
15
+ public $languages_array = array (
16
+ 'af' => 'Afrikaans','sq' => 'Albanian','ar' => 'Arabic','hy' => 'Armenian','az' => 'Azerbaijani','eu' => 'Basque','be' => 'Belarusian','bn' => 'Bengali','bs' => 'Bosnian','bg' => 'Bulgarian','ca' => 'Catalan','ceb' => 'Cebuano','zh-CN' => 'Chinese(Simplified)','zh-TW' => 'Chinese(Traditional)','hr' => 'Croatian','cs' => 'Czech','da' => 'Danish','nl' => 'Dutch','en' => 'English','eo' => 'Esperanto','et' => 'Estonian','tl' => 'Filipino','fi' => 'Finnish','fr' => 'French','gl' => 'Galician','ka' => 'Georgian','de' => 'German','el' => 'Greek','gu' => 'Gujarati','ht' => 'Haitian','ha' => 'Hausa','iw' => 'Hebrew','hi' => 'Hindi','hmn' => 'Hmong','hu' => 'Hungarian','is' => 'Icelandic','ig' => 'Igbo','id' => 'Indonesian','ga' => 'Irish','it' => 'Italian','ja' => 'Japanese','jw' => 'Javanese','kn' => 'Kannada','km' => 'Khmer','ko' => 'Korean','lo' => 'Lao','la' => 'Latin','lv' => 'Latvian','lt' => 'Lithuanian','mk' => 'Macedonian','ms' => 'Malay','mt' => 'Maltese','mi' => 'Maori','mr' => 'Marathi','mn' => 'Mongolian','ne' => 'Nepali','no' => 'Norwegian','fa' => 'Persian','pl' => 'Polish','pt' => 'Portuguese','pa' => 'Punjabi','ro' => 'Romanian','ru' => 'Russian','sr' => 'Serbian','sk' => 'Slovak','sl' => 'Slovenian','so' => 'Somali','es' => 'Spanish','sw' => 'Swahili','sv' => 'Swedish','ta' => 'Tamil','te' => 'Telugu','th' => 'Thai','tr' => 'Turkish','uk' => 'Ukranian','ur' => 'Urdu','vi' => 'Vietnamese','cy' => 'Welsh','yi' => 'Yiddish','yo' => 'Yoruba','zu' => 'Zulu'
17
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  public function __construct(){
20
  register_activation_hook( __FILE__, array( &$this, 'glt_activate' ));
21
+ register_uninstall_hook( __FILE__, 'glt_deactivate' );
22
+ add_action( 'admin_menu', array( &$this, 'add_my_admin_menus'));
23
  add_action('admin_init',array(&$this, 'initialize_settings'));
24
+ add_action('wp_head',array(&$this, 'load_css'));
25
+ add_action('wp_footer',array(&$this, 'footer_script'));
26
  add_shortcode( 'google-translator',array(&$this, 'google_translator_shortcode'));
27
+ add_shortcode( 'glt', array(&$this, 'google_translator_menu_language'));
28
  add_filter('widget_text','do_shortcode');
29
+ add_filter('walker_nav_menu_start_el', array(&$this,'menu_shortcodes') , 10 , 2);
30
+
31
  if (!is_admin()) {
32
  add_action('init',array(&$this, 'flags'));
33
  }
34
  }
35
 
36
  public function glt_activate() {
37
+ add_option('googlelanguagetranslator_active', 1);
38
+ add_option('googlelanguagetranslator_language','en');
39
+ add_option('googlelanguagetranslator_language_option','all');
40
+ add_option('googlelanguagetranslator_flags','show_flags');
41
+ add_option('language_display_settings',array ('en' => 1));
42
+ add_option('flag_display_settings',array ('flag-en' => 1));
43
+ add_option('googlelanguagetranslator_translatebox','yes');
44
+ add_option('googlelanguagetranslator_display','Vertical');
45
+ add_option('googlelanguagetranslator_toolbar','Yes');
46
+ add_option('googlelanguagetranslator_showbranding','Yes');
47
+ add_option('googlelanguagetranslator_flags_alignment','flags_left');
48
+ add_option('googlelanguagetranslator_analytics',1);
49
+ add_option('googlelanguagetranslator_analytics_id','');
50
+ add_option('googlelanguagetranslator_css','');
51
+ add_option('googlelanguagetranslator_manage_translations',0);
52
+ add_option('googlelanguagetranslator_multilanguage',0);
53
+ add_option('googlelanguagetranslator_floating_widget','yes');
54
+ add_option('googlelanguagetranslator_flag_size','18');
55
+ add_option('googlelanguagetranslator_flags_order','');
56
  }
57
 
58
  public function glt_deactivate() {
59
+ delete_option('googlelanguagetranslator_active', 1);
60
+ delete_option('googlelanguagetranslator_language','en');
61
+ delete_option('googlelanguagetranslator_language_option','all');
62
+ delete_option('googlelanguagetranslator_flags','show_flags');
63
+ delete_option('language_display_settings',array ('en' => 1));
64
+ delete_option('flag_display_settings',array ('flag-en' => 1));
65
+ delete_option('googlelanguagetranslator_translatebox','yes');
66
+ delete_option('googlelanguagetranslator_display','Vertical');
67
+ delete_option('googlelanguagetranslator_toolbar','Yes');
68
+ delete_option('googlelanguagetranslator_showbranding','Yes');
69
+ delete_option('googlelanguagetranslator_flags_alignment','flags_left');
70
+ delete_option('googlelanguagetranslator_analytics',1);
71
+ delete_option('googlelanguagetranslator_analytics_id','');
72
+ delete_option('googlelanguagetranslator_css','');
73
+ delete_option('googlelanguagetranslator_manage_translations',0);
74
+ delete_option('googlelanguagetranslator_multilanguage',0);
75
+ delete_option('googlelanguagetranslator_floating_widget','yes');
76
+ delete_option('googlelanguagetranslator_flag_size','18');
77
+ delete_option('googlelanguagetranslator_flags_order','');
78
  }
79
 
80
  public function add_my_admin_menus(){
85
 
86
  public function load_admin_js(){
87
  add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_admin_js' ));
88
+ add_action('admin_footer',array(&$this, 'footer_script'));
89
  }
90
 
91
  public function enqueue_admin_js(){
92
+ wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
93
+ wp_enqueue_script( 'my-flag-script', plugins_url('js/flags.js',__FILE__), array('jquery'));
94
 
95
  if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
96
  wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
97
  wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
98
+ wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
99
+ wp_enqueue_style( 'toolbar.css' );
100
  }
101
 
102
+ wp_enqueue_script( 'jquery-ui.js', plugins_url('js/jquery-ui.js',__FILE__), array('jquery'));
103
+ wp_enqueue_script( 'jquery-ui-sortable.js', plugins_url('js/jquery-ui-sortable.js',__FILE__), array('jquery'));
104
+ wp_enqueue_script( 'jquery-ui-widget.js', plugins_url('js/jquery-ui-widget.js',__FILE__), array('jquery'));
105
+ wp_enqueue_script( 'jquery-ui-mouse.js', plugins_url('js/jquery-ui-mouse.js',__FILE__), array('jquery'));
106
+ wp_enqueue_script( 'load_sortable_flags', plugins_url('js/load-sortable-flags.js',__FILE__), array('jquery'));
107
+ wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
108
  wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
109
  wp_enqueue_style( 'style.css' );
110
  wp_enqueue_style( 'jquery-ui.css' );
113
  public function flags() {
114
  wp_enqueue_script( 'flags', plugins_url('js/flags.js',__FILE__), array('jquery'));
115
 
116
+ if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
117
+ wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
118
+ wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
119
+ wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
120
+ wp_enqueue_style( 'toolbar.css' );
121
+ }
122
 
123
  wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
124
  wp_enqueue_style( 'style.css' );
125
  }
126
 
127
  public function load_css() {
128
+ include( plugin_dir_path( __FILE__ ) . '/css/style.php');
129
  }
130
 
131
  public function google_translator_shortcode() {
132
  if (get_option('googlelanguagetranslator_display')=='Vertical'){
133
+ return $this->googlelanguagetranslator_vertical();
134
  }
 
135
  elseif(get_option('googlelanguagetranslator_display')=='Horizontal'){
136
+ return $this->googlelanguagetranslator_horizontal();
137
  }
138
  }
139
 
140
  public function googlelanguagetranslator_included_languages() {
141
  if ( get_option('googlelanguagetranslator_language_option')=='specific') {
142
+ $get_language_choices = get_option ('language_display_settings');
 
143
  foreach ($get_language_choices as $key=>$value) {
144
  if($value == 1) {
145
  $items[] = $key;
154
  } elseif ( get_option('googlelanguagetranslator_display') == 'Horizontal') {
155
  $lang = ', includedLanguages:\''.$comma_separated.'\'';
156
  return $lang;
157
+ }
158
  }
159
  }
160
 
165
  return ', '.$analytics;
166
  }
167
  }
168
+
169
+ public function menu_shortcodes( $item_output,$item ) {
170
+ if ( !empty($item->description)) {
171
+ $output = do_shortcode($item->description);
172
+
173
+ if ( $output != $item->description )
174
+ $item_output = $output;
175
+ }
176
+ return $item_output;
177
+ }
178
+
179
+ public function google_translator_menu_language($atts, $content = '') {
180
+ extract(shortcode_atts(array(
181
+ "language" => 'Spanish',
182
+ "translate" => 'yes'
183
+ ), $atts));
184
+
185
+ $default_language = get_option('googlelanguagetranslator_language');
186
+ $language_code = array_search($language,$this->languages_array);
187
+
188
+ return '<a '.($translate=='no' ? 'class="notranslate"' : '').' onclick="doGoogleLanguageTranslator(\''.$default_language.'|'.$language_code.'\'); return false;" title="'.$language.'">'.$language.'</a>';
189
+ }
190
+
191
+ public function footer_script() {
192
+ $language_choices = $this->googlelanguagetranslator_included_languages();
193
+ $layout = get_option('googlelanguagetranslator_display');
194
+ $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
195
+ $horizontal_layout = ', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL';
196
+ $auto_display = ', autoDisplay: false';
197
+ $str = '';
198
+
199
+ if ($is_multilanguage == 1) {
200
+ $multilanguagePage = ', multilanguagePage:true';
201
+ $str.='<script type="text/javascript">
202
+ function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\''.$language_choices . ($layout=='Horizontal' ? $horizontal_layout : '') . $auto_display . $multilanguagePage . $this->analytics().'}, \'google_language_translator\');}</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>';
203
+ echo $str;
204
+
205
+ } elseif ($is_multilanguage == 0) {
206
+
207
+ $str.='<script type="text/javascript">
208
+ function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: \''.get_option('googlelanguagetranslator_language').'\''.$language_choices . ($layout=='Horizontal' ? $horizontal_layout : '') . $auto_display . $this->analytics().'}, \'google_language_translator\');}</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit"></script>';
209
+ echo $str;
210
+ }
211
+ }
212
 
213
  public function googlelanguagetranslator_vertical(){
214
  $get_flag_choices = get_option ('flag_display_settings');
219
  $get_flag_choices_count = count($get_flag_choices);
220
  $get_language_choices = get_option ('language_display_settings');
221
  $flag_width = get_option('googlelanguagetranslator_flag_size');
222
+ $default_language_code = get_option('googlelanguagetranslator_language');
223
+ $is_active = get_option ( 'googlelanguagetranslator_active' );
224
  $get_language_option = get_option('googlelanguagetranslator_language_option');
225
+ $language_choices = $this->googlelanguagetranslator_included_languages();
226
+ $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
227
  $str = '';
228
 
 
229
  if( $is_active == 1){
230
 
231
  foreach ($get_flag_choices as $flag_choice_key) {}
232
 
233
  if ($floating_widget=='yes' && $get_language_option != 'specific') {
234
  $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
235
+ $str.='<div id="glt-toolbar"></div>';
236
  } //endif $floating_widget
237
 
238
  $str.='<div id="flags">';
243
  $language_code = $key;
244
  $language_name = $value;
245
  $language_name_flag = $language_name;
246
+ if ($flag_choice_key == '1') {
247
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
248
+ $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$language_name.'"/></a></li>';
249
+ }
250
+ } //$key
251
+ }//foreach
 
252
  } else {
253
+ foreach ($new_languages_array_codes as $value) {
254
+ $language_name = $value;
255
+ $language_code = array_search ($language_name,$this->languages_array);
256
+ $language_name_flag = $language_name;
 
 
257
  if ($flag_choice_key == '1') {
258
  if (in_array($language_name,$this->languages_array)) {
259
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
260
+ $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$flag_width.'"/></a></li>';
261
+ } //isset
262
  } //in_array
263
+ }//flag_choice_key
264
+ }//foreach
265
+ }//endif
 
266
  $str.='</ul>';
267
+ $str.='</div>';
268
+ $str.='<div id="google_language_translator"></div>';
269
+ return $str;
270
+ } //End is_active
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  } // End glt_vertical
272
 
273
  public function googlelanguagetranslator_horizontal(){
274
  $get_flag_choices = get_option ('flag_display_settings');
275
+ $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
276
+ $new_languages_array = explode(",",$new_languages_array_string);
277
+ $new_languages_array_codes = array_values($new_languages_array);
278
+ $new_languages_array_count = count($new_languages_array);
279
+ $get_flag_choices_count = count($get_flag_choices);
280
+ $get_language_choices = get_option ('language_display_settings');
281
+ $flag_width = get_option('googlelanguagetranslator_flag_size');
282
+ $default_language_code = get_option('googlelanguagetranslator_language');
283
  $is_active = get_option ( 'googlelanguagetranslator_active' );
284
+ $get_language_option = get_option('googlelanguagetranslator_language_option');
285
  $language_choices = $this->googlelanguagetranslator_included_languages();
286
  $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
287
+ $str = '';
288
 
289
  if( $is_active == 1) {
290
  foreach ($get_flag_choices as $flag_choice_key) {}
291
 
292
  if ($floating_widget=='yes' && $get_language_option != 'specific') {
293
+ $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
294
+ $str.='<div id="glt-toolbar"></div>';
295
  } //endif $floating_widget
296
 
297
  $str.='<div id="flags">';
298
  $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
299
 
300
  if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
301
+ foreach ($this->languages_array as $key=>$value) {
302
+ $language_code = $key;
303
+ $language_name = $value;
304
+ $language_name_flag = $language_name;
305
 
306
+ if ($flag_choice_key == '1') {
307
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
308
+ $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$language_name.'"/></a></li>';
309
+ }
310
+ } //$key
311
+ }//foreach
312
+
313
  } else {
 
314
 
315
+ foreach ($new_languages_array_codes as $value) {
316
+ $language_name = $value;
317
+ $language_code = array_search ($language_name,$this->languages_array);
318
+ $language_name_flag = $language_name;
319
+ if ($flag_choice_key == '1') {
320
+ if (in_array($language_name,$this->languages_array)) {
321
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
322
+ $str.='<li id="'.$language_name.'"><a onclick="doGoogleLanguageTranslator(\''.$default_language_code.'|'.$language_code.'\'); return false;" title="'.$language_name.'" class="notranslate flag '.$language_code.'"><img class="flagimg" src="'.plugins_url().'/google-language-translator/images/flags24/'.$language_name_flag.'.png" height="'.$flag_width.'" width="'.$flag_width.'" alt="'.$flag_width.'"/></a></li>';
323
+ } //isset
324
+ } //in_array
325
+ }//flag_choice_key
326
+ }//foreach
327
+ }//endif
 
328
  $str.='</ul>';
329
+ $str.='</div>';
330
+ $str.='<div id="google_language_translator"></div>';
331
+ return $str;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  }
333
  } // End glt_horizontal
334
 
335
+ public function initialize_settings() {
336
+ add_settings_section('glt_settings','Settings','','google_language_translator');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
 
338
+ $settings_name_array = array (
339
+ 'googlelanguagetranslator_active','googlelanguagetranslator_language','googlelanguagetranslator_language_option','language_display_settings','googlelanguagetranslator_flags','flag_display_settings','googlelanguagetranslator_translatebox','googlelanguagetranslator_display','googlelanguagetranslator_toolbar','googlelanguagetranslator_showbranding','googlelanguagetranslator_flags_alignment','googlelanguagetranslator_analytics','googlelanguagetranslator_analytics_id','googlelanguagetranslator_css','googlelanguagetranslator_manage_translations','googlelanguagetranslator_multilanguage','googlelanguagetranslator_floating_widget','googlelanguagetranslator_flag_size','googlelanguagetranslator_flags_order'
340
+ );
341
+
342
+ $settings_callback_array = array ( 'googlelanguagetranslator_active_cb','googlelanguagetranslator_language_cb','googlelanguagetranslator_language_option_cb','language_display_settings_cb','googlelanguagetranslator_flags_cb','flag_display_settings_cb','googlelanguagetranslator_translatebox_cb','googlelanguagetranslator_display_cb','googlelanguagetranslator_toolbar_cb','googlelanguagetranslator_showbranding_cb','googlelanguagetranslator_flags_alignment_cb','googlelanguagetranslator_analytics_cb','googlelanguagetranslator_analytics_id_cb','googlelanguagetranslator_css_cb','googlelanguagetranslator_manage_translations_cb','googlelanguagetranslator_multilanguage_cb','googlelanguagetranslator_floating_widget_cb','googlelanguagetranslator_flag_size_cb','googlelanguagetranslator_flags_order_cb'
343
+ );
344
+
345
+ foreach ($settings_name_array as $setting) {
346
+ add_settings_field( $setting,'',$setting.'_cb','google_language_translator','glt_settings');
347
+ register_setting( 'google_language_translator',$setting);
348
+ }
 
 
 
 
 
 
 
 
 
 
 
349
  }
350
 
351
+ public function googlelanguagetranslator_active_cb() {
352
+ $option_name = 'googlelanguagetranslator_active' ;
 
353
  $new_value = 1;
 
354
  if ( get_option( $option_name ) === false ) {
355
 
356
  // The option does not exist, so we update it.
375
  }
376
 
377
  $options = get_option (''.$option_name.''); ?>
378
+
379
+ <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
380
+
381
+ <?php
382
+
383
+ foreach ($this->languages_array as $key => $value) {
384
+ $language_code = $key;
385
+ $language_name = $value; ?>
386
+ <option value="<?php echo $language_code; ?>" <?php if($options==''.$language_code.''){echo "selected";}?>><?php echo $language_name; ?></option>
387
+ <?php } ?>
388
+ </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  <?php
390
  }
391
 
408
  }
409
 
410
  public function language_display_settings_cb() {
411
+ $default_language_code = get_option('googlelanguagetranslator_language');
412
+ $option_name = 'language_display_settings';
413
+ $new_value = array(''.$default_language_code.'' => 1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
 
415
+ if ( get_option( $option_name ) == false ) {
416
+ // The option does not exist, so we update it.
417
+ update_option( $option_name, $new_value );
418
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
 
420
+ $get_language_choices = get_option (''.$option_name.'');
 
 
 
 
 
 
421
 
422
+ foreach ($this->languages_array as $key => $value) {
423
+ $language_code = $key;
424
+ $language_name = $value;
425
+ $language_code_array[] = $key;
426
+
427
+ if (!isset($get_language_choices[''.$language_code.''])) {
428
+ $get_language_choices[''.$language_code.''] = 0;
429
+ }
430
+
431
+ $items[] = $get_language_choices[''.$language_code.''];
432
+ $language_codes = $language_code_array;
433
+ $item_count = count($items);
434
+
435
+ if ($item_count == 1 || $item_count == 22 || $item_count == 43 || $item_count == 64) { ?>
436
+ <div class="languages" style="width:25%; float:left">
437
+ <?php } ?>
438
+ <div><input type="checkbox" name="language_display_settings[<?php echo $language_code; ?>]" value="1"<?php checked( 1,$get_language_choices[''.$language_code.'']); ?>/><?php echo $language_name; ?></div>
439
+ <?php
440
+ if ($item_count == 21 || $item_count == 42 || $item_count == 63 || $item_count == 81) { ?>
441
+ </div>
442
+ <?php }
443
+ } ?>
444
+ <div class="clear"></div>
445
+ <?php
446
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
 
448
  public function googlelanguagetranslator_flags_cb() {
449
 
464
  }
465
 
466
  public function flag_display_settings_cb() {
467
+ $default_language_code = get_option('googlelanguagetranslator_language');
468
+ $option_name = 'flag_display_settings';
 
469
  $new_value = array('flag-'.$default_language_code.'' => 1);
 
 
 
 
 
 
 
 
470
 
471
+ if ( get_option( $option_name ) == false ) {
472
  // The option does not exist, so we update it.
473
  update_option( $option_name, $new_value );
474
  }
475
 
476
+ $get_flag_choices = get_option (''.$option_name.'');
477
 
478
+ foreach ($this->languages_array as $key => $value) {
479
+ $language_code = $key;
480
+ $language_name = $value;
481
+ $language_code_array[] = $key;
482
+
483
+ if (!isset($get_flag_choices['flag-'.$language_code.''])) {
484
+ $get_flag_choices['flag-'.$language_code.''] = 0;
485
+ }
486
+
487
+ $items[] = $get_flag_choices['flag-'.$language_code.''];
488
+ $language_codes = $language_code_array;
489
+ $item_count = count($items);
490
+
491
+ if ($item_count == 1 || $item_count == 22 || $item_count == 43 || $item_count == 64) { ?>
492
+ <div class="flagdisplay" style="width:25%; float:left">
493
+ <?php } ?>
494
+ <div><input type="checkbox" name="flag_display_settings[flag-<?php echo $language_code; ?>]" value="1"<?php checked( 1,$get_flag_choices['flag-'.$language_code.'']); ?>/><?php echo $language_name; ?></div>
495
+ <?php
496
+ if ($item_count == 21 || $item_count == 42 || $item_count == 63 || $item_count == 81) { ?>
497
+ </div>
498
+ <?php }
499
+ } ?>
500
+ <div class="clear"></div>
501
+ <?php
502
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
 
504
+ public function googlelanguagetranslator_floating_widget_cb() {
505
 
506
  $option_name = 'googlelanguagetranslator_floating_widget' ;
507
  $new_value = 'yes';
734
  $html = '<input type="checkbox" name="googlelanguagetranslator_multilanguage" id="googlelanguagetranslator_multilanguage" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on multilanguage mode?';
735
  echo $html;
736
  }
737
+
738
  public function page_layout_cb() {
739
  include( plugin_dir_path( __FILE__ ) . '/css/style.php'); ?>
740
  <div class="wrap">
835
  </tr>
836
 
837
  <tr class="notranslate">
838
+ <td>Full widget usage in pages/posts/sidebar:</td>
839
  <td><code>[google-translator]</code></td>
840
+ </tr>
841
  </table>
842
 
843
  <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
844
  <tr class="notranslate">
845
+ <td style="width:40%">Full widget usage in header/footer or page template:</td>
846
  <td style="width:60%"><code>&lt;?php echo do_shortcode('[google-translator]'); ?&gt;</code></td>
847
  </tr>
848
+
849
+ <tr class="notranslate">
850
+ <td>Single language usage in<br/>nav menu/pages/posts</td>
851
+ <td><code>[glt language="Spanish" translate="yes"]</code></td>
852
+ </tr>
853
+
854
+ <tr class="notranslate">
855
+ <td colspan="2"><em>For menu usage, use a custom link as your menu item. Enable "descriptions" located in the upper-right corner of "Appearance > Menus". Place shortcode into the "description" field, use <code style="border:none">#</code> for the URL, and create menu title of your choice. </em></td>
856
+ </tr>
857
 
858
  <tr class="notranslate">
859
  <td><?php submit_button(); ?></td>
914
  <div class="inside"><a href="http://www.wp-studio.net/" target="_blank"><img style="background:#444; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px" src="<?php echo plugins_url('google-language-translator/images/logo.png'); ?>"></a><br />
915
  <ul id="features">
916
  <li>81 Languages</li>
917
+ <li>Robust design</li>
918
+ <li>Add single languages to your navigation menu/pages/posts via shortcode</li>
919
+ <li>Show/hide images or text for each language</li>
920
+ <li>Language switcher loads inline with page content</li>
921
  <li>Custom flag choices for English, Spanish and Portuguese</li>
922
+ <li>User-friendly URLs, hide or show <code>lang</code> attribute</li>
923
  <li>Drag/drop flags to re-arrange their order</li>
924
  <li>Full access to our support forum</li>
925
+ <li>FREE access to all future updates</li>
926
  </ul>
927
  </div>
928
  </div>
952
  <?php
953
  }
954
  }
 
955
  $google_language_translator = new google_language_translator();
js/admin.js CHANGED
@@ -85,6 +85,7 @@ jQuery(document).ready(function(){
85
  jQuery('#setting-error-settings_updated').addClass('notranslate');
86
  jQuery('.update-nag').addClass('notranslate');
87
  jQuery('title').addClass('notranslate');
 
88
  });
89
 
90
 
85
  jQuery('#setting-error-settings_updated').addClass('notranslate');
86
  jQuery('.update-nag').addClass('notranslate');
87
  jQuery('title').addClass('notranslate');
88
+ jQuery('#footer-thankyou').addClass('notranslate');
89
  });
90
 
91
 
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.9.1
8
- stable tag: 4.0.3
9
 
10
  Welcome to Google Language Translator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
11
 
@@ -27,6 +27,13 @@ Settings include: inline or vertical layout, show/hide specific languages, hide/
27
 
28
  == Changelog ==
29
 
 
 
 
 
 
 
 
30
  4.0.3
31
 
32
  - Adjusted CSS styles for the flag display.
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.9.1
8
+ stable tag: 4.0.4
9
 
10
  Welcome to Google Language Translator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
11
 
27
 
28
  == Changelog ==
29
 
30
+ 4.0.4
31
+
32
+ - Added NEW shortcode! Allows placement of single languages into the navigation menu, pages, and posts. See settings panel for usage details.
33
+ - Re-factored code in googlelanguagetranslator.php which reduced code to around 950 lines.
34
+ - Removed the "de-activation" hook, which previously deleted options when plugin de-activated. Added "uninstall" hook instead, so that settings will be preserved only when user deletes the plugin completely.
35
+ - Updated CSS styles for the flags area to prevent themes from overriding layouts.
36
+
37
  4.0.3
38
 
39
  - Adjusted CSS styles for the flag display.
widget.php CHANGED
@@ -1,51 +1,39 @@
1
- <?php
2
-
3
- class glt_widget extends WP_Widget {
4
-
5
- function __construct() {
6
- parent::__construct(
7
- 'glt_widget', // Base ID
8
- __('Google Language Translator', 'text_domain'), // Name
9
- array( 'description' => __( 'Add the Google Language Translator website tool.', 'text_domain' ), )
10
- );
11
- }
12
-
13
- public function widget( $args, $instance ) {
14
- $title = apply_filters( 'widget_title', $instance['title'] );
15
- echo $args['before_widget'];
16
- if ( ! empty( $title ) )
17
- echo $args['before_title'] . $title . $args['after_title'];
18
- $google_language_translator_class = new google_language_translator();
19
- $glt_shortcode = $google_language_translator_class->google_translator_shortcode();
20
- echo $glt_shortcode;
21
- echo $args['after_widget'];
22
- }
23
-
24
- public function form( $instance ) {
25
- if ( isset( $instance[ 'title' ] ) ) {
26
- $title = $instance[ 'title' ];
27
- }
28
- else {
29
- $title = __( 'Translate:', 'text_domain' );
30
- }
31
- ?>
32
- <p>
33
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
34
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
35
- </p>
36
- <?php
37
- }
38
-
39
- public function update( $new_instance, $old_instance ) {
40
- $instance = array();
41
- $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
42
-
43
- return $instance;
44
- }
45
-
46
- } // class glt_widget
47
-
48
- function register_foo_widget() {
49
- register_widget( 'glt_widget' );
50
- }
51
- add_action( 'widgets_init', 'register_foo_widget' );
1
+ <?php
2
+ class glt_widget extends WP_Widget {
3
+ function __construct() {
4
+ parent::__construct(
5
+ 'glt_widget', __('Google Language Translator', 'text_domain'), array( 'description' => __( 'Add the Google Language Translator website tool.', 'text_domain' ), )
6
+ );
7
+ }
8
+
9
+ public function widget( $args, $instance ) {
10
+ $title = apply_filters( 'widget_title', $instance['title'] );
11
+ echo $args['before_widget'];
12
+ if ( ! empty( $title ) )
13
+ echo $args['before_title'] . $title . $args['after_title'];
14
+ echo do_shortcode('[google-translator]');
15
+ echo $args['after_widget'];
16
+ }
17
+
18
+ public function form( $instance ) {
19
+ if ( isset( $instance[ 'title' ] ) ) {
20
+ $title = $instance[ 'title' ];
21
+ } else {
22
+ $title = __( 'Translate:', 'text_domain' );
23
+ } ?>
24
+
25
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label><input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"></p>
26
+ <?php
27
+ }
28
+
29
+ public function update( $new_instance, $old_instance ) {
30
+ $instance = array();
31
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
32
+ return $instance;
33
+ }
34
+ } // class glt_widget
35
+
36
+ function register_glt_widget() {
37
+ register_widget( 'glt_widget' );
38
+ }
39
+ add_action( 'widgets_init', 'register_glt_widget' );