Google Language Translator - Version 4.0.8

Version Description

Download this release

Release Info

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

Code changes from version 4.0.7 to 4.0.8

Files changed (2) hide show
  1. google-language-translator.php +1224 -1224
  2. readme.txt +4 -1
google-language-translator.php CHANGED
@@ -1,1225 +1,1225 @@
1
- <?php
2
- /*
3
- Plugin Name: Google Language Translator
4
- Plugin URI: http://www.studio88design.com/plugins/google-language-translator
5
- Version: 4.0.7
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.wp-studio.net/
9
- */
10
-
11
- 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_uninstall_hook( __FILE__, '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_action('wp_footer',array(&$this, 'footer_script'));
106
- add_shortcode( 'google-translator',array(&$this, 'google_translator_shortcode'));
107
- add_shortcode( 'glt', array(&$this, 'google_translator_menu_language'));
108
- add_filter('widget_text','do_shortcode');
109
- add_filter('walker_nav_menu_start_el', array(&$this,'menu_shortcodes') , 10 , 2);
110
- add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'glt_settings_link') );
111
-
112
- if (!is_admin()) {
113
- add_action('init',array(&$this, 'flags'));
114
- }
115
- }
116
-
117
- public function glt_activate() {
118
- add_option('googlelanguagetranslator_active', 1);
119
- add_option('googlelanguagetranslator_language','en');
120
- add_option('googlelanguagetranslator_language_option','all');
121
- add_option('googlelanguagetranslator_flags','show_flags');
122
- add_option('language_display_settings',array ('en' => 1));
123
- add_option('flag_display_settings',array ('flag-en' => 1));
124
- add_option('googlelanguagetranslator_translatebox','yes');
125
- add_option('googlelanguagetranslator_display','Vertical');
126
- add_option('googlelanguagetranslator_toolbar','Yes');
127
- add_option('googlelanguagetranslator_showbranding','Yes');
128
- add_option('googlelanguagetranslator_flags_alignment','flags_left');
129
- add_option('googlelanguagetranslator_analytics', 0);
130
- add_option('googlelanguagetranslator_analytics_id','');
131
- add_option('googlelanguagetranslator_css','');
132
- add_option('googlelanguagetranslator_manage_translations',0);
133
- add_option('googlelanguagetranslator_multilanguage',0);
134
- add_option('googlelanguagetranslator_floating_widget','yes');
135
- add_option('googlelanguagetranslator_flag_size','18');
136
- add_option('googlelanguagetranslator_flags_order','');
137
- }
138
-
139
- public function glt_deactivate() {
140
- delete_option('googlelanguagetranslator_active', 1);
141
- delete_option('googlelanguagetranslator_language','en');
142
- delete_option('googlelanguagetranslator_language_option','all');
143
- delete_option('googlelanguagetranslator_flags','show_flags');
144
- delete_option('language_display_settings',array ('en' => 1));
145
- delete_option('flag_display_settings',array ('flag-en' => 1));
146
- delete_option('googlelanguagetranslator_translatebox','yes');
147
- delete_option('googlelanguagetranslator_display','Vertical');
148
- delete_option('googlelanguagetranslator_toolbar','Yes');
149
- delete_option('googlelanguagetranslator_showbranding','Yes');
150
- delete_option('googlelanguagetranslator_flags_alignment','flags_left');
151
- delete_option('googlelanguagetranslator_analytics',1);
152
- delete_option('googlelanguagetranslator_analytics_id','');
153
- delete_option('googlelanguagetranslator_css','');
154
- delete_option('googlelanguagetranslator_manage_translations',0);
155
- delete_option('googlelanguagetranslator_multilanguage',0);
156
- delete_option('googlelanguagetranslator_floating_widget','yes');
157
- delete_option('googlelanguagetranslator_flag_size','18');
158
- delete_option('googlelanguagetranslator_flags_order','');
159
- }
160
-
161
- public function glt_settings_link ( $links ) {
162
- $settings_link = array(
163
- '<a href="' . admin_url( 'options-general.php?page=google_language_translator' ) . '">Settings</a>',
164
- );
165
- return array_merge( $links, $settings_link );
166
- }
167
-
168
- public function add_my_admin_menus(){
169
- $p = add_options_page('Google Language Translator', 'Google Language Translator', 'manage_options', 'google_language_translator', array(&$this, 'page_layout_cb'));
170
-
171
- add_action( 'load-' . $p, array(&$this, 'load_admin_js' ));
172
- }
173
-
174
- public function load_admin_js(){
175
- add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_admin_js' ));
176
- add_action('admin_footer',array(&$this, 'footer_script'));
177
- }
178
-
179
- public function enqueue_admin_js(){
180
- wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
181
- wp_enqueue_script( 'my-flag-script', plugins_url('js/flags.js',__FILE__), array('jquery'));
182
-
183
- if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
184
- wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
185
- wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
186
- wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
187
- wp_enqueue_style( 'toolbar.css' );
188
- }
189
-
190
- wp_enqueue_script( 'jquery-ui.js', plugins_url('js/jquery-ui.js',__FILE__), array('jquery'));
191
- wp_enqueue_script( 'jquery-ui-sortable.js', plugins_url('js/jquery-ui-sortable.js',__FILE__), array('jquery'));
192
- wp_enqueue_script( 'jquery-ui-widget.js', plugins_url('js/jquery-ui-widget.js',__FILE__), array('jquery'));
193
- wp_enqueue_script( 'jquery-ui-mouse.js', plugins_url('js/jquery-ui-mouse.js',__FILE__), array('jquery'));
194
- wp_enqueue_script( 'load_sortable_flags', plugins_url('js/load-sortable-flags.js',__FILE__), array('jquery'));
195
- wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
196
- wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
197
- wp_enqueue_style( 'style.css' );
198
- wp_enqueue_style( 'jquery-ui.css' );
199
- }
200
-
201
- public function flags() {
202
- wp_enqueue_script( 'flags', plugins_url('js/flags.js',__FILE__), array('jquery'));
203
-
204
- if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
205
- wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
206
- wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
207
- wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
208
- wp_enqueue_style( 'toolbar.css' );
209
- }
210
-
211
- wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
212
- wp_enqueue_style( 'style.css' );
213
- }
214
-
215
- public function load_css() {
216
- include( plugin_dir_path( __FILE__ ) . '/css/style.php');
217
- }
218
-
219
- public function google_translator_shortcode() {
220
-
221
- if (get_option('googlelanguagetranslator_display')=='Vertical'){
222
- return $this->googlelanguagetranslator_vertical();
223
- }
224
- elseif(get_option('googlelanguagetranslator_display')=='Horizontal'){
225
- return $this->googlelanguagetranslator_horizontal();
226
- }
227
- }
228
-
229
- public function googlelanguagetranslator_included_languages() {
230
- if ( get_option('googlelanguagetranslator_language_option')=='specific') {
231
- $get_language_choices = get_option ('language_display_settings');
232
-
233
- foreach ($get_language_choices as $key=>$value) {
234
- if($value == 1) {
235
- $items[] = $key;
236
- }
237
- }
238
-
239
- $comma_separated = implode(",",array_values($items));
240
-
241
- if ( get_option('googlelanguagetranslator_display') == 'Vertical') {
242
- $lang = ", includedLanguages:'".$comma_separated."'";
243
- return $lang;
244
- } elseif ( get_option('googlelanguagetranslator_display') == 'Horizontal') {
245
- $lang = ", includedLanguages:'".$comma_separated."'";
246
- return $lang;
247
- }
248
- }
249
- }
250
-
251
- public function analytics() {
252
- if ( get_option('googlelanguagetranslator_analytics') == 1 ) {
253
- $analytics_id = get_option('googlelanguagetranslator_analytics_id');
254
- $analytics = 'gaTrack: true, gaId: '.$analytics_id.'';
255
-
256
- if (!empty ($analytics_id) ):
257
- return ', '.$analytics;
258
- endif;
259
- }
260
- }
261
-
262
- public function menu_shortcodes( $item_output,$item ) {
263
- if ( !empty($item->description)) {
264
- $output = do_shortcode($item->description);
265
-
266
- if ( $output != $item->description )
267
- $item_output = $output;
268
- }
269
- return $item_output;
270
- }
271
-
272
- public function google_translator_menu_language($atts, $content = '') {
273
- extract(shortcode_atts(array(
274
- "language" => 'Spanish',
275
- "label" => 'Spanish'
276
- ), $atts));
277
-
278
- $default_language = get_option('googlelanguagetranslator_language');
279
- $language_code = array_search($language,$this->languages_array);
280
-
281
- return "<a class='nturl notranslate ".$language_code." single-language flag' title='".$language."'>".$label."</a>";
282
- }
283
-
284
- public function footer_script() {
285
-
286
- global $shortcode_started;
287
-
288
- if (!$shortcode_started):
289
- //echo 'shortcode not loaded';
290
- else:
291
- //echo 'true';
292
- endif;
293
-
294
-
295
-
296
- $default_language = get_option('googlelanguagetranslator_language');
297
- $language_choices = $this->googlelanguagetranslator_included_languages();
298
- $get_language_option = get_option('googlelanguagetranslator_language_option');
299
- $get_flag_choices = get_option ('flag_display_settings');
300
- $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
301
- $is_active = get_option ( 'googlelanguagetranslator_active' );
302
- $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
303
- $auto_display = ', autoDisplay: false';
304
- $str = ''; ?>
305
-
306
- <script>
307
- jQuery(document).ready(function($) {
308
- $("a.nturl").on("click",function() {
309
- default_lang = "<?php echo get_option('googlelanguagetranslator_language'); ?>";
310
- lang_prefix = $(this).attr("class").split(" ")[2];
311
-
312
- if (lang_prefix == default_lang) {
313
- load_default();
314
- } else {
315
- load_selected_language();
316
- }
317
-
318
- function load_default() {
319
- doGoogleLanguageTranslator(default_lang + "|" + default_lang);
320
- }
321
-
322
- function load_selected_language() {
323
- doGoogleLanguageTranslator(default_lang + "|" + lang_prefix);
324
- }
325
- });
326
-
327
- $("a.flag").on("click",function() {
328
- default_lang = "<?php echo get_option('googlelanguagetranslator_language'); ?>";
329
- lang_prefix = $(this).attr("class").split(" ")[2];
330
-
331
- if (lang_prefix == default_lang) {
332
- load_default();
333
- } else {
334
- load_selected_language();
335
- }
336
-
337
- function load_default() {
338
- doGoogleLanguageTranslator(default_lang + "|" + default_lang);
339
- }
340
-
341
- function load_selected_language() {
342
- doGoogleLanguageTranslator(default_lang + "|" + lang_prefix);
343
- }
344
- });
345
-
346
-
347
- var glt_id = 'google_language_translator';
348
-
349
- if ($ ("#" + glt_id).length == 0) {
350
- $("#glt-footer").html("<div id='google_language_translator'></div>");
351
- }
352
- });
353
- </script>
354
-
355
- <?php
356
-
357
- if( $is_active == 1) {
358
- if ($shortcode_started != 'true') {
359
-
360
- foreach ($get_flag_choices as $flag_choice_key) {}
361
-
362
- if ($floating_widget=='yes' && $get_language_option != 'specific' && !is_admin()) {
363
- $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
364
- $str.='<div id="glt-toolbar"></div>';
365
- } //endif $floating_widget
366
-
367
- $str.='<div id="flags" style="display:none">';
368
- $str.='<ul id="sortable" class="ui-sortable">';
369
-
370
- if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
371
- foreach ($this->languages_array as $key=>$value) {
372
- $language_code = $key;
373
- $language_name = $value;
374
- $language_name_flag = $language_name;
375
- if ($flag_choice_key == '1') {
376
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
377
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
378
- $language_name_flag = 'Canada';
379
- }
380
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
381
- $language_name_flag = 'United-States';
382
- }
383
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
384
- $language_name_flag = 'Mexico';
385
- }
386
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
387
- $language_name_flag = 'Brazil';
388
- }
389
-
390
- if ($lang_attribute == 'yes') {
391
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="notranslate flag '.$language_code.'"></a></li>';
392
- } else {
393
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
394
- }
395
- }
396
- } //$key
397
- }//foreach
398
- } else {
399
- foreach ($new_languages_array_codes as $value) {
400
- $language_name = $value;
401
- $language_code = array_search ($language_name,$this->languages_array);
402
- $language_name_flag = $language_name;
403
- if ($flag_choice_key == '1') {
404
- if (in_array($language_name,$this->languages_array)) {
405
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
406
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
407
- $language_name_flag = 'Canada';
408
- }
409
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
410
- $language_name_flag = 'United-States';
411
- }
412
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
413
- $language_name_flag = 'Mexico';
414
- }
415
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
416
- $language_name_flag = 'Brazil';
417
- }
418
-
419
- if ($lang_attribute == 'yes') {
420
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="notranslate flag '.$language_code.'"></a></li>';
421
- } else {
422
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
423
- }
424
- } //isset
425
- } //in_array
426
- }//flag_choice_key
427
- }//foreach
428
- }//endif
429
- $str.='</ul>';
430
- $str.='</div>';
431
- }
432
- }
433
-
434
- $language_choices = $this->googlelanguagetranslator_included_languages();
435
- $layout = get_option('googlelanguagetranslator_display');
436
- $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
437
- $horizontal_layout = ', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL';
438
- $auto_display = ', autoDisplay: false';
439
- $default_language = get_option('googlelanguagetranslator_language');
440
-
441
- if ($is_multilanguage == 1) {
442
- $multilanguagePage = ', multilanguagePage:true';
443
- $str.="<div id='glt-footer'></div><script type='text/javascript'>";
444
- $str.="function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : '') . $auto_display . $multilanguagePage . $this->analytics()."}, 'google_language_translator');}</script>";
445
- $str.="<script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit'></script>";
446
- echo $str;
447
-
448
- } elseif ($is_multilanguage == 0) {
449
- $str.="<div id='glt-footer'></div><script type='text/javascript'>";
450
- $str.="function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : '') . $auto_display . $this->analytics()."}, 'google_language_translator');}</script>";
451
- $str.="<script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit'></script>";
452
- echo $str;
453
- }
454
- }
455
-
456
- public function googlelanguagetranslator_vertical() {
457
-
458
- global $shortcode_started;
459
-
460
- $shortcode_started = 'true';
461
- $get_flag_choices = get_option ('flag_display_settings');
462
- $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
463
- $new_languages_array = explode(",",$new_languages_array_string);
464
- $new_languages_array_codes = array_values($new_languages_array);
465
- $new_languages_array_count = count($new_languages_array);
466
- $get_flag_choices_count = count($get_flag_choices);
467
- $get_language_choices = get_option ('language_display_settings');
468
- $flag_width = get_option('googlelanguagetranslator_flag_size');
469
- $default_language_code = get_option('googlelanguagetranslator_language');
470
- $is_active = get_option ( 'googlelanguagetranslator_active' );
471
- $get_language_option = get_option('googlelanguagetranslator_language_option');
472
- $language_choices = $this->googlelanguagetranslator_included_languages();
473
- $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
474
- $str = '';
475
-
476
- if( $is_active == 1){
477
-
478
- foreach ($get_flag_choices as $flag_choice_key) {}
479
-
480
- if ($floating_widget=='yes' && $get_language_option != 'specific') {
481
- $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
482
- $str.='<div id="glt-toolbar"></div>';
483
- } //endif $floating_widget
484
-
485
- $str.='<div id="flags" class="size'.$flag_width.'">';
486
- $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
487
-
488
- if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
489
- foreach ($this->languages_array as $key=>$value) {
490
- $language_code = $key;
491
- $language_name = $value;
492
- $language_name_flag = $language_name;
493
- if ($flag_choice_key == '1') {
494
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
495
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
496
- }
497
- } //$key
498
- }//foreach
499
- } else {
500
- foreach ($new_languages_array_codes as $value) {
501
- $language_name = $value;
502
- $language_code = array_search ($language_name,$this->languages_array);
503
- $language_name_flag = $language_name;
504
- if ($flag_choice_key == '1') {
505
- if (in_array($language_name,$this->languages_array)) {
506
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
507
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
508
- } //isset
509
- } //in_array
510
- }//flag_choice_key
511
- }//foreach
512
- }//endif
513
- $str.='</ul>';
514
- $str.='</div>';
515
- $str.='<div id="google_language_translator"></div>';
516
- return $str;
517
- } //End is_active
518
- } // End glt_vertical
519
-
520
- public function googlelanguagetranslator_horizontal(){
521
- $shortcode_started = true;
522
- $get_flag_choices = get_option ('flag_display_settings');
523
- $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
524
- $new_languages_array = explode(",",$new_languages_array_string);
525
- $new_languages_array_codes = array_values($new_languages_array);
526
- $new_languages_array_count = count($new_languages_array);
527
- $get_flag_choices_count = count($get_flag_choices);
528
- $get_language_choices = get_option ('language_display_settings');
529
- $flag_width = get_option('googlelanguagetranslator_flag_size');
530
- $default_language_code = get_option('googlelanguagetranslator_language');
531
- $is_active = get_option ( 'googlelanguagetranslator_active' );
532
- $get_language_option = get_option('googlelanguagetranslator_language_option');
533
- $language_choices = $this->googlelanguagetranslator_included_languages();
534
- $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
535
- $str = '';
536
-
537
- if( $is_active == 1) {
538
- foreach ($get_flag_choices as $flag_choice_key) {}
539
-
540
- if ($floating_widget=='yes' && $get_language_option != 'specific') {
541
-
542
- $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
543
- $str.='<div id="glt-toolbar"></div>';
544
- } //endif $floating_widget
545
-
546
- $str.='<div id="flags" class="size'.$flag_width.'">';
547
- $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
548
-
549
- if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
550
- foreach ($this->languages_array as $key=>$value) {
551
- $language_code = $key;
552
- $language_name = $value;
553
- $language_name_flag = $language_name;
554
-
555
- if ($flag_choice_key == '1') {
556
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
557
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
558
- }
559
- } //$key
560
- }//foreach
561
-
562
- } else {
563
-
564
- foreach ($new_languages_array_codes as $value) {
565
- $language_name = $value;
566
- $language_code = array_search ($language_name,$this->languages_array);
567
- $language_name_flag = $language_name;
568
- if ($flag_choice_key == '1') {
569
- if (in_array($language_name,$this->languages_array)) {
570
- if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
571
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
572
- } //isset
573
- } //in_array
574
- }//flag_choice_key
575
- }//foreach
576
- }//endif
577
- $str.='</ul>';
578
- $str.='</div>';
579
- $str.='<div id="google_language_translator"></div>';
580
- return $str;
581
- }
582
- } // End glt_horizontal
583
-
584
- public function initialize_settings() {
585
- add_settings_section('glt_settings','Settings','','google_language_translator');
586
-
587
- $settings_name_array = array (
588
- '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','googlelanguagetranslator_exclude_translation'
589
- );
590
-
591
- $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','googlelanguagetranslator_exclude_translation_cb'
592
- );
593
-
594
- foreach ($settings_name_array as $setting) {
595
- add_settings_field( $setting,'',$setting.'_cb','google_language_translator','glt_settings');
596
- register_setting( 'google_language_translator',$setting);
597
- }
598
- }
599
-
600
- public function googlelanguagetranslator_active_cb() {
601
- $option_name = 'googlelanguagetranslator_active' ;
602
- $new_value = 1;
603
- if ( get_option( $option_name ) === false ) {
604
-
605
- // The option does not exist, so we update it.
606
- update_option( $option_name, $new_value );
607
- }
608
-
609
- $options = get_option (''.$option_name.'');
610
-
611
- $html = '<input type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" '.checked(1,$options,false).'/> &nbsp; Check this box to activate';
612
- echo $html;
613
- }
614
-
615
- public function googlelanguagetranslator_language_cb() {
616
-
617
- $option_name = 'googlelanguagetranslator_language';
618
- $new_value = 'en';
619
-
620
- if ( get_option( $option_name ) === false ) {
621
-
622
- // The option does not exist, so we update it.
623
- update_option( $option_name, $new_value );
624
- }
625
-
626
- $options = get_option (''.$option_name.''); ?>
627
-
628
- <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
629
-
630
- <?php
631
-
632
- foreach ($this->languages_array as $key => $value) {
633
- $language_code = $key;
634
- $language_name = $value; ?>
635
- <option value="<?php echo $language_code; ?>" <?php if($options==''.$language_code.''){echo "selected";}?>><?php echo $language_name; ?></option>
636
- <?php } ?>
637
- </select>
638
- <?php
639
- }
640
-
641
- public function googlelanguagetranslator_language_option_cb() {
642
-
643
- $option_name = 'googlelanguagetranslator_language_option' ;
644
- $new_value = 'all';
645
-
646
- if ( get_option( $option_name ) === false ) {
647
-
648
- // The option does not exist, so we update it.
649
- update_option( $option_name, $new_value );
650
- }
651
-
652
- $options = get_option (''.$option_name.''); ?>
653
-
654
- <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="all" <?php if($options=='all'){echo "checked";}?>/> All Languages<br/>
655
- <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="specific" <?php if($options=='specific'){echo "checked";}?>/> Specific Languages
656
- <?php
657
- }
658
-
659
- public function language_display_settings_cb() {
660
- $default_language_code = get_option('googlelanguagetranslator_language');
661
- $option_name = 'language_display_settings';
662
- $new_value = array(''.$default_language_code.'' => 1);
663
-
664
- if ( get_option( $option_name ) == false ) {
665
- // The option does not exist, so we update it.
666
- update_option( $option_name, $new_value );
667
- }
668
-
669
- $get_language_choices = get_option (''.$option_name.'');
670
-
671
- foreach ($this->languages_array as $key => $value) {
672
- $language_code = $key;
673
- $language_name = $value;
674
- $language_code_array[] = $key;
675
-
676
- if (!isset($get_language_choices[''.$language_code.''])) {
677
- $get_language_choices[''.$language_code.''] = 0;
678
- }
679
-
680
- $items[] = $get_language_choices[''.$language_code.''];
681
- $language_codes = $language_code_array;
682
- $item_count = count($items);
683
-
684
- if ($item_count == 1 || $item_count == 22 || $item_count == 43 || $item_count == 64) { ?>
685
- <div class="languages" style="width:25%; float:left">
686
- <?php } ?>
687
- <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>
688
- <?php
689
- if ($item_count == 21 || $item_count == 42 || $item_count == 63 || $item_count == 81) { ?>
690
- </div>
691
- <?php }
692
- } ?>
693
- <div class="clear"></div>
694
- <?php
695
- }
696
-
697
- public function googlelanguagetranslator_flags_cb() {
698
-
699
- $option_name = 'googlelanguagetranslator_flags' ;
700
- $new_value = 'show_flags';
701
-
702
- if ( get_option( $option_name ) === false ) {
703
-
704
- // The option does not exist, so we update it.
705
- update_option( $option_name, $new_value );
706
- }
707
-
708
- $options = get_option (''.$option_name.''); ?>
709
-
710
- <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="show_flags" <?php if($options=='show_flags'){echo "checked";}?>/> Yes, show flag images<br/>
711
- <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="hide_flags" <?php if($options=='hide_flags'){echo "checked";}?>/> No, hide flag images
712
- <?php
713
- }
714
-
715
- public function flag_display_settings_cb() {
716
- $default_language_code = get_option('googlelanguagetranslator_language');
717
- $option_name = 'flag_display_settings';
718
- $new_value = array('flag-'.$default_language_code.'' => 1);
719
-
720
- if ( get_option( $option_name ) == false ) {
721
- // The option does not exist, so we update it.
722
- update_option( $option_name, $new_value );
723
- }
724
-
725
- $get_flag_choices = get_option (''.$option_name.'');
726
-
727
- foreach ($this->languages_array as $key => $value) {
728
- $language_code = $key;
729
- $language_name = $value;
730
- $language_code_array[] = $key;
731
-
732
- if (!isset($get_flag_choices['flag-'.$language_code.''])) {
733
- $get_flag_choices['flag-'.$language_code.''] = 0;
734
- }
735
-
736
- $items[] = $get_flag_choices['flag-'.$language_code.''];
737
- $language_codes = $language_code_array;
738
- $item_count = count($items);
739
-
740
- if ($item_count == 1 || $item_count == 22 || $item_count == 43 || $item_count == 64) { ?>
741
- <div class="flagdisplay" style="width:25%; float:left">
742
- <?php } ?>
743
- <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>
744
- <?php
745
- if ($item_count == 21 || $item_count == 42 || $item_count == 63 || $item_count == 81) { ?>
746
- </div>
747
- <?php }
748
- } ?>
749
- <div class="clear"></div>
750
- <?php
751
- }
752
-
753
- public function googlelanguagetranslator_floating_widget_cb() {
754
-
755
- $option_name = 'googlelanguagetranslator_floating_widget' ;
756
- $new_value = 'yes';
757
-
758
- if ( get_option( $option_name ) === false ) {
759
-
760
- // The option does not exist, so we update it.
761
- update_option( $option_name, $new_value );
762
- }
763
-
764
- $options = get_option (''.$option_name.''); ?>
765
-
766
- <select name="googlelanguagetranslator_floating_widget" id="googlelanguagetranslator_floating_widget" style="width:170px">
767
- <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Yes, show widget</option>
768
- <option value="no" <?php if($options=='no'){echo "selected";}?>>No, hide widget</option>
769
- </select>
770
- <?php }
771
-
772
- public function googlelanguagetranslator_translatebox_cb() {
773
-
774
- $option_name = 'googlelanguagetranslator_translatebox' ;
775
- $new_value = 'yes';
776
-
777
- if ( get_option( $option_name ) === false ) {
778
-
779
- // The option does not exist, so we update it.
780
- update_option( $option_name, $new_value );
781
- }
782
-
783
- $options = get_option (''.$option_name.''); ?>
784
-
785
- <select name="googlelanguagetranslator_translatebox" id="googlelanguagetranslator_translatebox" style="width:190px">
786
- <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Yes, show language box</option>
787
- <option value="no" <?php if($options=='no'){echo "selected";}?>>No, hide language box</option>
788
- </select>
789
- <?php }
790
-
791
- public function googlelanguagetranslator_display_cb() {
792
-
793
- $option_name = 'googlelanguagetranslator_display' ;
794
- $new_value = 'Vertical';
795
-
796
- if ( get_option( $option_name ) === false ) {
797
-
798
- // The option does not exist, so we update it.
799
- update_option( $option_name, $new_value );
800
- }
801
-
802
- $options = get_option (''.$option_name.''); ?>
803
-
804
- <select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:170px;">
805
- <option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
806
- <option value="Horizontal" <?php if(get_option('googlelanguagetranslator_display')=='Horizontal'){echo "selected";}?>>Horizontal</option>
807
- </select>
808
- <?php }
809
-
810
- public function googlelanguagetranslator_toolbar_cb() {
811
-
812
- $option_name = 'googlelanguagetranslator_toolbar' ;
813
- $new_value = 'Yes';
814
-
815
- if ( get_option( $option_name ) === false ) {
816
-
817
- // The option does not exist, so we update it.
818
- update_option( $option_name, $new_value );
819
- }
820
-
821
- $options = get_option (''.$option_name.''); ?>
822
-
823
- <select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:170px;">
824
- <option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
825
- <option value="No" <?php if(get_option('googlelanguagetranslator_toolbar')=='No'){echo "selected";}?>>No</option>
826
- </select>
827
- <?php }
828
-
829
- public function googlelanguagetranslator_showbranding_cb() {
830
-
831
- $option_name = 'googlelanguagetranslator_showbranding' ;
832
- $new_value = 'Yes';
833
-
834
- if ( get_option( $option_name ) === false ) {
835
-
836
- // The option does not exist, so we update it.
837
- update_option( $option_name, $new_value );
838
- }
839
-
840
- $options = get_option (''.$option_name.''); ?>
841
-
842
- <select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:170px;">
843
- <option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
844
- <option value="No" <?php if(get_option('googlelanguagetranslator_showbranding')=='No'){echo "selected";}?>>No</option>
845
- </select>
846
- <?php }
847
-
848
- public function googlelanguagetranslator_flags_alignment_cb() {
849
-
850
- $option_name = 'googlelanguagetranslator_flags_alignment' ;
851
- $new_value = 'flags_left';
852
-
853
- if ( get_option( $option_name ) === false ) {
854
-
855
- // The option does not exist, so we update it.
856
- update_option( $option_name, 'flags_left' );
857
- }
858
-
859
- $options = get_option (''.$option_name.''); ?>
860
-
861
- <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_left" value="flags_left" <?php if($options=='flags_left'){echo "checked";}?>/> Align Left<br/>
862
- <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_right" value="flags_right" <?php if($options=='flags_right'){echo "checked";}?>/> Align Right
863
- <?php }
864
-
865
- public function googlelanguagetranslator_analytics_cb() {
866
-
867
- $option_name = 'googlelanguagetranslator_analytics' ;
868
- $new_value = 0;
869
-
870
- if ( get_option( $option_name ) === false ) {
871
-
872
- // The option does not exist, so we update it.
873
- update_option( $option_name, $new_value );
874
- }
875
-
876
- $options = get_option (''.$option_name.'');
877
-
878
- $html = '<input type="checkbox" name="googlelanguagetranslator_analytics" id="googlelanguagetranslator_analytics" value="1" '.checked(1,$options,false).'/> &nbsp; Activate Google Analytics tracking?';
879
- echo $html;
880
- }
881
-
882
- public function googlelanguagetranslator_analytics_id_cb() {
883
-
884
- $option_name = 'googlelanguagetranslator_analytics_id' ;
885
- $new_value = '';
886
-
887
- if ( get_option( $option_name ) === false ) {
888
-
889
- // The option does not exist, so we update it.
890
- update_option( $option_name, $new_value );
891
- }
892
-
893
- $options = get_option (''.$option_name.'');
894
-
895
- $html = '<input type="text" name="googlelanguagetranslator_analytics_id" id="googlelanguagetranslator_analytics_id" value="'.$options.'" />';
896
- echo $html;
897
- }
898
-
899
- public function googlelanguagetranslator_flag_size_cb() {
900
-
901
- $option_name = 'googlelanguagetranslator_flag_size' ;
902
- $new_value = '18';
903
-
904
- if ( get_option( $option_name ) === false ) {
905
-
906
- // The option does not exist, so we update it.
907
- update_option( $option_name, $new_value );
908
- }
909
-
910
- $options = get_option (''.$option_name.''); ?>
911
-
912
- <select name="googlelanguagetranslator_flag_size" id="googlelanguagetranslator_flag_size" style="width:110px;">
913
- <option value="16" <?php if($options=='16'){echo "selected";}?>>16px</option>
914
- <option value="18" <?php if($options=='18'){echo "selected";}?>>18px</option>
915
- <option value="20" <?php if($options=='20'){echo "selected";}?>>20px</option>
916
- <option value="22" <?php if($options=='22'){echo "selected";}?>>22px</option>
917
- <option value="24" <?php if($options=='24'){echo "selected";}?>>24px</option>
918
- </select>
919
- <?php }
920
-
921
- public function googlelanguagetranslator_flags_order_cb() {
922
- $option_name = 'googlelanguagetranslator_flags_order';
923
- $new_value = '';
924
-
925
- if ( get_option ( $option_name ) === false ) {
926
-
927
- // The option does not exist, so we update it.
928
- update_option( $option_name, $new_value );
929
- }
930
-
931
- $options = get_option ( ''.$option_name.'' ); ?>
932
-
933
- <input type="hidden" id="order" name="googlelanguagetranslator_flags_order" value="<?php print_r(get_option('googlelanguagetranslator_flags_order')); ?>" />
934
- <?php
935
- }
936
-
937
- public function googlelanguagetranslator_css_cb() {
938
-
939
- $option_name = 'googlelanguagetranslator_css' ;
940
- $new_value = '';
941
-
942
- if ( get_option( $option_name ) === false ) {
943
-
944
- // The option does not exist, so we update it.
945
- update_option( $option_name, $new_value );
946
- }
947
-
948
- $options = get_option (''.$option_name.'');
949
-
950
- $html = '<textarea style="width:100%; height:200px" name="googlelanguagetranslator_css" id="googlelanguagetranslator_css">'.$options.'</textarea>';
951
- echo $html;
952
- }
953
-
954
- public function googlelanguagetranslator_manage_translations_cb() {
955
- $option_name = 'googlelanguagetranslator_manage_translations' ;
956
- $new_value = 0;
957
-
958
- if ( get_option( $option_name ) === false ) {
959
-
960
- // The option does not exist, so we update it.
961
- update_option( $option_name, $new_value );
962
- }
963
-
964
- $options = get_option (''.$option_name.'');
965
-
966
- $html = '<input type="checkbox" name="googlelanguagetranslator_manage_translations" id="googlelanguagetranslator_manage_translations" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on translation management?';
967
- echo $html;
968
- }
969
-
970
- public function googlelanguagetranslator_multilanguage_cb() {
971
-
972
- $option_name = 'googlelanguagetranslator_multilanguage' ;
973
- $new_value = 0;
974
-
975
- if ( get_option( $option_name ) === false ) {
976
-
977
- // The option does not exist, so we update it.
978
- update_option( $option_name, $new_value );
979
- }
980
-
981
- $options = get_option (''.$option_name.'');
982
-
983
- $html = '<input type="checkbox" name="googlelanguagetranslator_multilanguage" id="googlelanguagetranslator_multilanguage" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on multilanguage mode?';
984
- echo $html;
985
- }
986
-
987
- public function googlelanguagetranslator_exclude_translation_cb() {
988
-
989
- $option_name = 'googlelanguagetranslator_exclude_translation';
990
- $new_value = '';
991
-
992
- if (get_option($option_name) === false ) {
993
- // The option does not exist, so we update it.
994
- update_option( $option_name, $new_value );
995
- }
996
-
997
- $options = get_option (''.$option_name.'');
998
-
999
- $html = '<input type="text" name="'.$option_name.'" id="'.$option_name.'" value="'.$options.'" />';
1000
-
1001
- echo $html;
1002
- }
1003
-
1004
- public function page_layout_cb() {
1005
- include( plugin_dir_path( __FILE__ ) . '/css/style.php'); ?>
1006
- <?php add_thickbox(); ?>
1007
- <div class="wrap">
1008
- <div id="icon-options-general" class="icon32"></div>
1009
- <h2><span class="notranslate">Google Language Translator</span></h2>
1010
- <form action="<?php echo admin_url('options.php'); ?>" method="post">
1011
- <div class="metabox-holder has-right-sidebar" style="float:left; width:65%">
1012
- <div class="postbox" style="width: 100%">
1013
- <h3 class="notranslate">Settings</h3>
1014
-
1015
- <?php settings_fields('google_language_translator'); ?>
1016
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1017
- <tr>
1018
- <td style="width:60%" class="notranslate">Plugin Status:</td>
1019
- <td class="notranslate"><?php $this->googlelanguagetranslator_active_cb(); ?></td>
1020
- </tr>
1021
-
1022
- <tr class="notranslate">
1023
- <td>Choose the original language of your website</td>
1024
- <td><?php $this->googlelanguagetranslator_language_cb(); ?></td>
1025
- </tr>
1026
-
1027
- <tr class="notranslate">
1028
- <td>What translation languages will display in the language box?<br/>("All Languages" option <strong><u>must</u></strong> be chosen to show flags.)</td>
1029
- <td><?php $this->googlelanguagetranslator_language_option_cb(); ?></td>
1030
- </tr>
1031
-
1032
- <tr class="notranslate languages">
1033
- <td colspan="2"><?php $this->language_display_settings_cb(); ?></td>
1034
- </tr>
1035
-
1036
- <tr class="notranslate">
1037
- <td class="choose_flags_intro">Show flag images?<br/>(Display up to 81 flags above the translator)</td>
1038
- <td class="choose_flags_intro"><?php $this->googlelanguagetranslator_flags_cb(); ?></td>
1039
- </tr>
1040
-
1041
- <tr class="notranslate choose_flags">
1042
- <td class="choose_flags">Choose the flags you want to display:</td>
1043
- <td></td>
1044
- </tr>
1045
-
1046
- <tr class="notranslate">
1047
- <td colspan="2" class="choose_flags"><?php $this->flag_display_settings_cb(); ?></td>
1048
- </tr>
1049
-
1050
- <tr class="notranslate">
1051
- <td>Show floating translation widget? <strong style="color:red">(New!)</strong><br/>
1052
- <span>("All Languages" option <strong><u>must</u></strong> be chosen to show widget.)</span>
1053
- </td>
1054
- <td><?php $this->googlelanguagetranslator_floating_widget_cb(); ?></td>
1055
- </tr>
1056
-
1057
- <tr class="notranslate">
1058
- <td>Show translate box?</td>
1059
- <td><?php $this->googlelanguagetranslator_translatebox_cb(); ?></td>
1060
- </tr>
1061
-
1062
- <tr class="notranslate">
1063
- <td>Layout option:</td>
1064
- <td><?php $this->googlelanguagetranslator_display_cb(); ?></td>
1065
- </tr>
1066
-
1067
- <tr class="notranslate">
1068
- <td>Show Google Toolbar?</td>
1069
- <td><?php $this->googlelanguagetranslator_toolbar_cb(); ?></td>
1070
- </tr>
1071
-
1072
- <tr class="notranslate">
1073
- <td>Show Google Branding? &nbsp;<a href="https://developers.google.com/translate/v2/attribution" target="_blank">Learn more</a></td>
1074
- <td><?php $this->googlelanguagetranslator_showbranding_cb(); ?></td>
1075
- </tr>
1076
-
1077
- <tr class="alignment notranslate">
1078
- <td class="flagdisplay">Align the translator left or right?</td>
1079
- <td class="flagdisplay"><?php $this->googlelanguagetranslator_flags_alignment_cb(); ?></td>
1080
- </tr>
1081
-
1082
- <tr class="manage_translations notranslate">
1083
- <td>Turn on translation management? &nbsp;<a href="#TB_inline?width=200&height=300&inlineId=translation-management-description" title="What is Translation Management?" class="thickbox">Learn more</a><div id="translation-management-description" style="display:none"><p>Translation management is an interface that allows you to manage specific words and phrases on your website. The interface is linked directly to your Google Account, and no special subscriptions are necessary to setup this feature.</p><p>If translation management setting is checked, users who browse your website can hover their mouse over specific words and phrases, then send translation suggestions directly to your Google Translate account! You can then "approve" those suggestions, and Google will automatically display them when translations are requested by your users.</p><p>Translation management requires that you insert a custom meta tag into the <code>head</code> section of your website.</p><p><a href="http://translate.google.com/manager/website/settings" target="_blank">Click here to to get the required meta tag</a></p></div></td>
1084
- <td><?php $this->googlelanguagetranslator_manage_translations_cb(); ?></td>
1085
- </tr>
1086
-
1087
- <tr class="multilanguage notranslate">
1088
- <td>Multilanguage Page option? &nbsp;<a href="#TB_inline?width=200&height=150&inlineId=multilanguage-page-description" title="What is the Multi-Language Page Option?" class="thickbox">Learn more</a><div id="multilanguage-page-description" style="display:none"><p>If checked, Google will automatically convert text written in multiple languages, into the single language requested by your user.</p><p>In most cases, this setting is not recommended, although for certain websites it might be necessary.</p></div></td>
1089
- <td><?php $this->googlelanguagetranslator_multilanguage_cb(); ?></td>
1090
- </tr>
1091
-
1092
- <tr class="notranslate">
1093
- <td>Google Analytics:</td>
1094
- <td><?php $this->googlelanguagetranslator_analytics_cb(); ?></td>
1095
- </tr>
1096
-
1097
- <tr class="analytics notranslate">
1098
- <td>Google Analytics ID (Ex. 'UA-11117410-2')</td>
1099
- <td><?php $this->googlelanguagetranslator_analytics_id_cb(); ?></td>
1100
- </tr>
1101
-
1102
- <tr class="notranslate">
1103
- <td>Full widget usage in pages/posts/sidebar:</td>
1104
- <td><code>[google-translator]</code></td>
1105
- </tr>
1106
- </table>
1107
-
1108
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1109
- <tr class="notranslate">
1110
- <td style="width:40%">Full widget usage in header/footer or page template:</td>
1111
- <td style="width:60%"><code>&lt;?php echo do_shortcode('[google-translator]'); ?&gt;</code></td>
1112
- </tr>
1113
-
1114
- <tr class="notranslate">
1115
- <td>Single language usage in<br/>nav menu/pages/posts</td>
1116
- <td><code>[glt language="Spanish" label="Español"]</code></td>
1117
- </tr>
1118
-
1119
- <tr class="notranslate">
1120
- <td colspan="2">
1121
- <a href="#TB_inline?width=200&height=450&inlineId=single-language-shortcode-description" title="How to place a single language in your Wordpress menu" class="thickbox">How to place a single language in your Wordpress menu</a><div id="single-language-shortcode-description" style="display:none"><p>For menu usage, you need to create a new menu, or use an existing menu, by navigating to "Appearance > Menus".</p><p>First you will need to enable "descriptions" for your menu items, which can be found in a tab labeled "Screen Options" in the upper-right area of the page.</p><p>Once descriptions are enabled, follow these steps:<br/><ol><li>Create a new menu item using "Link" as the menu item type.</li><li>Use <code style="border:none">#</code> for the URL</li><li>Enter a navigation label of your choice. This label does not appear on your website - it is meant only to help you identify the menu item.</li><li>Place the following shortcode into the "description" field, and modify it to display the language and navigation label of your choice:</p></li></ol>
1122
- <p><code>[glt language="Spanish" label="Español"]</code></p>
1123
- </div></td>
1124
- </tr>
1125
-
1126
- <tr class="notranslate">
1127
- <td><?php submit_button(); ?></td>
1128
- <td></td>
1129
- </tr>
1130
- </table>
1131
-
1132
- </div> <!-- .postbox -->
1133
- </div> <!-- .metbox-holder -->
1134
-
1135
- <div class="metabox-holder" style="float:right; clear:right; width:33%">
1136
- <div class="postbox">
1137
- <h3 class="notranslate">Preview</h3>
1138
- <table style="width:100%">
1139
- <tr>
1140
- <td style="box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; padding:15px 15px; margin:0px"><span style="color:red; font-weight:bold" class="notranslate">(New!)</span><span class="notranslate"> Drag &amp; drop flags to change their position.<br/><br/>(Note: flag order resets when flags are added/removed)</span><br/><br/><?php echo do_shortcode('[google-translator]'); ?><p class="hello"><span class="notranslate">Translated text:</span> &nbsp; <span>Hello</span></p></td>
1141
- </tr>
1142
-
1143
- <tr>
1144
- <td><?php if (isset ($_POST['googlelanguagetranslator_flags_order']) ) { echo $_POST['googlelanguagetranslator_flags_order']; } ?></td>
1145
- </tr>
1146
-
1147
-
1148
- </table>
1149
- </div> <!-- .postbox -->
1150
- </div> <!-- .metabox-holder -->
1151
-
1152
- <div id="glt_advanced_settings" class="metabox-holder notranslate" style="float: right; width: 33%;">
1153
- <div class="postbox">
1154
- <h3>Advanced Settings</h3>
1155
- <div class="inside">
1156
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1157
- <tr class="notranslate">
1158
- <td class="advanced">Select flag size:</td>
1159
- <td class="advanced"><?php $this->googlelanguagetranslator_flag_size_cb(); ?></td>
1160
- </tr>
1161
- </table>
1162
- </div>
1163
- </div>
1164
- </div>
1165
-
1166
-
1167
- <div class="metabox-holder notranslate" style="float: right; width: 33%;">
1168
- <div class="postbox">
1169
- <h3>Add CSS Styles</h3>
1170
- <div class="inside">
1171
- <p>You can apply any necessary CSS styles below:</p>
1172
- <?php $this->googlelanguagetranslator_css_cb(); ?>
1173
- </div>
1174
- </div>
1175
- </div>
1176
- <?php $this->googlelanguagetranslator_flags_order_cb(); ?>
1177
- </form>
1178
-
1179
- <div class="metabox-holder notranslate" style="float: right; width: 33%;">
1180
- <div class="postbox">
1181
- <h3>GLT Premium 4.0.1 is Here! $15</h3>
1182
- <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 />
1183
- <ul id="features" style="margin-left:15px">
1184
- <li style="list-style:square outside"><span style="color:red; font-weight:bold">New!</span> Manual Translation Module!</li>
1185
- <li style="list-style:square outside"><span style="color:red; font-weight:bold">New!</span> Exclude any specific area of your website from translation, directly from your settings panel</li>
1186
- <li style="list-style:square outside">81 Languages</li>
1187
- <li style="list-style:square outside">jQuery-powered language switcher<br/>(No Adobe Flash required)</li>
1188
- <li style="list-style:square outside">Add single languages to your menus/pages/posts</li>
1189
- <li style="list-style:square outside">Show/hide images or text for each language</li>
1190
- <li style="list-style:square outside">Language switcher loads inline with page content</li>
1191
- <li style="list-style:square outside">Custom flag choices for English, Spanish and Portuguese</li>
1192
- <li style="list-style:square outside">User-friendly URLs, hide or show <code>lang</code> attribute</li>
1193
- <li style="list-style:square outside">Drag/drop flags to re-arrange their order</li>
1194
- <li style="list-style:square outside">Full access to our support forum</li>
1195
- <li style="list-style:square outside">FREE access to all future updates</li>
1196
- </ul>
1197
- </div>
1198
- </div>
1199
- </div>
1200
-
1201
- <div class="metabox-holder notranslate" style="float: right; width: 33%;">
1202
- <div class="postbox">
1203
- <h3>Please Consider A Donation</h3>
1204
- <div class="inside">If you like this plugin and find it useful, help keep this plugin actively developed by clicking the donate button <br /><br />
1205
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1206
- <input type="hidden" name="cmd" value="_donations">
1207
- <input type="hidden" name="business" value="robertmyrick@hotmail.com">
1208
- <input type="hidden" name="lc" value="US">
1209
- <input type="hidden" name="item_name" value="Support Studio 88 Design and help us bring you more Wordpress goodies! Any donation is kindly appreciated. Thank you!">
1210
- <input type="hidden" name="no_note" value="0">
1211
- <input type="hidden" name="currency_code" value="USD">
1212
- <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
1213
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
1214
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
1215
- </form>
1216
- <br />
1217
- <br />
1218
- </div>
1219
- </div>
1220
- </div>
1221
- </div> <!-- .wrap -->
1222
- <?php
1223
- }
1224
- }
1225
  $google_language_translator = new google_language_translator();
1
+ <?php
2
+ /*
3
+ Plugin Name: Google Language Translator
4
+ Plugin URI: http://www.studio88design.com/plugins/google-language-translator
5
+ Version: 4.0.8
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.wp-studio.net/
9
+ */
10
+
11
+ 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_uninstall_hook( __FILE__, '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_action('wp_footer',array(&$this, 'footer_script'));
106
+ add_shortcode( 'google-translator',array(&$this, 'google_translator_shortcode'));
107
+ add_shortcode( 'glt', array(&$this, 'google_translator_menu_language'));
108
+ add_filter('widget_text','do_shortcode');
109
+ add_filter('walker_nav_menu_start_el', array(&$this,'menu_shortcodes') , 10 , 2);
110
+ add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'glt_settings_link') );
111
+
112
+ if (!is_admin()) {
113
+ add_action('init',array(&$this, 'flags'));
114
+ }
115
+ }
116
+
117
+ public function glt_activate() {
118
+ add_option('googlelanguagetranslator_active', 1);
119
+ add_option('googlelanguagetranslator_language','en');
120
+ add_option('googlelanguagetranslator_language_option','all');
121
+ add_option('googlelanguagetranslator_flags','show_flags');
122
+ add_option('language_display_settings',array ('en' => 1));
123
+ add_option('flag_display_settings',array ('flag-en' => 1));
124
+ add_option('googlelanguagetranslator_translatebox','yes');
125
+ add_option('googlelanguagetranslator_display','Vertical');
126
+ add_option('googlelanguagetranslator_toolbar','Yes');
127
+ add_option('googlelanguagetranslator_showbranding','Yes');
128
+ add_option('googlelanguagetranslator_flags_alignment','flags_left');
129
+ add_option('googlelanguagetranslator_analytics', 0);
130
+ add_option('googlelanguagetranslator_analytics_id','');
131
+ add_option('googlelanguagetranslator_css','');
132
+ add_option('googlelanguagetranslator_manage_translations',0);
133
+ add_option('googlelanguagetranslator_multilanguage',0);
134
+ add_option('googlelanguagetranslator_floating_widget','yes');
135
+ add_option('googlelanguagetranslator_flag_size','18');
136
+ add_option('googlelanguagetranslator_flags_order','');
137
+ }
138
+
139
+ public function glt_deactivate() {
140
+ delete_option('googlelanguagetranslator_active', 1);
141
+ delete_option('googlelanguagetranslator_language','en');
142
+ delete_option('googlelanguagetranslator_language_option','all');
143
+ delete_option('googlelanguagetranslator_flags','show_flags');
144
+ delete_option('language_display_settings',array ('en' => 1));
145
+ delete_option('flag_display_settings',array ('flag-en' => 1));
146
+ delete_option('googlelanguagetranslator_translatebox','yes');
147
+ delete_option('googlelanguagetranslator_display','Vertical');
148
+ delete_option('googlelanguagetranslator_toolbar','Yes');
149
+ delete_option('googlelanguagetranslator_showbranding','Yes');
150
+ delete_option('googlelanguagetranslator_flags_alignment','flags_left');
151
+ delete_option('googlelanguagetranslator_analytics',1);
152
+ delete_option('googlelanguagetranslator_analytics_id','');
153
+ delete_option('googlelanguagetranslator_css','');
154
+ delete_option('googlelanguagetranslator_manage_translations',0);
155
+ delete_option('googlelanguagetranslator_multilanguage',0);
156
+ delete_option('googlelanguagetranslator_floating_widget','yes');
157
+ delete_option('googlelanguagetranslator_flag_size','18');
158
+ delete_option('googlelanguagetranslator_flags_order','');
159
+ }
160
+
161
+ public function glt_settings_link ( $links ) {
162
+ $settings_link = array(
163
+ '<a href="' . admin_url( 'options-general.php?page=google_language_translator' ) . '">Settings</a>',
164
+ );
165
+ return array_merge( $links, $settings_link );
166
+ }
167
+
168
+ public function add_my_admin_menus(){
169
+ $p = add_options_page('Google Language Translator', 'Google Language Translator', 'manage_options', 'google_language_translator', array(&$this, 'page_layout_cb'));
170
+
171
+ add_action( 'load-' . $p, array(&$this, 'load_admin_js' ));
172
+ }
173
+
174
+ public function load_admin_js(){
175
+ add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_admin_js' ));
176
+ add_action('admin_footer',array(&$this, 'footer_script'));
177
+ }
178
+
179
+ public function enqueue_admin_js(){
180
+ wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
181
+ wp_enqueue_script( 'my-flag-script', plugins_url('js/flags.js',__FILE__), array('jquery'));
182
+
183
+ if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
184
+ wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
185
+ wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
186
+ wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
187
+ wp_enqueue_style( 'toolbar.css' );
188
+ }
189
+
190
+ wp_enqueue_script( 'jquery-ui.js', plugins_url('js/jquery-ui.js',__FILE__), array('jquery'));
191
+ wp_enqueue_script( 'jquery-ui-sortable.js', plugins_url('js/jquery-ui-sortable.js',__FILE__), array('jquery'));
192
+ wp_enqueue_script( 'jquery-ui-widget.js', plugins_url('js/jquery-ui-widget.js',__FILE__), array('jquery'));
193
+ wp_enqueue_script( 'jquery-ui-mouse.js', plugins_url('js/jquery-ui-mouse.js',__FILE__), array('jquery'));
194
+ wp_enqueue_script( 'load_sortable_flags', plugins_url('js/load-sortable-flags.js',__FILE__), array('jquery'));
195
+ wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
196
+ wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
197
+ wp_enqueue_style( 'style.css' );
198
+ wp_enqueue_style( 'jquery-ui.css' );
199
+ }
200
+
201
+ public function flags() {
202
+ wp_enqueue_script( 'flags', plugins_url('js/flags.js',__FILE__), array('jquery'));
203
+
204
+ if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
205
+ wp_enqueue_script( 'my-toolbar-script', plugins_url('js/toolbar.js',__FILE__), array('jquery'));
206
+ wp_enqueue_script( 'my-load-toolbar-script', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
207
+ wp_register_style( 'toolbar.css', plugins_url('css/toolbar.css', __FILE__) );
208
+ wp_enqueue_style( 'toolbar.css' );
209
+ }
210
+
211
+ wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
212
+ wp_enqueue_style( 'style.css' );
213
+ }
214
+
215
+ public function load_css() {
216
+ include( plugin_dir_path( __FILE__ ) . '/css/style.php');
217
+ }
218
+
219
+ public function google_translator_shortcode() {
220
+
221
+ if (get_option('googlelanguagetranslator_display')=='Vertical'){
222
+ return $this->googlelanguagetranslator_vertical();
223
+ }
224
+ elseif(get_option('googlelanguagetranslator_display')=='Horizontal'){
225
+ return $this->googlelanguagetranslator_horizontal();
226
+ }
227
+ }
228
+
229
+ public function googlelanguagetranslator_included_languages() {
230
+ if ( get_option('googlelanguagetranslator_language_option')=='specific') {
231
+ $get_language_choices = get_option ('language_display_settings');
232
+
233
+ foreach ($get_language_choices as $key=>$value) {
234
+ if($value == 1) {
235
+ $items[] = $key;
236
+ }
237
+ }
238
+
239
+ $comma_separated = implode(",",array_values($items));
240
+
241
+ if ( get_option('googlelanguagetranslator_display') == 'Vertical') {
242
+ $lang = ", includedLanguages:'".$comma_separated."'";
243
+ return $lang;
244
+ } elseif ( get_option('googlelanguagetranslator_display') == 'Horizontal') {
245
+ $lang = ", includedLanguages:'".$comma_separated."'";
246
+ return $lang;
247
+ }
248
+ }
249
+ }
250
+
251
+ public function analytics() {
252
+ if ( get_option('googlelanguagetranslator_analytics') == 1 ) {
253
+ $analytics_id = get_option('googlelanguagetranslator_analytics_id');
254
+ $analytics = "gaTrack: true, gaId: '".$analytics_id."'";
255
+
256
+ if (!empty ($analytics_id) ):
257
+ return ', '.$analytics;
258
+ endif;
259
+ }
260
+ }
261
+
262
+ public function menu_shortcodes( $item_output,$item ) {
263
+ if ( !empty($item->description)) {
264
+ $output = do_shortcode($item->description);
265
+
266
+ if ( $output != $item->description )
267
+ $item_output = $output;
268
+ }
269
+ return $item_output;
270
+ }
271
+
272
+ public function google_translator_menu_language($atts, $content = '') {
273
+ extract(shortcode_atts(array(
274
+ "language" => 'Spanish',
275
+ "label" => 'Spanish'
276
+ ), $atts));
277
+
278
+ $default_language = get_option('googlelanguagetranslator_language');
279
+ $language_code = array_search($language,$this->languages_array);
280
+
281
+ return "<a class='nturl notranslate ".$language_code." single-language flag' title='".$language."'>".$label."</a>";
282
+ }
283
+
284
+ public function footer_script() {
285
+
286
+ global $shortcode_started;
287
+
288
+ if (!$shortcode_started):
289
+ //echo 'shortcode not loaded';
290
+ else:
291
+ //echo 'true';
292
+ endif;
293
+
294
+
295
+
296
+ $default_language = get_option('googlelanguagetranslator_language');
297
+ $language_choices = $this->googlelanguagetranslator_included_languages();
298
+ $get_language_option = get_option('googlelanguagetranslator_language_option');
299
+ $get_flag_choices = get_option ('flag_display_settings');
300
+ $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
301
+ $is_active = get_option ( 'googlelanguagetranslator_active' );
302
+ $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
303
+ $auto_display = ', autoDisplay: false';
304
+ $str = ''; ?>
305
+
306
+ <script>
307
+ jQuery(document).ready(function($) {
308
+ $("a.nturl").on("click",function() {
309
+ default_lang = "<?php echo get_option('googlelanguagetranslator_language'); ?>";
310
+ lang_prefix = $(this).attr("class").split(" ")[2];
311
+
312
+ if (lang_prefix == default_lang) {
313
+ load_default();
314
+ } else {
315
+ load_selected_language();
316
+ }
317
+
318
+ function load_default() {
319
+ doGoogleLanguageTranslator(default_lang + "|" + default_lang);
320
+ }
321
+
322
+ function load_selected_language() {
323
+ doGoogleLanguageTranslator(default_lang + "|" + lang_prefix);
324
+ }
325
+ });
326
+
327
+ $("a.flag").on("click",function() {
328
+ default_lang = "<?php echo get_option('googlelanguagetranslator_language'); ?>";
329
+ lang_prefix = $(this).attr("class").split(" ")[2];
330
+
331
+ if (lang_prefix == default_lang) {
332
+ load_default();
333
+ } else {
334
+ load_selected_language();
335
+ }
336
+
337
+ function load_default() {
338
+ doGoogleLanguageTranslator(default_lang + "|" + default_lang);
339
+ }
340
+
341
+ function load_selected_language() {
342
+ doGoogleLanguageTranslator(default_lang + "|" + lang_prefix);
343
+ }
344
+ });
345
+
346
+
347
+ var glt_id = 'google_language_translator';
348
+
349
+ if ($ ("#" + glt_id).length == 0) {
350
+ $("#glt-footer").html("<div id='google_language_translator'></div>");
351
+ }
352
+ });
353
+ </script>
354
+
355
+ <?php
356
+
357
+ if( $is_active == 1) {
358
+ if ($shortcode_started != 'true') {
359
+
360
+ foreach ($get_flag_choices as $flag_choice_key) {}
361
+
362
+ if ($floating_widget=='yes' && $get_language_option != 'specific' && !is_admin()) {
363
+ $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
364
+ $str.='<div id="glt-toolbar"></div>';
365
+ } //endif $floating_widget
366
+
367
+ $str.='<div id="flags" style="display:none">';
368
+ $str.='<ul id="sortable" class="ui-sortable">';
369
+
370
+ if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
371
+ foreach ($this->languages_array as $key=>$value) {
372
+ $language_code = $key;
373
+ $language_name = $value;
374
+ $language_name_flag = $language_name;
375
+ if ($flag_choice_key == '1') {
376
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
377
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
378
+ $language_name_flag = 'Canada';
379
+ }
380
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
381
+ $language_name_flag = 'United-States';
382
+ }
383
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
384
+ $language_name_flag = 'Mexico';
385
+ }
386
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
387
+ $language_name_flag = 'Brazil';
388
+ }
389
+
390
+ if ($lang_attribute == 'yes') {
391
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="notranslate flag '.$language_code.'"></a></li>';
392
+ } else {
393
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
394
+ }
395
+ }
396
+ } //$key
397
+ }//foreach
398
+ } else {
399
+ foreach ($new_languages_array_codes as $value) {
400
+ $language_name = $value;
401
+ $language_code = array_search ($language_name,$this->languages_array);
402
+ $language_name_flag = $language_name;
403
+ if ($flag_choice_key == '1') {
404
+ if (in_array($language_name,$this->languages_array)) {
405
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
406
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
407
+ $language_name_flag = 'Canada';
408
+ }
409
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
410
+ $language_name_flag = 'United-States';
411
+ }
412
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
413
+ $language_name_flag = 'Mexico';
414
+ }
415
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
416
+ $language_name_flag = 'Brazil';
417
+ }
418
+
419
+ if ($lang_attribute == 'yes') {
420
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="notranslate flag '.$language_code.'"></a></li>';
421
+ } else {
422
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
423
+ }
424
+ } //isset
425
+ } //in_array
426
+ }//flag_choice_key
427
+ }//foreach
428
+ }//endif
429
+ $str.='</ul>';
430
+ $str.='</div>';
431
+ }
432
+ }
433
+
434
+ $language_choices = $this->googlelanguagetranslator_included_languages();
435
+ $layout = get_option('googlelanguagetranslator_display');
436
+ $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
437
+ $horizontal_layout = ', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL';
438
+ $auto_display = ', autoDisplay: false';
439
+ $default_language = get_option('googlelanguagetranslator_language');
440
+
441
+ if ($is_multilanguage == 1) {
442
+ $multilanguagePage = ', multilanguagePage:true';
443
+ $str.="<div id='glt-footer'></div><script type='text/javascript'>";
444
+ $str.="function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : '') . $auto_display . $multilanguagePage . $this->analytics()."}, 'google_language_translator');}</script>";
445
+ $str.="<script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit'></script>";
446
+ echo $str;
447
+
448
+ } elseif ($is_multilanguage == 0) {
449
+ $str.="<div id='glt-footer'></div><script type='text/javascript'>";
450
+ $str.="function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : '') . $auto_display . $this->analytics()."}, 'google_language_translator');}</script>";
451
+ $str.="<script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit'></script>";
452
+ echo $str;
453
+ }
454
+ }
455
+
456
+ public function googlelanguagetranslator_vertical() {
457
+
458
+ global $shortcode_started;
459
+
460
+ $shortcode_started = 'true';
461
+ $get_flag_choices = get_option ('flag_display_settings');
462
+ $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
463
+ $new_languages_array = explode(",",$new_languages_array_string);
464
+ $new_languages_array_codes = array_values($new_languages_array);
465
+ $new_languages_array_count = count($new_languages_array);
466
+ $get_flag_choices_count = count($get_flag_choices);
467
+ $get_language_choices = get_option ('language_display_settings');
468
+ $flag_width = get_option('googlelanguagetranslator_flag_size');
469
+ $default_language_code = get_option('googlelanguagetranslator_language');
470
+ $is_active = get_option ( 'googlelanguagetranslator_active' );
471
+ $get_language_option = get_option('googlelanguagetranslator_language_option');
472
+ $language_choices = $this->googlelanguagetranslator_included_languages();
473
+ $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
474
+ $str = '';
475
+
476
+ if( $is_active == 1){
477
+
478
+ foreach ($get_flag_choices as $flag_choice_key) {}
479
+
480
+ if ($floating_widget=='yes' && $get_language_option != 'specific') {
481
+ $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
482
+ $str.='<div id="glt-toolbar"></div>';
483
+ } //endif $floating_widget
484
+
485
+ $str.='<div id="flags" class="size'.$flag_width.'">';
486
+ $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
487
+
488
+ if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
489
+ foreach ($this->languages_array as $key=>$value) {
490
+ $language_code = $key;
491
+ $language_name = $value;
492
+ $language_name_flag = $language_name;
493
+ if ($flag_choice_key == '1') {
494
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
495
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
496
+ }
497
+ } //$key
498
+ }//foreach
499
+ } else {
500
+ foreach ($new_languages_array_codes as $value) {
501
+ $language_name = $value;
502
+ $language_code = array_search ($language_name,$this->languages_array);
503
+ $language_name_flag = $language_name;
504
+ if ($flag_choice_key == '1') {
505
+ if (in_array($language_name,$this->languages_array)) {
506
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
507
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
508
+ } //isset
509
+ } //in_array
510
+ }//flag_choice_key
511
+ }//foreach
512
+ }//endif
513
+ $str.='</ul>';
514
+ $str.='</div>';
515
+ $str.='<div id="google_language_translator"></div>';
516
+ return $str;
517
+ } //End is_active
518
+ } // End glt_vertical
519
+
520
+ public function googlelanguagetranslator_horizontal(){
521
+ $shortcode_started = true;
522
+ $get_flag_choices = get_option ('flag_display_settings');
523
+ $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
524
+ $new_languages_array = explode(",",$new_languages_array_string);
525
+ $new_languages_array_codes = array_values($new_languages_array);
526
+ $new_languages_array_count = count($new_languages_array);
527
+ $get_flag_choices_count = count($get_flag_choices);
528
+ $get_language_choices = get_option ('language_display_settings');
529
+ $flag_width = get_option('googlelanguagetranslator_flag_size');
530
+ $default_language_code = get_option('googlelanguagetranslator_language');
531
+ $is_active = get_option ( 'googlelanguagetranslator_active' );
532
+ $get_language_option = get_option('googlelanguagetranslator_language_option');
533
+ $language_choices = $this->googlelanguagetranslator_included_languages();
534
+ $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
535
+ $str = '';
536
+
537
+ if( $is_active == 1) {
538
+ foreach ($get_flag_choices as $flag_choice_key) {}
539
+
540
+ if ($floating_widget=='yes' && $get_language_option != 'specific') {
541
+
542
+ $str.='<div id="glt-translate-trigger"><span class="notranslate">Translate &raquo;</span></div>';
543
+ $str.='<div id="glt-toolbar"></div>';
544
+ } //endif $floating_widget
545
+
546
+ $str.='<div id="flags" class="size'.$flag_width.'">';
547
+ $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
548
+
549
+ if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
550
+ foreach ($this->languages_array as $key=>$value) {
551
+ $language_code = $key;
552
+ $language_name = $value;
553
+ $language_name_flag = $language_name;
554
+
555
+ if ($flag_choice_key == '1') {
556
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
557
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
558
+ }
559
+ } //$key
560
+ }//foreach
561
+
562
+ } else {
563
+
564
+ foreach ($new_languages_array_codes as $value) {
565
+ $language_name = $value;
566
+ $language_code = array_search ($language_name,$this->languages_array);
567
+ $language_name_flag = $language_name;
568
+ if ($flag_choice_key == '1') {
569
+ if (in_array($language_name,$this->languages_array)) {
570
+ if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
571
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code."'></a></li>";
572
+ } //isset
573
+ } //in_array
574
+ }//flag_choice_key
575
+ }//foreach
576
+ }//endif
577
+ $str.='</ul>';
578
+ $str.='</div>';
579
+ $str.='<div id="google_language_translator"></div>';
580
+ return $str;
581
+ }
582
+ } // End glt_horizontal
583
+
584
+ public function initialize_settings() {
585
+ add_settings_section('glt_settings','Settings','','google_language_translator');
586
+
587
+ $settings_name_array = array (
588
+ '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','googlelanguagetranslator_exclude_translation'
589
+ );
590
+
591
+ $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','googlelanguagetranslator_exclude_translation_cb'
592
+ );
593
+
594
+ foreach ($settings_name_array as $setting) {
595
+ add_settings_field( $setting,'',$setting.'_cb','google_language_translator','glt_settings');
596
+ register_setting( 'google_language_translator',$setting);
597
+ }
598
+ }
599
+
600
+ public function googlelanguagetranslator_active_cb() {
601
+ $option_name = 'googlelanguagetranslator_active' ;
602
+ $new_value = 1;
603
+ if ( get_option( $option_name ) === false ) {
604
+
605
+ // The option does not exist, so we update it.
606
+ update_option( $option_name, $new_value );
607
+ }
608
+
609
+ $options = get_option (''.$option_name.'');
610
+
611
+ $html = '<input type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" '.checked(1,$options,false).'/> &nbsp; Check this box to activate';
612
+ echo $html;
613
+ }
614
+
615
+ public function googlelanguagetranslator_language_cb() {
616
+
617
+ $option_name = 'googlelanguagetranslator_language';
618
+ $new_value = 'en';
619
+
620
+ if ( get_option( $option_name ) === false ) {
621
+
622
+ // The option does not exist, so we update it.
623
+ update_option( $option_name, $new_value );
624
+ }
625
+
626
+ $options = get_option (''.$option_name.''); ?>
627
+
628
+ <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
629
+
630
+ <?php
631
+
632
+ foreach ($this->languages_array as $key => $value) {
633
+ $language_code = $key;
634
+ $language_name = $value; ?>
635
+ <option value="<?php echo $language_code; ?>" <?php if($options==''.$language_code.''){echo "selected";}?>><?php echo $language_name; ?></option>
636
+ <?php } ?>
637
+ </select>
638
+ <?php
639
+ }
640
+
641
+ public function googlelanguagetranslator_language_option_cb() {
642
+
643
+ $option_name = 'googlelanguagetranslator_language_option' ;
644
+ $new_value = 'all';
645
+
646
+ if ( get_option( $option_name ) === false ) {
647
+
648
+ // The option does not exist, so we update it.
649
+ update_option( $option_name, $new_value );
650
+ }
651
+
652
+ $options = get_option (''.$option_name.''); ?>
653
+
654
+ <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="all" <?php if($options=='all'){echo "checked";}?>/> All Languages<br/>
655
+ <input type="radio" name="googlelanguagetranslator_language_option" id="googlelanguagetranslator_language_option" value="specific" <?php if($options=='specific'){echo "checked";}?>/> Specific Languages
656
+ <?php
657
+ }
658
+
659
+ public function language_display_settings_cb() {
660
+ $default_language_code = get_option('googlelanguagetranslator_language');
661
+ $option_name = 'language_display_settings';
662
+ $new_value = array(''.$default_language_code.'' => 1);
663
+
664
+ if ( get_option( $option_name ) == false ) {
665
+ // The option does not exist, so we update it.
666
+ update_option( $option_name, $new_value );
667
+ }
668
+
669
+ $get_language_choices = get_option (''.$option_name.'');
670
+
671
+ foreach ($this->languages_array as $key => $value) {
672
+ $language_code = $key;
673
+ $language_name = $value;
674
+ $language_code_array[] = $key;
675
+
676
+ if (!isset($get_language_choices[''.$language_code.''])) {
677
+ $get_language_choices[''.$language_code.''] = 0;
678
+ }
679
+
680
+ $items[] = $get_language_choices[''.$language_code.''];
681
+ $language_codes = $language_code_array;
682
+ $item_count = count($items);
683
+
684
+ if ($item_count == 1 || $item_count == 22 || $item_count == 43 || $item_count == 64) { ?>
685
+ <div class="languages" style="width:25%; float:left">
686
+ <?php } ?>
687
+ <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>
688
+ <?php
689
+ if ($item_count == 21 || $item_count == 42 || $item_count == 63 || $item_count == 81) { ?>
690
+ </div>
691
+ <?php }
692
+ } ?>
693
+ <div class="clear"></div>
694
+ <?php
695
+ }
696
+
697
+ public function googlelanguagetranslator_flags_cb() {
698
+
699
+ $option_name = 'googlelanguagetranslator_flags' ;
700
+ $new_value = 'show_flags';
701
+
702
+ if ( get_option( $option_name ) === false ) {
703
+
704
+ // The option does not exist, so we update it.
705
+ update_option( $option_name, $new_value );
706
+ }
707
+
708
+ $options = get_option (''.$option_name.''); ?>
709
+
710
+ <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="show_flags" <?php if($options=='show_flags'){echo "checked";}?>/> Yes, show flag images<br/>
711
+ <input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="hide_flags" <?php if($options=='hide_flags'){echo "checked";}?>/> No, hide flag images
712
+ <?php
713
+ }
714
+
715
+ public function flag_display_settings_cb() {
716
+ $default_language_code = get_option('googlelanguagetranslator_language');
717
+ $option_name = 'flag_display_settings';
718
+ $new_value = array('flag-'.$default_language_code.'' => 1);
719
+
720
+ if ( get_option( $option_name ) == false ) {
721
+ // The option does not exist, so we update it.
722
+ update_option( $option_name, $new_value );
723
+ }
724
+
725
+ $get_flag_choices = get_option (''.$option_name.'');
726
+
727
+ foreach ($this->languages_array as $key => $value) {
728
+ $language_code = $key;
729
+ $language_name = $value;
730
+ $language_code_array[] = $key;
731
+
732
+ if (!isset($get_flag_choices['flag-'.$language_code.''])) {
733
+ $get_flag_choices['flag-'.$language_code.''] = 0;
734
+ }
735
+
736
+ $items[] = $get_flag_choices['flag-'.$language_code.''];
737
+ $language_codes = $language_code_array;
738
+ $item_count = count($items);
739
+
740
+ if ($item_count == 1 || $item_count == 22 || $item_count == 43 || $item_count == 64) { ?>
741
+ <div class="flagdisplay" style="width:25%; float:left">
742
+ <?php } ?>
743
+ <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>
744
+ <?php
745
+ if ($item_count == 21 || $item_count == 42 || $item_count == 63 || $item_count == 81) { ?>
746
+ </div>
747
+ <?php }
748
+ } ?>
749
+ <div class="clear"></div>
750
+ <?php
751
+ }
752
+
753
+ public function googlelanguagetranslator_floating_widget_cb() {
754
+
755
+ $option_name = 'googlelanguagetranslator_floating_widget' ;
756
+ $new_value = 'yes';
757
+
758
+ if ( get_option( $option_name ) === false ) {
759
+
760
+ // The option does not exist, so we update it.
761
+ update_option( $option_name, $new_value );
762
+ }
763
+
764
+ $options = get_option (''.$option_name.''); ?>
765
+
766
+ <select name="googlelanguagetranslator_floating_widget" id="googlelanguagetranslator_floating_widget" style="width:170px">
767
+ <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Yes, show widget</option>
768
+ <option value="no" <?php if($options=='no'){echo "selected";}?>>No, hide widget</option>
769
+ </select>
770
+ <?php }
771
+
772
+ public function googlelanguagetranslator_translatebox_cb() {
773
+
774
+ $option_name = 'googlelanguagetranslator_translatebox' ;
775
+ $new_value = 'yes';
776
+
777
+ if ( get_option( $option_name ) === false ) {
778
+
779
+ // The option does not exist, so we update it.
780
+ update_option( $option_name, $new_value );
781
+ }
782
+
783
+ $options = get_option (''.$option_name.''); ?>
784
+
785
+ <select name="googlelanguagetranslator_translatebox" id="googlelanguagetranslator_translatebox" style="width:190px">
786
+ <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Yes, show language box</option>
787
+ <option value="no" <?php if($options=='no'){echo "selected";}?>>No, hide language box</option>
788
+ </select>
789
+ <?php }
790
+
791
+ public function googlelanguagetranslator_display_cb() {
792
+
793
+ $option_name = 'googlelanguagetranslator_display' ;
794
+ $new_value = 'Vertical';
795
+
796
+ if ( get_option( $option_name ) === false ) {
797
+
798
+ // The option does not exist, so we update it.
799
+ update_option( $option_name, $new_value );
800
+ }
801
+
802
+ $options = get_option (''.$option_name.''); ?>
803
+
804
+ <select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:170px;">
805
+ <option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
806
+ <option value="Horizontal" <?php if(get_option('googlelanguagetranslator_display')=='Horizontal'){echo "selected";}?>>Horizontal</option>
807
+ </select>
808
+ <?php }
809
+
810
+ public function googlelanguagetranslator_toolbar_cb() {
811
+
812
+ $option_name = 'googlelanguagetranslator_toolbar' ;
813
+ $new_value = 'Yes';
814
+
815
+ if ( get_option( $option_name ) === false ) {
816
+
817
+ // The option does not exist, so we update it.
818
+ update_option( $option_name, $new_value );
819
+ }
820
+
821
+ $options = get_option (''.$option_name.''); ?>
822
+
823
+ <select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:170px;">
824
+ <option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
825
+ <option value="No" <?php if(get_option('googlelanguagetranslator_toolbar')=='No'){echo "selected";}?>>No</option>
826
+ </select>
827
+ <?php }
828
+
829
+ public function googlelanguagetranslator_showbranding_cb() {
830
+
831
+ $option_name = 'googlelanguagetranslator_showbranding' ;
832
+ $new_value = 'Yes';
833
+
834
+ if ( get_option( $option_name ) === false ) {
835
+
836
+ // The option does not exist, so we update it.
837
+ update_option( $option_name, $new_value );
838
+ }
839
+
840
+ $options = get_option (''.$option_name.''); ?>
841
+
842
+ <select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:170px;">
843
+ <option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
844
+ <option value="No" <?php if(get_option('googlelanguagetranslator_showbranding')=='No'){echo "selected";}?>>No</option>
845
+ </select>
846
+ <?php }
847
+
848
+ public function googlelanguagetranslator_flags_alignment_cb() {
849
+
850
+ $option_name = 'googlelanguagetranslator_flags_alignment' ;
851
+ $new_value = 'flags_left';
852
+
853
+ if ( get_option( $option_name ) === false ) {
854
+
855
+ // The option does not exist, so we update it.
856
+ update_option( $option_name, 'flags_left' );
857
+ }
858
+
859
+ $options = get_option (''.$option_name.''); ?>
860
+
861
+ <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_left" value="flags_left" <?php if($options=='flags_left'){echo "checked";}?>/> Align Left<br/>
862
+ <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_right" value="flags_right" <?php if($options=='flags_right'){echo "checked";}?>/> Align Right
863
+ <?php }
864
+
865
+ public function googlelanguagetranslator_analytics_cb() {
866
+
867
+ $option_name = 'googlelanguagetranslator_analytics' ;
868
+ $new_value = 0;
869
+
870
+ if ( get_option( $option_name ) === false ) {
871
+
872
+ // The option does not exist, so we update it.
873
+ update_option( $option_name, $new_value );
874
+ }
875
+
876
+ $options = get_option (''.$option_name.'');
877
+
878
+ $html = '<input type="checkbox" name="googlelanguagetranslator_analytics" id="googlelanguagetranslator_analytics" value="1" '.checked(1,$options,false).'/> &nbsp; Activate Google Analytics tracking?';
879
+ echo $html;
880
+ }
881
+
882
+ public function googlelanguagetranslator_analytics_id_cb() {
883
+
884
+ $option_name = 'googlelanguagetranslator_analytics_id' ;
885
+ $new_value = '';
886
+
887
+ if ( get_option( $option_name ) === false ) {
888
+
889
+ // The option does not exist, so we update it.
890
+ update_option( $option_name, $new_value );
891
+ }
892
+
893
+ $options = get_option (''.$option_name.'');
894
+
895
+ $html = '<input type="text" name="googlelanguagetranslator_analytics_id" id="googlelanguagetranslator_analytics_id" value="'.$options.'" />';
896
+ echo $html;
897
+ }
898
+
899
+ public function googlelanguagetranslator_flag_size_cb() {
900
+
901
+ $option_name = 'googlelanguagetranslator_flag_size' ;
902
+ $new_value = '18';
903
+
904
+ if ( get_option( $option_name ) === false ) {
905
+
906
+ // The option does not exist, so we update it.
907
+ update_option( $option_name, $new_value );
908
+ }
909
+
910
+ $options = get_option (''.$option_name.''); ?>
911
+
912
+ <select name="googlelanguagetranslator_flag_size" id="googlelanguagetranslator_flag_size" style="width:110px;">
913
+ <option value="16" <?php if($options=='16'){echo "selected";}?>>16px</option>
914
+ <option value="18" <?php if($options=='18'){echo "selected";}?>>18px</option>
915
+ <option value="20" <?php if($options=='20'){echo "selected";}?>>20px</option>
916
+ <option value="22" <?php if($options=='22'){echo "selected";}?>>22px</option>
917
+ <option value="24" <?php if($options=='24'){echo "selected";}?>>24px</option>
918
+ </select>
919
+ <?php }
920
+
921
+ public function googlelanguagetranslator_flags_order_cb() {
922
+ $option_name = 'googlelanguagetranslator_flags_order';
923
+ $new_value = '';
924
+
925
+ if ( get_option ( $option_name ) === false ) {
926
+
927
+ // The option does not exist, so we update it.
928
+ update_option( $option_name, $new_value );
929
+ }
930
+
931
+ $options = get_option ( ''.$option_name.'' ); ?>
932
+
933
+ <input type="hidden" id="order" name="googlelanguagetranslator_flags_order" value="<?php print_r(get_option('googlelanguagetranslator_flags_order')); ?>" />
934
+ <?php
935
+ }
936
+
937
+ public function googlelanguagetranslator_css_cb() {
938
+
939
+ $option_name = 'googlelanguagetranslator_css' ;
940
+ $new_value = '';
941
+
942
+ if ( get_option( $option_name ) === false ) {
943
+
944
+ // The option does not exist, so we update it.
945
+ update_option( $option_name, $new_value );
946
+ }
947
+
948
+ $options = get_option (''.$option_name.'');
949
+
950
+ $html = '<textarea style="width:100%; height:200px" name="googlelanguagetranslator_css" id="googlelanguagetranslator_css">'.$options.'</textarea>';
951
+ echo $html;
952
+ }
953
+
954
+ public function googlelanguagetranslator_manage_translations_cb() {
955
+ $option_name = 'googlelanguagetranslator_manage_translations' ;
956
+ $new_value = 0;
957
+
958
+ if ( get_option( $option_name ) === false ) {
959
+
960
+ // The option does not exist, so we update it.
961
+ update_option( $option_name, $new_value );
962
+ }
963
+
964
+ $options = get_option (''.$option_name.'');
965
+
966
+ $html = '<input type="checkbox" name="googlelanguagetranslator_manage_translations" id="googlelanguagetranslator_manage_translations" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on translation management?';
967
+ echo $html;
968
+ }
969
+
970
+ public function googlelanguagetranslator_multilanguage_cb() {
971
+
972
+ $option_name = 'googlelanguagetranslator_multilanguage' ;
973
+ $new_value = 0;
974
+
975
+ if ( get_option( $option_name ) === false ) {
976
+
977
+ // The option does not exist, so we update it.
978
+ update_option( $option_name, $new_value );
979
+ }
980
+
981
+ $options = get_option (''.$option_name.'');
982
+
983
+ $html = '<input type="checkbox" name="googlelanguagetranslator_multilanguage" id="googlelanguagetranslator_multilanguage" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on multilanguage mode?';
984
+ echo $html;
985
+ }
986
+
987
+ public function googlelanguagetranslator_exclude_translation_cb() {
988
+
989
+ $option_name = 'googlelanguagetranslator_exclude_translation';
990
+ $new_value = '';
991
+
992
+ if (get_option($option_name) === false ) {
993
+ // The option does not exist, so we update it.
994
+ update_option( $option_name, $new_value );
995
+ }
996
+
997
+ $options = get_option (''.$option_name.'');
998
+
999
+ $html = '<input type="text" name="'.$option_name.'" id="'.$option_name.'" value="'.$options.'" />';
1000
+
1001
+ echo $html;
1002
+ }
1003
+
1004
+ public function page_layout_cb() {
1005
+ include( plugin_dir_path( __FILE__ ) . '/css/style.php'); ?>
1006
+ <?php add_thickbox(); ?>
1007
+ <div class="wrap">
1008
+ <div id="icon-options-general" class="icon32"></div>
1009
+ <h2><span class="notranslate">Google Language Translator</span></h2>
1010
+ <form action="<?php echo admin_url('options.php'); ?>" method="post">
1011
+ <div class="metabox-holder has-right-sidebar" style="float:left; width:65%">
1012
+ <div class="postbox" style="width: 100%">
1013
+ <h3 class="notranslate">Settings</h3>
1014
+
1015
+ <?php settings_fields('google_language_translator'); ?>
1016
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1017
+ <tr>
1018
+ <td style="width:60%" class="notranslate">Plugin Status:</td>
1019
+ <td class="notranslate"><?php $this->googlelanguagetranslator_active_cb(); ?></td>
1020
+ </tr>
1021
+
1022
+ <tr class="notranslate">
1023
+ <td>Choose the original language of your website</td>
1024
+ <td><?php $this->googlelanguagetranslator_language_cb(); ?></td>
1025
+ </tr>
1026
+
1027
+ <tr class="notranslate">
1028
+ <td>What translation languages will display in the language box?<br/>("All Languages" option <strong><u>must</u></strong> be chosen to show flags.)</td>
1029
+ <td><?php $this->googlelanguagetranslator_language_option_cb(); ?></td>
1030
+ </tr>
1031
+
1032
+ <tr class="notranslate languages">
1033
+ <td colspan="2"><?php $this->language_display_settings_cb(); ?></td>
1034
+ </tr>
1035
+
1036
+ <tr class="notranslate">
1037
+ <td class="choose_flags_intro">Show flag images?<br/>(Display up to 81 flags above the translator)</td>
1038
+ <td class="choose_flags_intro"><?php $this->googlelanguagetranslator_flags_cb(); ?></td>
1039
+ </tr>
1040
+
1041
+ <tr class="notranslate choose_flags">
1042
+ <td class="choose_flags">Choose the flags you want to display:</td>
1043
+ <td></td>
1044
+ </tr>
1045
+
1046
+ <tr class="notranslate">
1047
+ <td colspan="2" class="choose_flags"><?php $this->flag_display_settings_cb(); ?></td>
1048
+ </tr>
1049
+
1050
+ <tr class="notranslate">
1051
+ <td>Show floating translation widget? <strong style="color:red">(New!)</strong><br/>
1052
+ <span>("All Languages" option <strong><u>must</u></strong> be chosen to show widget.)</span>
1053
+ </td>
1054
+ <td><?php $this->googlelanguagetranslator_floating_widget_cb(); ?></td>
1055
+ </tr>
1056
+
1057
+ <tr class="notranslate">
1058
+ <td>Show translate box?</td>
1059
+ <td><?php $this->googlelanguagetranslator_translatebox_cb(); ?></td>
1060
+ </tr>
1061
+
1062
+ <tr class="notranslate">
1063
+ <td>Layout option:</td>
1064
+ <td><?php $this->googlelanguagetranslator_display_cb(); ?></td>
1065
+ </tr>
1066
+
1067
+ <tr class="notranslate">
1068
+ <td>Show Google Toolbar?</td>
1069
+ <td><?php $this->googlelanguagetranslator_toolbar_cb(); ?></td>
1070
+ </tr>
1071
+
1072
+ <tr class="notranslate">
1073
+ <td>Show Google Branding? &nbsp;<a href="https://developers.google.com/translate/v2/attribution" target="_blank">Learn more</a></td>
1074
+ <td><?php $this->googlelanguagetranslator_showbranding_cb(); ?></td>
1075
+ </tr>
1076
+
1077
+ <tr class="alignment notranslate">
1078
+ <td class="flagdisplay">Align the translator left or right?</td>
1079
+ <td class="flagdisplay"><?php $this->googlelanguagetranslator_flags_alignment_cb(); ?></td>
1080
+ </tr>
1081
+
1082
+ <tr class="manage_translations notranslate">
1083
+ <td>Turn on translation management? &nbsp;<a href="#TB_inline?width=200&height=300&inlineId=translation-management-description" title="What is Translation Management?" class="thickbox">Learn more</a><div id="translation-management-description" style="display:none"><p>Translation management is an interface that allows you to manage specific words and phrases on your website. The interface is linked directly to your Google Account, and no special subscriptions are necessary to setup this feature.</p><p>If translation management setting is checked, users who browse your website can hover their mouse over specific words and phrases, then send translation suggestions directly to your Google Translate account! You can then "approve" those suggestions, and Google will automatically display them when translations are requested by your users.</p><p>Translation management requires that you insert a custom meta tag into the <code>head</code> section of your website.</p><p><a href="http://translate.google.com/manager/website/settings" target="_blank">Click here to to get the required meta tag</a></p></div></td>
1084
+ <td><?php $this->googlelanguagetranslator_manage_translations_cb(); ?></td>
1085
+ </tr>
1086
+
1087
+ <tr class="multilanguage notranslate">
1088
+ <td>Multilanguage Page option? &nbsp;<a href="#TB_inline?width=200&height=150&inlineId=multilanguage-page-description" title="What is the Multi-Language Page Option?" class="thickbox">Learn more</a><div id="multilanguage-page-description" style="display:none"><p>If checked, Google will automatically convert text written in multiple languages, into the single language requested by your user.</p><p>In most cases, this setting is not recommended, although for certain websites it might be necessary.</p></div></td>
1089
+ <td><?php $this->googlelanguagetranslator_multilanguage_cb(); ?></td>
1090
+ </tr>
1091
+
1092
+ <tr class="notranslate">
1093
+ <td>Google Analytics:</td>
1094
+ <td><?php $this->googlelanguagetranslator_analytics_cb(); ?></td>
1095
+ </tr>
1096
+
1097
+ <tr class="analytics notranslate">
1098
+ <td>Google Analytics ID (Ex. 'UA-11117410-2')</td>
1099
+ <td><?php $this->googlelanguagetranslator_analytics_id_cb(); ?></td>
1100
+ </tr>
1101
+
1102
+ <tr class="notranslate">
1103
+ <td>Full widget usage in pages/posts/sidebar:</td>
1104
+ <td><code>[google-translator]</code></td>
1105
+ </tr>
1106
+ </table>
1107
+
1108
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1109
+ <tr class="notranslate">
1110
+ <td style="width:40%">Full widget usage in header/footer or page template:</td>
1111
+ <td style="width:60%"><code>&lt;?php echo do_shortcode('[google-translator]'); ?&gt;</code></td>
1112
+ </tr>
1113
+
1114
+ <tr class="notranslate">
1115
+ <td>Single language usage in<br/>nav menu/pages/posts</td>
1116
+ <td><code>[glt language="Spanish" label="Español"]</code></td>
1117
+ </tr>
1118
+
1119
+ <tr class="notranslate">
1120
+ <td colspan="2">
1121
+ <a href="#TB_inline?width=200&height=450&inlineId=single-language-shortcode-description" title="How to place a single language in your Wordpress menu" class="thickbox">How to place a single language in your Wordpress menu</a><div id="single-language-shortcode-description" style="display:none"><p>For menu usage, you need to create a new menu, or use an existing menu, by navigating to "Appearance > Menus".</p><p>First you will need to enable "descriptions" for your menu items, which can be found in a tab labeled "Screen Options" in the upper-right area of the page.</p><p>Once descriptions are enabled, follow these steps:<br/><ol><li>Create a new menu item using "Link" as the menu item type.</li><li>Use <code style="border:none">#</code> for the URL</li><li>Enter a navigation label of your choice. This label does not appear on your website - it is meant only to help you identify the menu item.</li><li>Place the following shortcode into the "description" field, and modify it to display the language and navigation label of your choice:</p></li></ol>
1122
+ <p><code>[glt language="Spanish" label="Español"]</code></p>
1123
+ </div></td>
1124
+ </tr>
1125
+
1126
+ <tr class="notranslate">
1127
+ <td><?php submit_button(); ?></td>
1128
+ <td></td>
1129
+ </tr>
1130
+ </table>
1131
+
1132
+ </div> <!-- .postbox -->
1133
+ </div> <!-- .metbox-holder -->
1134
+
1135
+ <div class="metabox-holder" style="float:right; clear:right; width:33%">
1136
+ <div class="postbox">
1137
+ <h3 class="notranslate">Preview</h3>
1138
+ <table style="width:100%">
1139
+ <tr>
1140
+ <td style="box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; padding:15px 15px; margin:0px"><span style="color:red; font-weight:bold" class="notranslate">(New!)</span><span class="notranslate"> Drag &amp; drop flags to change their position.<br/><br/>(Note: flag order resets when flags are added/removed)</span><br/><br/><?php echo do_shortcode('[google-translator]'); ?><p class="hello"><span class="notranslate">Translated text:</span> &nbsp; <span>Hello</span></p></td>
1141
+ </tr>
1142
+
1143
+ <tr>
1144
+ <td><?php if (isset ($_POST['googlelanguagetranslator_flags_order']) ) { echo $_POST['googlelanguagetranslator_flags_order']; } ?></td>
1145
+ </tr>
1146
+
1147
+
1148
+ </table>
1149
+ </div> <!-- .postbox -->
1150
+ </div> <!-- .metabox-holder -->
1151
+
1152
+ <div id="glt_advanced_settings" class="metabox-holder notranslate" style="float: right; width: 33%;">
1153
+ <div class="postbox">
1154
+ <h3>Advanced Settings</h3>
1155
+ <div class="inside">
1156
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1157
+ <tr class="notranslate">
1158
+ <td class="advanced">Select flag size:</td>
1159
+ <td class="advanced"><?php $this->googlelanguagetranslator_flag_size_cb(); ?></td>
1160
+ </tr>
1161
+ </table>
1162
+ </div>
1163
+ </div>
1164
+ </div>
1165
+
1166
+
1167
+ <div class="metabox-holder notranslate" style="float: right; width: 33%;">
1168
+ <div class="postbox">
1169
+ <h3>Add CSS Styles</h3>
1170
+ <div class="inside">
1171
+ <p>You can apply any necessary CSS styles below:</p>
1172
+ <?php $this->googlelanguagetranslator_css_cb(); ?>
1173
+ </div>
1174
+ </div>
1175
+ </div>
1176
+ <?php $this->googlelanguagetranslator_flags_order_cb(); ?>
1177
+ </form>
1178
+
1179
+ <div class="metabox-holder notranslate" style="float: right; width: 33%;">
1180
+ <div class="postbox">
1181
+ <h3>GLT Premium 4.0.1 is Here! $15</h3>
1182
+ <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 />
1183
+ <ul id="features" style="margin-left:15px">
1184
+ <li style="list-style:square outside"><span style="color:red; font-weight:bold">New!</span> Manual Translation Module!</li>
1185
+ <li style="list-style:square outside"><span style="color:red; font-weight:bold">New!</span> Exclude any specific area of your website from translation, directly from your settings panel</li>
1186
+ <li style="list-style:square outside">81 Languages</li>
1187
+ <li style="list-style:square outside">jQuery-powered language switcher<br/>(No Adobe Flash required)</li>
1188
+ <li style="list-style:square outside">Add single languages to your menus/pages/posts</li>
1189
+ <li style="list-style:square outside">Show/hide images or text for each language</li>
1190
+ <li style="list-style:square outside">Language switcher loads inline with page content</li>
1191
+ <li style="list-style:square outside">Custom flag choices for English, Spanish and Portuguese</li>
1192
+ <li style="list-style:square outside">User-friendly URLs, hide or show <code>lang</code> attribute</li>
1193
+ <li style="list-style:square outside">Drag/drop flags to re-arrange their order</li>
1194
+ <li style="list-style:square outside">Full access to our support forum</li>
1195
+ <li style="list-style:square outside">FREE access to all future updates</li>
1196
+ </ul>
1197
+ </div>
1198
+ </div>
1199
+ </div>
1200
+
1201
+ <div class="metabox-holder notranslate" style="float: right; width: 33%;">
1202
+ <div class="postbox">
1203
+ <h3>Please Consider A Donation</h3>
1204
+ <div class="inside">If you like this plugin and find it useful, help keep this plugin actively developed by clicking the donate button <br /><br />
1205
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1206
+ <input type="hidden" name="cmd" value="_donations">
1207
+ <input type="hidden" name="business" value="robertmyrick@hotmail.com">
1208
+ <input type="hidden" name="lc" value="US">
1209
+ <input type="hidden" name="item_name" value="Support Studio 88 Design and help us bring you more Wordpress goodies! Any donation is kindly appreciated. Thank you!">
1210
+ <input type="hidden" name="no_note" value="0">
1211
+ <input type="hidden" name="currency_code" value="USD">
1212
+ <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
1213
+ <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
1214
+ <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
1215
+ </form>
1216
+ <br />
1217
+ <br />
1218
+ </div>
1219
+ </div>
1220
+ </div>
1221
+ </div> <!-- .wrap -->
1222
+ <?php
1223
+ }
1224
+ }
1225
  $google_language_translator = new google_language_translator();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Plugin link: http://www.wp-studio.net/how-it-works
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: 4.0
8
- stable tag: 4.0.7
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
 
@@ -46,6 +46,9 @@ A: Yes! Add the "notranslate" class to the HTML element containing your text. Fo
46
 
47
  == Changelog ==
48
 
 
 
 
49
  4.0.7
50
  - Fixed a CSS error in the settings panel display.
51
  - Fixed the coding issue when "Specific Languages" option is chosen - the shortcode was not displaying the language dropdown.
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: 4.0
8
+ stable tag: 4.0.8
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
 
46
 
47
  == Changelog ==
48
 
49
+ 4.0.8
50
+ - Fixed the small syntax issue related to the Google Analytics tracking number - it was another cause of the language box not displaying.
51
+
52
  4.0.7
53
  - Fixed a CSS error in the settings panel display.
54
  - Fixed the coding issue when "Specific Languages" option is chosen - the shortcode was not displaying the language dropdown.