Google Language Translator - Version 5.0.40

Version Description

Download this release

Release Info

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

Code changes from version 5.0.39 to 5.0.40

Files changed (2) hide show
  1. google-language-translator.php +1351 -1359
  2. readme.txt +407 -404
google-language-translator.php CHANGED
@@ -1,1360 +1,1352 @@
1
- <?php
2
- /*
3
- Plugin Name: Google Language Translator
4
- Plugin URI: http://www.studio88design.com/plugins/google-language-translator
5
- Version: 5.0.39
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
- //ini_set('display_errors', 1);
12
- //ini_set('display_startup_errors', 1);
13
- //error_reporting(E_ALL);
14
-
15
- include( plugin_dir_path( __FILE__ ) . 'widget.php');
16
-
17
- class google_language_translator {
18
-
19
- public $languages_array;
20
-
21
- public function __construct() {
22
-
23
- $this->languages_array = array (
24
- 'af' => 'Afrikaans',
25
- 'sq' => 'Albanian',
26
- 'am' => 'Amharic',
27
- 'ar' => 'Arabic',
28
- 'hy' => 'Armenian',
29
- 'az' => 'Azerbaijani',
30
- 'eu' => 'Basque',
31
- 'be' => 'Belarusian',
32
- 'bn' => 'Bengali',
33
- 'bs' => 'Bosnian',
34
- 'bg' => 'Bulgarian',
35
- 'ca' => 'Catalan',
36
- 'ceb' => 'Cebuano',
37
- 'ny' => 'Chichewa',
38
- 'zh-CN' => 'Chinese (Simplified)',
39
- 'zh-TW' => 'Chinese (Traditional)',
40
- 'co' => 'Corsican',
41
- 'hr' => 'Croatian',
42
- 'cs' => 'Czech',
43
- 'da' => 'Danish',
44
- 'nl' => 'Dutch',
45
- 'en' => 'English',
46
- 'eo' => 'Esperanto',
47
- 'et' => 'Estonian',
48
- 'tl' => 'Filipino',
49
- 'fi' => 'Finnish',
50
- 'fr' => 'French',
51
- 'fy' => 'Frisian',
52
- 'gl' => 'Galician',
53
- 'ka' => 'Georgian',
54
- 'de' => 'German',
55
- 'el' => 'Greek',
56
- 'gu' => 'Gujarati',
57
- 'ht' => 'Haitian',
58
- 'ha' => 'Hausa',
59
- 'haw' => 'Hawaiian',
60
- 'iw' => 'Hebrew',
61
- 'hi' => 'Hindi',
62
- 'hmn' => 'Hmong',
63
- 'hu' => 'Hungarian',
64
- 'is' => 'Icelandic',
65
- 'ig' => 'Igbo',
66
- 'id' => 'Indonesian',
67
- 'ga' => 'Irish',
68
- 'it' => 'Italian',
69
- 'ja' => 'Japanese',
70
- 'jw' => 'Javanese',
71
- 'kn' => 'Kannada',
72
- 'kk' => 'Kazakh',
73
- 'km' => 'Khmer',
74
- 'ko' => 'Korean',
75
- 'ku' => 'Kurdish',
76
- 'ky' => 'Kyrgyz',
77
- 'lo' => 'Lao',
78
- 'la' => 'Latin',
79
- 'lv' => 'Latvian',
80
- 'lt' => 'Lithuanian',
81
- 'lb' => 'Luxembourgish',
82
- 'mk' => 'Macedonian',
83
- 'mg' => 'Malagasy',
84
- 'ml' => 'Malayalam',
85
- 'ms' => 'Malay',
86
- 'mt' => 'Maltese',
87
- 'mi' => 'Maori',
88
- 'mr' => 'Marathi',
89
- 'mn' => 'Mongolian',
90
- 'my' => 'Myanmar (Burmese)',
91
- 'ne' => 'Nepali',
92
- 'no' => 'Norwegian',
93
- 'ps' => 'Pashto',
94
- 'fa' => 'Persian',
95
- 'pl' => 'Polish',
96
- 'pt' => 'Portuguese',
97
- 'pa' => 'Punjabi',
98
- 'ro' => 'Romanian',
99
- 'ru' => 'Russian',
100
- 'sr' => 'Serbian',
101
- 'sn' => 'Shona',
102
- 'st' => 'Sesotho',
103
- 'sd' => 'Sindhi',
104
- 'si' => 'Sinhala',
105
- 'sk' => 'Slovak',
106
- 'sl' => 'Slovenian',
107
- 'sm' => 'Samoan',
108
- 'gd' => 'Scots Gaelic',
109
- 'so' => 'Somali',
110
- 'es' => 'Spanish',
111
- 'su' => 'Sundanese',
112
- 'sw' => 'Swahili',
113
- 'sv' => 'Swedish',
114
- 'tg' => 'Tajik',
115
- 'ta' => 'Tamil',
116
- 'te' => 'Telugu',
117
- 'th' => 'Thai',
118
- 'tr' => 'Turkish',
119
- 'uk' => 'Ukrainian',
120
- 'ur' => 'Urdu',
121
- 'uz' => 'Uzbek',
122
- 'vi' => 'Vietnamese',
123
- 'cy' => 'Welsh',
124
- 'xh' => 'Xhosa',
125
- 'yi' => 'Yiddish',
126
- 'yo' => 'Yoruba',
127
- 'zu' => 'Zulu',
128
- );
129
-
130
- register_activation_hook( __FILE__, array(&$this,'glt_activate'));
131
- register_deactivation_hook( __FILE__, array(&$this,'glt_deactivate'));
132
-
133
- add_action( 'admin_menu', array( &$this, 'add_my_admin_menus'));
134
- add_action('admin_init',array(&$this, 'initialize_settings'));
135
- add_action('wp_head',array(&$this, 'load_css'));
136
- add_action('wp_footer',array(&$this, 'footer_script'));
137
- add_shortcode( 'google-translator',array(&$this, 'google_translator_shortcode'));
138
- add_shortcode( 'glt', array(&$this, 'google_translator_menu_language'));
139
- add_filter('widget_text','do_shortcode');
140
- add_filter('walker_nav_menu_start_el', array(&$this,'menu_shortcodes') , 10 , 2);
141
- add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'glt_settings_link') );
142
-
143
- if (!is_admin()) {
144
- add_action('init',array(&$this, 'flags'));
145
- }
146
- }
147
-
148
- public function glt_activate() {
149
- add_option('googlelanguagetranslator_active', 1);
150
- add_option('googlelanguagetranslator_language','en');
151
- add_option('googlelanguagetranslator_flags', 1);
152
- add_option('language_display_settings',array ('en' => 1));
153
- add_option('googlelanguagetranslator_translatebox','yes');
154
- add_option('googlelanguagetranslator_display','Vertical');
155
- add_option('googlelanguagetranslator_toolbar','Yes');
156
- add_option('googlelanguagetranslator_showbranding','Yes');
157
- add_option('googlelanguagetranslator_flags_alignment','flags_left');
158
- add_option('googlelanguagetranslator_analytics', 0);
159
- add_option('googlelanguagetranslator_analytics_id','');
160
- add_option('googlelanguagetranslator_css','');
161
- add_option('googlelanguagetranslator_multilanguage',0);
162
- add_option('googlelanguagetranslator_floating_widget','yes');
163
- add_option('googlelanguagetranslator_flag_size','18');
164
- add_option('googlelanguagetranslator_flags_order','');
165
- add_option('googlelanguagetranslator_english_flag_choice','');
166
- add_option('googlelanguagetranslator_spanish_flag_choice','');
167
- add_option('googlelanguagetranslator_portuguese_flag_choice','');
168
- add_option('googlelanguagetranslator_floating_widget_text', 'Translate &raquo;');
169
- add_option('googlelanguagetranslator_floating_widget_text_allow_translation', 0);
170
- delete_option('googlelanguagetranslator_manage_translations',0);
171
- delete_option('flag_display_settings');
172
- }
173
-
174
- public function glt_deactivate() {
175
- delete_option('flag_display_settings');
176
- delete_option('googlelanguagetranslator_language_option');
177
- }
178
-
179
- public function glt_settings_link ( $links ) {
180
- $settings_link = array(
181
- '<a href="' . admin_url( 'options-general.php?page=google_language_translator' ) . '">Settings</a>',
182
- );
183
- return array_merge( $links, $settings_link );
184
- }
185
-
186
- public function add_my_admin_menus(){
187
- $p = add_options_page('Google Language Translator', 'Google Language Translator', 'manage_options', 'google_language_translator', array(&$this, 'page_layout_cb'));
188
-
189
- add_action( 'load-' . $p, array(&$this, 'load_admin_js' ));
190
- }
191
-
192
- public function load_admin_js(){
193
- add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_admin_js' ));
194
- add_action('admin_footer',array(&$this, 'footer_script'));
195
- }
196
-
197
- public function enqueue_admin_js(){
198
- wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
199
-
200
- if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
201
- wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
202
- wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
203
- wp_enqueue_style( 'glt-toolbar-styles' );
204
- }
205
-
206
- wp_enqueue_script( 'jquery-ui-core');
207
- wp_enqueue_script( 'jquery-ui-sortable');
208
- wp_enqueue_script( 'load_flags', plugins_url('js/load-flags.js',__FILE__), array('jquery'));
209
- wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
210
- wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
211
- wp_enqueue_style( 'style.css' );
212
- }
213
-
214
- public function flags() {
215
- wp_enqueue_script( 'glt-flags', plugins_url('js/load-flags.js',__FILE__), array('jquery'));
216
-
217
- if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
218
- wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
219
- wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
220
- wp_enqueue_style( 'glt-toolbar-styles' );
221
- }
222
-
223
- wp_register_style( 'google-language-translator', plugins_url('css/style.css', __FILE__) );
224
- wp_enqueue_style( 'google-language-translator' );
225
- }
226
-
227
- public function load_css() {
228
- include( plugin_dir_path( __FILE__ ) . '/css/style.php');
229
- }
230
-
231
- public function google_translator_shortcode() {
232
-
233
- if (get_option('googlelanguagetranslator_display')=='Vertical' || get_option('googlelanguagetranslator_display')=='SIMPLE'){
234
- return $this->googlelanguagetranslator_vertical();
235
- }
236
- elseif(get_option('googlelanguagetranslator_display')=='Horizontal'){
237
- return $this->googlelanguagetranslator_horizontal();
238
- }
239
- }
240
-
241
- public function googlelanguagetranslator_included_languages() {
242
- $get_language_choices = get_option ('language_display_settings');
243
-
244
- foreach ($get_language_choices as $key=>$value):
245
- if ($value == 1):
246
- $items[] = $key;
247
- endif;
248
- endforeach;
249
-
250
- $comma_separated = implode(",",array_values($items));
251
- $lang = ", includedLanguages:'".$comma_separated."'";
252
- return $lang;
253
- }
254
-
255
- public function analytics() {
256
- if ( get_option('googlelanguagetranslator_analytics') == 1 ) {
257
- $analytics_id = get_option('googlelanguagetranslator_analytics_id');
258
- $analytics = "gaTrack: true, gaId: '".$analytics_id."'";
259
-
260
- if (!empty ($analytics_id) ):
261
- return ', '.$analytics;
262
- endif;
263
- }
264
- }
265
-
266
- public function menu_shortcodes( $item_output,$item ) {
267
- if ( !empty($item->description)) {
268
- $output = do_shortcode($item->description);
269
-
270
- if ( $output != $item->description )
271
- $item_output = $output;
272
- }
273
- return $item_output;
274
- }
275
-
276
- public function google_translator_menu_language($atts, $content = '') {
277
- extract(shortcode_atts(array(
278
- "language" => 'Spanish',
279
- "label" => 'Spanish',
280
- "image" => 'no',
281
- "text" => 'yes',
282
- "image_size" => '24',
283
- "label" => 'Espa&ntilde;ol'
284
- ), $atts));
285
-
286
- $default_language = get_option('googlelanguagetranslator_language');
287
- $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
288
- $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
289
- $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
290
- $language_code = array_search($language,$this->languages_array);
291
- $language_name = $language;
292
- $language_name_flag = $language_name;
293
-
294
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
295
- $language_name_flag = 'canada';
296
- }
297
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
298
- $language_name_flag = 'united-states';
299
- }
300
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
301
- $language_name_flag = 'mexico';
302
- }
303
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
304
- $language_name_flag = 'brazil';
305
- }
306
-
307
- return "<a class='nturl notranslate ".$language_code." ".$language_name_flag." single-language flag' title='".$language."'>".($image=='yes' ? "<span class='flag size".$image_size."'></span>" : '') .($text=='yes' ? $label : '')."</a>";
308
- }
309
-
310
- public function footer_script() {
311
- global $shortcode_started;
312
-
313
- $default_language = get_option('googlelanguagetranslator_language');
314
- $language_choices = $this->googlelanguagetranslator_included_languages();
315
- $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
316
- $new_languages_array = explode(",",$new_languages_array_string);
317
- $new_languages_array_codes = array_values($new_languages_array);
318
- $new_languages_array_count = count($new_languages_array);
319
- $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
320
- $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
321
- $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
322
- $flag_width = get_option('googlelanguagetranslator_flag_size');
323
- $get_language_choices = get_option('language_display_settings');
324
- $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
325
- $floating_widget_text = get_option ('googlelanguagetranslator_floating_widget_text');
326
- $floating_widget_text_translation_allowed = get_option ('googlelanguagetranslator_floating_widget_text_allow_translation');
327
- $is_active = get_option ( 'googlelanguagetranslator_active' );
328
- $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
329
- $str = ''; ?>
330
- <script>jQuery(document).ready(function($) { $('#flags a, a.single-language, .tool-items a').each(function() { $(this).attr('data-lang', $(this).attr('title')); }); $(document.body).on("click","a.flag", function(){function l(){doGoogleLanguageTranslator(default_lang+"|"+default_lang); }function n(){doGoogleLanguageTranslator(default_lang+"|"+lang_prefix); } lang_text=$(this).attr('data-lang'),default_lang="<?php echo get_option('googlelanguagetranslator_language'); ?>",lang_prefix=$(this).attr("class").split(" ")[2],$(".tool-container").hide(),lang_prefix==default_lang?l():n()}),0==$("body > #google_language_translator").length&&$("#glt-footer").html("<div id='google_language_translator'></div>"); });</script><script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit'></script>
331
-
332
- <?php
333
-
334
- if( $is_active == 1) {
335
- if ($floating_widget=='yes') {
336
- $str.='<div id="glt-translate-trigger"><span'.($floating_widget_text_translation_allowed != 1 ? ' class="notranslate"' : ' class="translate"').'>'.(empty($floating_widget_text) ? 'Translate &raquo;' : $floating_widget_text).'</span></div>';
337
- $str.='<div id="glt-toolbar"></div>';
338
- } //endif $floating_widget
339
-
340
- $str.='<div id="flags" style="display:none" class="size'.$flag_width.'">';
341
- $str.='<ul id="sortable" class="ui-sortable">';
342
- if (empty($new_languages_array_string)) {
343
- foreach ($this->languages_array as $key=>$value) {
344
- $language_code = $key;
345
- $language_name = $value;
346
- $language_name_flag = $language_name;
347
-
348
- if (get_option('googlelanguagetranslator_flags') == 1) {
349
- if ( isset ( $get_language_choices[$language_code] ) ) {
350
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
351
- $language_name_flag = 'canada';
352
- }
353
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
354
- $language_name_flag = 'united-states';
355
- }
356
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
357
- $language_name_flag = 'mexico';
358
- }
359
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
360
- $language_name_flag = 'brazil';
361
- }
362
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
363
- } //isset
364
- } //endif
365
- }//foreach
366
- } else {
367
- if ($new_languages_array_count != count($get_language_choices)):
368
- foreach ($get_language_choices as $key => $value) {
369
- $language_code = $key;
370
- $language_name = $this->languages_array[$key];
371
- $language_name_flag = $language_name;
372
-
373
- if (get_option('googlelanguagetranslator_flags') == 1) {
374
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
375
- $language_name_flag = 'canada';
376
- }
377
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
378
- $language_name_flag = 'united-states';
379
- }
380
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
381
- $language_name_flag = 'mexico';
382
- }
383
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
384
- $language_name_flag = 'brazil';
385
- }
386
-
387
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
388
- } //get_option
389
- } //foreach
390
- else:
391
- foreach ($new_languages_array_codes as $value) {
392
- $language_name = $value;
393
- $language_code = array_search ($language_name, $this->languages_array);
394
- $language_name_flag = $language_name;
395
-
396
- if (get_option('googlelanguagetranslator_flags') == 1) {
397
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
398
- $language_name_flag = 'canada';
399
- }
400
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
401
- $language_name_flag = 'united-states';
402
- }
403
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
404
- $language_name_flag = 'mexico';
405
- }
406
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
407
- $language_name_flag = 'brazil';
408
- }
409
-
410
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
411
- } //get_option
412
- }//foreach
413
- endif;
414
- }//endif
415
- $str.='</ul>';
416
- $str.='</div>';
417
- }
418
-
419
- $language_choices = $this->googlelanguagetranslator_included_languages();
420
- $layout = get_option('googlelanguagetranslator_display');
421
- $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
422
- $horizontal_layout = ', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL';
423
- $simple_layout = ', layout: google.translate.TranslateElement.InlineLayout.SIMPLE';
424
- $auto_display = ', autoDisplay: false';
425
- $default_language = get_option('googlelanguagetranslator_language');
426
-
427
- if ($is_multilanguage == 1) {
428
- $multilanguagePage = ', multilanguagePage:true';
429
- $str.="<div id='glt-footer'></div><script type='text/javascript'>function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : ($layout=='SIMPLE' ? $simple_layout : '')) . $auto_display . $multilanguagePage . $this->analytics()."}, 'google_language_translator');}</script>";
430
- echo $str;
431
-
432
- } elseif ($is_multilanguage == 0) {
433
- $str.="<div id='glt-footer'></div><script type='text/javascript'>function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : ($layout=='SIMPLE' ? $simple_layout : '')) . $auto_display . $this->analytics()."}, 'google_language_translator');}</script>";
434
- echo $str;
435
- }
436
- }
437
-
438
- public function googlelanguagetranslator_vertical() {
439
- global $shortcode_started;
440
- $i = 0;
441
- $shortcode_started = 'true';
442
- $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
443
- $new_languages_array = explode(",",$new_languages_array_string);
444
- $new_languages_array_codes = array_values($new_languages_array);
445
- $new_languages_array_count = count($new_languages_array);
446
- $get_language_choices = get_option ('language_display_settings');
447
- $flag_width = get_option('googlelanguagetranslator_flag_size');
448
- $default_language_code = get_option('googlelanguagetranslator_language');
449
- $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
450
- $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
451
- $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
452
- $is_active = get_option ( 'googlelanguagetranslator_active' );
453
- $language_choices = $this->googlelanguagetranslator_included_languages();
454
- $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
455
- $str = '';
456
-
457
- if( $is_active == 1):
458
- $str.='<div id="flags" class="size'.$flag_width.'">';
459
- $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
460
-
461
- if (empty($new_languages_array_string)):
462
- foreach ($this->languages_array as $key=>$value) {
463
- $language_code = $key;
464
- $language_name = $value;
465
- $language_name_flag = $language_name;
466
-
467
- if (get_option('googlelanguagetranslator_flags') == 1) {
468
-
469
- if ($get_language_choices[$language_code]==1) {
470
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
471
- $language_name_flag = 'canada';
472
- }
473
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
474
- $language_name_flag = 'united-states';
475
- }
476
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
477
- $language_name_flag = 'mexico';
478
- }
479
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
480
- $language_name_flag = 'brazil';
481
- }
482
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
483
- } //endif
484
- } //endif
485
- }//foreach
486
- else:
487
- if ($new_languages_array_count != count($get_language_choices)):
488
- foreach ($get_language_choices as $key => $value) {
489
- $language_code = $key;
490
- $language_name = $this->languages_array[$key];
491
- $language_name_flag = $language_name;
492
-
493
- if (get_option('googlelanguagetranslator_flags') == 1) {
494
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
495
- $language_name_flag = 'canada';
496
- }
497
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
498
- $language_name_flag = 'united-states';
499
- }
500
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
501
- $language_name_flag = 'mexico';
502
- }
503
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
504
- $language_name_flag = 'brazil';
505
- }
506
-
507
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
508
- } //get_option
509
- } //foreach
510
- else:
511
- foreach ($new_languages_array_codes as $value) {
512
- $language_name = $value;
513
- $language_code = array_search ($language_name, $this->languages_array);
514
- $language_name_flag = $language_name;
515
-
516
- if (get_option('googlelanguagetranslator_flags') == 1) {
517
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
518
- $language_name_flag = 'canada';
519
- }
520
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
521
- $language_name_flag = 'united-states';
522
- }
523
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
524
- $language_name_flag = 'mexico';
525
- }
526
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
527
- $language_name_flag = 'brazil';
528
- }
529
-
530
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
531
- } //get_option
532
- }//foreach
533
- endif;
534
- endif;
535
- $str.='</ul>';
536
- $str.='</div>';
537
- $str.='<div id="google_language_translator"></div>';
538
- return $str;
539
- endif;
540
- } // End glt_vertical
541
-
542
- public function googlelanguagetranslator_horizontal(){
543
- $shortcode_started = 'true';
544
- $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
545
- $new_languages_array = explode(",",$new_languages_array_string);
546
- $new_languages_array_codes = array_values($new_languages_array);
547
- $new_languages_array_count = count($new_languages_array);
548
- $get_language_choices = get_option ('language_display_settings');
549
- $flag_width = get_option('googlelanguagetranslator_flag_size');
550
- $default_language_code = get_option('googlelanguagetranslator_language');
551
- $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
552
- $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
553
- $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
554
- $is_active = get_option ( 'googlelanguagetranslator_active' );
555
- $language_choices = $this->googlelanguagetranslator_included_languages();
556
- $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
557
- $str = '';
558
-
559
- if( $is_active == 1):
560
- $str.='<div id="flags" class="size'.$flag_width.'">';
561
- $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
562
-
563
- if (empty($new_languages_array_string)):
564
- foreach ($this->languages_array as $key=>$value) {
565
- $language_code = $key;
566
- $language_name = $value;
567
- $language_name_flag = $language_name;
568
-
569
- if (get_option('googlelanguagetranslator_flags') == 1) {
570
-
571
- if ($get_language_choices[$language_code]==1) {
572
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
573
- $language_name_flag = 'canada';
574
- }
575
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
576
- $language_name_flag = 'united-states';
577
- }
578
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
579
- $language_name_flag = 'mexico';
580
- }
581
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
582
- $language_name_flag = 'brazil';
583
- }
584
- $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
585
- } //endif
586
- } //endif
587
- }//foreach
588
- else:
589
- if ($new_languages_array_count != count($get_language_choices)):
590
- foreach ($get_language_choices as $key => $value) {
591
- $language_code = $key;
592
- $language_name = $this->languages_array[$key];
593
- $language_name_flag = $language_name;
594
-
595
- if (get_option('googlelanguagetranslator_flags') == 1) {
596
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
597
- $language_name_flag = 'canada';
598
- }
599
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
600
- $language_name_flag = 'united-states';
601
- }
602
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
603
- $language_name_flag = 'mexico';
604
- }
605
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
606
- $language_name_flag = 'brazil';
607
- }
608
-
609
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
610
- } //get_option
611
- } //foreach
612
- else:
613
- foreach ($new_languages_array_codes as $value) {
614
- $language_name = $value;
615
- $language_code = array_search ($language_name, $this->languages_array);
616
- $language_name_flag = $language_name;
617
-
618
- if (get_option('googlelanguagetranslator_flags') == 1) {
619
- if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
620
- $language_name_flag = 'canada';
621
- }
622
- if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
623
- $language_name_flag = 'united-states';
624
- }
625
- if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
626
- $language_name_flag = 'mexico';
627
- }
628
- if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
629
- $language_name_flag = 'brazil';
630
- }
631
-
632
- $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
633
- } //get_option
634
- }//foreach
635
- endif;
636
- endif;
637
- $str.='</ul>';
638
- $str.='</div>';
639
- $str.='<div id="google_language_translator"></div>';
640
- return $str;
641
- endif;
642
- } // End glt_horizontal
643
-
644
- public function initialize_settings() {
645
- add_settings_section('glt_settings','Settings','','google_language_translator');
646
-
647
- $settings_name_array = array (
648
- 'googlelanguagetranslator_active','googlelanguagetranslator_language','language_display_settings','googlelanguagetranslator_flags','googlelanguagetranslator_translatebox','googlelanguagetranslator_display','googlelanguagetranslator_toolbar','googlelanguagetranslator_showbranding','googlelanguagetranslator_flags_alignment','googlelanguagetranslator_analytics','googlelanguagetranslator_analytics_id','googlelanguagetranslator_css','googlelanguagetranslator_multilanguage','googlelanguagetranslator_floating_widget','googlelanguagetranslator_flag_size','googlelanguagetranslator_flags_order','googlelanguagetranslator_english_flag_choice','googlelanguagetranslator_spanish_flag_choice','googlelanguagetranslator_portuguese_flag_choice','googlelanguagetranslator_floating_widget_text','googlelanguagetranslator_floating_widget_text_allow_translation'
649
- );
650
-
651
- foreach ($settings_name_array as $setting) {
652
- add_settings_field( $setting,'',$setting.'_cb','google_language_translator','glt_settings');
653
- register_setting( 'google_language_translator',$setting);
654
- }
655
- }
656
-
657
- public function googlelanguagetranslator_active_cb() {
658
- $option_name = 'googlelanguagetranslator_active' ;
659
- $new_value = 1;
660
- if ( get_option( $option_name ) === false ) {
661
-
662
- // The option does not exist, so we update it.
663
- update_option( $option_name, $new_value );
664
- }
665
-
666
- $options = get_option (''.$option_name.'');
667
-
668
- $html = '<input type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" '.checked(1,$options,false).'/> &nbsp; Check this box to activate';
669
- echo $html;
670
- }
671
-
672
- public function googlelanguagetranslator_language_cb() {
673
-
674
- $option_name = 'googlelanguagetranslator_language';
675
- $new_value = 'en';
676
-
677
- if ( get_option( $option_name ) === false ) {
678
-
679
- // The option does not exist, so we update it.
680
- update_option( $option_name, $new_value );
681
- }
682
-
683
- $options = get_option (''.$option_name.''); ?>
684
-
685
- <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
686
-
687
- <?php
688
-
689
- foreach ($this->languages_array as $key => $value) {
690
- $language_code = $key;
691
- $language_name = $value; ?>
692
- <option value="<?php echo $language_code; ?>" <?php if($options==''.$language_code.''){echo "selected";}?>><?php echo $language_name; ?></option>
693
- <?php } ?>
694
- </select>
695
- <?php
696
- }
697
-
698
- public function language_display_settings_cb() {
699
- $default_language_code = get_option('googlelanguagetranslator_language');
700
- $option_name = 'language_display_settings';
701
- $new_value = array(''.$default_language_code.'' => 1);
702
-
703
- if ( get_option( $option_name ) == false ) {
704
- // The option does not exist, so we update it.
705
- update_option( $option_name, $new_value );
706
- }
707
-
708
- $get_language_choices = get_option (''.$option_name.''); ?>
709
-
710
- <script>jQuery(document).ready(function($) { $('.select-all-languages').on('click',function(e) { e.preventDefault(); $('.languages').find('input:checkbox').prop('checked', true); }); $('.clear-all-languages').on('click',function(e) { e.preventDefault();
711
- $('.languages').find('input:checkbox').prop('checked', false); }); }); </script>
712
-
713
- <?php
714
-
715
- foreach ($this->languages_array as $key => $value) {
716
- $language_code = $key;
717
- $language_name = $value;
718
- $language_code_array[] = $key;
719
-
720
- if (!isset($get_language_choices[''.$language_code.''])) {
721
- $get_language_choices[''.$language_code.''] = 0;
722
- }
723
-
724
- $items[] = $get_language_choices[''.$language_code.''];
725
- $language_codes = $language_code_array;
726
- $item_count = count($items);
727
-
728
- if ($item_count == 1 || $item_count == 27 || $item_count == 53 || $item_count == 79) { ?>
729
- <div class="languages" style="width:25%; float:left">
730
- <?php } ?>
731
- <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>
732
- <?php
733
- if ($item_count == 26 || $item_count == 52 || $item_count == 78 || $item_count == 104) { ?>
734
- </div>
735
- <?php }
736
- } ?>
737
- <div class="clear"></div>
738
- <?php
739
- }
740
-
741
- public function googlelanguagetranslator_flags_cb() {
742
-
743
- $option_name = 'googlelanguagetranslator_flags' ;
744
- $new_value = 1;
745
-
746
- if ( get_option( $option_name ) === false ) {
747
-
748
- // The option does not exist, so we update it.
749
- update_option( $option_name, $new_value );
750
- }
751
-
752
- $options = get_option (''.$option_name.'');
753
-
754
- $html = '<input type="checkbox" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="1" '.checked(1,$options,false).'/> &nbsp; Check to show flags';
755
-
756
- echo $html;
757
- }
758
-
759
- public function googlelanguagetranslator_floating_widget_cb() {
760
-
761
- $option_name = 'googlelanguagetranslator_floating_widget' ;
762
- $new_value = 'yes';
763
-
764
- if ( get_option( $option_name ) === false ) {
765
-
766
- // The option does not exist, so we update it.
767
- update_option( $option_name, $new_value );
768
- }
769
-
770
- $options = get_option (''.$option_name.''); ?>
771
-
772
- <select name="googlelanguagetranslator_floating_widget" id="googlelanguagetranslator_floating_widget" style="width:170px">
773
- <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Yes, show widget</option>
774
- <option value="no" <?php if($options=='no'){echo "selected";}?>>No, hide widget</option>
775
- </select>
776
- <?php }
777
-
778
- public function googlelanguagetranslator_floating_widget_text_cb() {
779
-
780
- $option_name = 'googlelanguagetranslator_floating_widget_text' ;
781
- $new_value = 'Translate &raquo;';
782
-
783
- if ( get_option( $option_name ) === false ) {
784
- // The option does not exist, so we update it.
785
- update_option( $option_name, $new_value );
786
- }
787
-
788
- $options = get_option (''.$option_name.''); ?>
789
-
790
- <input type="text" name="googlelanguagetranslator_floating_widget_text" id="googlelanguagetranslator_floating_widget_text" value="<?php echo esc_attr($options); ?>" style="width:170px"/>
791
-
792
- <?php }
793
-
794
- public function googlelanguagetranslator_floating_widget_text_allow_translation_cb() {
795
- $option_name = 'googlelanguagetranslator_floating_widget_text_allow_translation' ;
796
- $new_value = 0;
797
-
798
- if ( get_option( $option_name ) === false ) {
799
- // The option does not exist, so we update it.
800
- update_option( $option_name, $new_value );
801
- }
802
-
803
- $options = get_option (''.$option_name.'');
804
-
805
- $html = '<input type="checkbox" name="googlelanguagetranslator_floating_widget_text_allow_translation" id="googlelanguagetranslator_floating_widget_text_allow_translation" value="1" '.checked(1,$options,false).'/> &nbsp; Check to allow';
806
- echo $html;
807
- }
808
-
809
- public function googlelanguagetranslator_translatebox_cb() {
810
-
811
- $option_name = 'googlelanguagetranslator_translatebox' ;
812
- $new_value = 'yes';
813
-
814
- if ( get_option( $option_name ) === false ) {
815
-
816
- // The option does not exist, so we update it.
817
- update_option( $option_name, $new_value );
818
- }
819
-
820
- $options = get_option (''.$option_name.''); ?>
821
-
822
- <select name="googlelanguagetranslator_translatebox" id="googlelanguagetranslator_translatebox" style="width:190px">
823
- <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Show language switcher</option>
824
- <option value="no" <?php if($options=='no'){echo "selected";}?>>Hide language switcher</option>
825
- </select>
826
- <?php }
827
-
828
- public function googlelanguagetranslator_display_cb() {
829
-
830
- $option_name = 'googlelanguagetranslator_display' ;
831
- $new_value = 'Vertical';
832
-
833
- if ( get_option( $option_name ) === false ) {
834
-
835
- // The option does not exist, so we update it.
836
- update_option( $option_name, $new_value );
837
- }
838
-
839
- $options = get_option (''.$option_name.''); ?>
840
-
841
- <select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:170px;">
842
- <option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
843
- <option value="Horizontal" <?php if(get_option('googlelanguagetranslator_display')=='Horizontal'){echo "selected";}?>>Horizontal</option>
844
- <?php
845
- $browser_lang = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : '';
846
- if (!empty($get_http_accept_language)):
847
- $get_http_accept_language = explode(",",$browser_lang);
848
- else:
849
- $get_http_accept_language = explode(",",$browser_lang);
850
- endif;
851
- $bestlang = $get_http_accept_language[0];
852
- $bestlang_prefix = substr($get_http_accept_language[0],0,2);
853
-
854
- if ($bestlang_prefix == 'en'): ?>
855
- <option value="SIMPLE" <?php if (get_option('googlelanguagetranslator_display')=='SIMPLE'){echo "selected";}?>>SIMPLE</option>
856
- <?php endif; ?>
857
- </select>
858
- <?php }
859
-
860
- public function googlelanguagetranslator_toolbar_cb() {
861
-
862
- $option_name = 'googlelanguagetranslator_toolbar' ;
863
- $new_value = 'Yes';
864
-
865
- if ( get_option( $option_name ) === false ) {
866
-
867
- // The option does not exist, so we update it.
868
- update_option( $option_name, $new_value );
869
- }
870
-
871
- $options = get_option (''.$option_name.''); ?>
872
-
873
- <select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:170px;">
874
- <option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
875
- <option value="No" <?php if(get_option('googlelanguagetranslator_toolbar')=='No'){echo "selected";}?>>No</option>
876
- </select>
877
- <?php }
878
-
879
- public function googlelanguagetranslator_showbranding_cb() {
880
-
881
- $option_name = 'googlelanguagetranslator_showbranding' ;
882
- $new_value = 'Yes';
883
-
884
- if ( get_option( $option_name ) === false ) {
885
-
886
- // The option does not exist, so we update it.
887
- update_option( $option_name, $new_value );
888
- }
889
-
890
- $options = get_option (''.$option_name.''); ?>
891
-
892
- <select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:170px;">
893
- <option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
894
- <option value="No" <?php if(get_option('googlelanguagetranslator_showbranding')=='No'){echo "selected";}?>>No</option>
895
- </select>
896
- <?php }
897
-
898
- public function googlelanguagetranslator_flags_alignment_cb() {
899
-
900
- $option_name = 'googlelanguagetranslator_flags_alignment' ;
901
- $new_value = 'flags_left';
902
-
903
- if ( get_option( $option_name ) === false ) {
904
-
905
- // The option does not exist, so we update it.
906
- update_option( $option_name, 'flags_left' );
907
- }
908
-
909
- $options = get_option (''.$option_name.''); ?>
910
-
911
- <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_left" value="flags_left" <?php if($options=='flags_left'){echo "checked";}?>/> Align Left<br/>
912
- <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_right" value="flags_right" <?php if($options=='flags_right'){echo "checked";}?>/> Align Right
913
- <?php }
914
-
915
- public function googlelanguagetranslator_analytics_cb() {
916
-
917
- $option_name = 'googlelanguagetranslator_analytics' ;
918
- $new_value = 0;
919
-
920
- if ( get_option( $option_name ) === false ) {
921
-
922
- // The option does not exist, so we update it.
923
- update_option( $option_name, $new_value );
924
- }
925
-
926
- $options = get_option (''.$option_name.'');
927
-
928
- $html = '<input type="checkbox" name="googlelanguagetranslator_analytics" id="googlelanguagetranslator_analytics" value="1" '.checked(1,$options,false).'/> &nbsp; Activate Google Analytics tracking?';
929
- echo $html;
930
- }
931
-
932
- public function googlelanguagetranslator_analytics_id_cb() {
933
-
934
- $option_name = 'googlelanguagetranslator_analytics_id' ;
935
- $new_value = '';
936
-
937
- if ( get_option( $option_name ) === false ) {
938
-
939
- // The option does not exist, so we update it.
940
- update_option( $option_name, $new_value );
941
- }
942
-
943
- $options = get_option (''.$option_name.'');
944
-
945
- $html = '<input type="text" name="googlelanguagetranslator_analytics_id" id="googlelanguagetranslator_analytics_id" value="'.$options.'" />';
946
- echo $html;
947
- }
948
-
949
- public function googlelanguagetranslator_flag_size_cb() {
950
-
951
- $option_name = 'googlelanguagetranslator_flag_size' ;
952
- $new_value = '18';
953
-
954
- if ( get_option( $option_name ) === false ) {
955
-
956
- // The option does not exist, so we update it.
957
- update_option( $option_name, $new_value );
958
- }
959
-
960
- $options = get_option (''.$option_name.''); ?>
961
-
962
- <select name="googlelanguagetranslator_flag_size" id="googlelanguagetranslator_flag_size" style="width:110px;">
963
- <option value="16" <?php if($options=='16'){echo "selected";}?>>16px</option>
964
- <option value="18" <?php if($options=='18'){echo "selected";}?>>18px</option>
965
- <option value="20" <?php if($options=='20'){echo "selected";}?>>20px</option>
966
- <option value="22" <?php if($options=='22'){echo "selected";}?>>22px</option>
967
- <option value="24" <?php if($options=='24'){echo "selected";}?>>24px</option>
968
- </select>
969
- <?php }
970
-
971
- public function googlelanguagetranslator_flags_order_cb() {
972
- $option_name = 'googlelanguagetranslator_flags_order';
973
- $new_value = '';
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
- <input type="hidden" id="order" name="googlelanguagetranslator_flags_order" value="<?php print_r(get_option('googlelanguagetranslator_flags_order')); ?>" />
984
- <?php
985
- }
986
-
987
- public function googlelanguagetranslator_english_flag_choice_cb() {
988
- $option_name = 'googlelanguagetranslator_english_flag_choice';
989
- $new_value = 'us_flag';
990
-
991
- if ( get_option ( $option_name ) === false ) {
992
-
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
- <select name="googlelanguagetranslator_english_flag_choice" id="googlelanguagetranslator_english_flag_choice">
1000
- <option value="us_flag" <?php if($options=='us_flag'){echo "selected";}?>>U.S. Flag</option>
1001
- <option value="uk_flag" <?php if ($options=='uk_flag'){echo "selected";}?>>U.K Flag</option>
1002
- <option value="canadian_flag" <?php if ($options=='canadian_flag'){echo "selected";}?>>Canadian Flag</option>
1003
- </select>
1004
- <?php
1005
- }
1006
-
1007
- public function googlelanguagetranslator_spanish_flag_choice_cb() {
1008
- $option_name = 'googlelanguagetranslator_spanish_flag_choice';
1009
- $new_value = 'spanish_flag';
1010
-
1011
- if ( get_option ( $option_name ) === false ) {
1012
-
1013
- // The option does not exist, so we update it.
1014
- update_option( $option_name, $new_value );
1015
- }
1016
-
1017
- $options = get_option ( ''.$option_name.'' ); ?>
1018
-
1019
- <select name="googlelanguagetranslator_spanish_flag_choice" id="googlelanguagetranslator_spanish_flag_choice">
1020
- <option value="spanish_flag" <?php if($options=='spanish_flag'){echo "selected";}?>>Spanish Flag</option>
1021
- <option value="mexican_flag" <?php if ($options=='mexican_flag'){echo "selected";}?>>Mexican Flag</option>
1022
- </select>
1023
- <?php
1024
- }
1025
-
1026
- public function googlelanguagetranslator_portuguese_flag_choice_cb() {
1027
- $option_name = 'googlelanguagetranslator_portuguese_flag_choice';
1028
- $new_value = 'portuguese_flag';
1029
-
1030
- if ( get_option ( $option_name ) === false ) {
1031
-
1032
- // The option does not exist, so we update it.
1033
- update_option( $option_name, $new_value );
1034
- }
1035
-
1036
- $options = get_option ( ''.$option_name.'' ); ?>
1037
-
1038
- <select name="googlelanguagetranslator_portuguese_flag_choice" id="googlelanguagetranslator_spanish_flag_choice">
1039
- <option value="portuguese_flag" <?php if($options=='portuguese_flag'){echo "selected";}?>>Portuguese Flag</option>
1040
- <option value="brazilian_flag" <?php if ($options=='brazilian_flag'){echo "selected";}?>>Brazilian Flag</option>
1041
- </select>
1042
- <?php
1043
- }
1044
-
1045
- public function googlelanguagetranslator_css_cb() {
1046
-
1047
- $option_name = 'googlelanguagetranslator_css' ;
1048
- $new_value = '';
1049
-
1050
- if ( get_option( $option_name ) === false ) {
1051
-
1052
- // The option does not exist, so we update it.
1053
- update_option( $option_name, $new_value );
1054
- }
1055
-
1056
- $options = get_option (''.$option_name.'');
1057
-
1058
- $html = '<textarea style="width:100%; height:200px" name="googlelanguagetranslator_css" id="googlelanguagetranslator_css">'.$options.'</textarea>';
1059
- echo $html;
1060
- }
1061
-
1062
- public function googlelanguagetranslator_multilanguage_cb() {
1063
-
1064
- $option_name = 'googlelanguagetranslator_multilanguage' ;
1065
- $new_value = 0;
1066
-
1067
- if ( get_option( $option_name ) === false ) {
1068
-
1069
- // The option does not exist, so we update it.
1070
- update_option( $option_name, $new_value );
1071
- }
1072
-
1073
- $options = get_option (''.$option_name.'');
1074
-
1075
- $html = '<input type="checkbox" name="googlelanguagetranslator_multilanguage" id="googlelanguagetranslator_multilanguage" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on multilanguage mode?';
1076
- echo $html;
1077
- }
1078
-
1079
- public function googlelanguagetranslator_exclude_translation_cb() {
1080
-
1081
- $option_name = 'googlelanguagetranslator_exclude_translation';
1082
- $new_value = '';
1083
-
1084
- if (get_option($option_name) === false ) {
1085
- // The option does not exist, so we update it.
1086
- update_option( $option_name, $new_value );
1087
- }
1088
-
1089
- $options = get_option (''.$option_name.'');
1090
-
1091
- $html = '<input type="text" name="'.$option_name.'" id="'.$option_name.'" value="'.$options.'" />';
1092
-
1093
- echo $html;
1094
- }
1095
-
1096
- public function page_layout_cb() {
1097
- include( plugin_dir_path( __FILE__ ) . '/css/style.php'); add_thickbox(); ?>
1098
- <div id="glt-settings" class="wrap">
1099
- <div id="icon-options-general" class="icon32"></div>
1100
- <h2><span class="notranslate">Google Language Translator</span></h2>
1101
- <form action="<?php echo admin_url( '/options.php'); ?>" method="post">
1102
- <div class="metabox-holder has-right-sidebar" style="float:left; width:65%">
1103
- <div class="postbox glt-main-settings" style="width: 100%">
1104
- <h3 class="notranslate">Main Settings</h3>
1105
- <?php settings_fields('google_language_translator'); ?>
1106
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1107
- <tr>
1108
- <td style="width:60%" class="notranslate">Plugin Status:</td>
1109
- <td class="notranslate"><?php $this->googlelanguagetranslator_active_cb(); ?></td>
1110
- </tr>
1111
-
1112
- <tr class="notranslate">
1113
- <td>Choose the original language of your website</td>
1114
- <td><?php $this->googlelanguagetranslator_language_cb(); ?></td>
1115
- </tr>
1116
- </table>
1117
- </div> <!-- .postbox -->
1118
-
1119
- <div class="postbox glt-layout-settings" style="width: 100%">
1120
- <h3 class="notranslate">Layout Settings</h3>
1121
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1122
- <tr class="notranslate">
1123
- <td colspan="2">What languages will display in the language switcher? (<a class="select-all-languages" href="#">Select All</a> | <a class="clear-all-languages" href="#">Clear</a>)</td>
1124
- </tr>
1125
-
1126
- <tr class="notranslate languages">
1127
- <td colspan="2"><?php $this->language_display_settings_cb(); ?></td>
1128
- </tr>
1129
-
1130
- <tr class="notranslate">
1131
- <td class="choose_flags_intro">Show flag images?<br/>(Display up to 104 flags above the language switcher)</td>
1132
- <td class="choose_flags_intro"><?php $this->googlelanguagetranslator_flags_cb(); ?></td>
1133
- </tr>
1134
-
1135
-
1136
-
1137
- <tr class="notranslate">
1138
- <td>Show or hide the langauge switcher?</td>
1139
- <td><?php $this->googlelanguagetranslator_translatebox_cb(); ?></td>
1140
- </tr>
1141
-
1142
- <tr class="notranslate">
1143
- <td>Layout option:</td>
1144
- <td><?php $this->googlelanguagetranslator_display_cb(); ?></td>
1145
- </tr>
1146
-
1147
- <tr class="notranslate">
1148
- <td>Show Google Toolbar?</td>
1149
- <td><?php $this->googlelanguagetranslator_toolbar_cb(); ?></td>
1150
- </tr>
1151
-
1152
- <tr class="notranslate">
1153
- <td>Show Google Branding? &nbsp;<a href="https://developers.google.com/translate/v2/attribution" target="_blank">Learn more</a></td>
1154
- <td><?php $this->googlelanguagetranslator_showbranding_cb(); ?></td>
1155
- </tr>
1156
-
1157
- <tr class="alignment notranslate">
1158
- <td class="flagdisplay">Align the translator left or right?</td>
1159
- <td class="flagdisplay"><?php $this->googlelanguagetranslator_flags_alignment_cb(); ?></td>
1160
- </tr>
1161
- </table>
1162
- </div> <!-- .postbox -->
1163
-
1164
- <div class="postbox glt-floating-widget-settings" style="width: 100%">
1165
- <h3 class="notranslate">Floating Widget Settings</h3>
1166
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1167
- <tr class="floating_widget notranslate">
1168
- <td>Show floating translation widget?<br/>
1169
- <span>("All Languages" option <strong><u>must</u></strong> be chosen to show widget.)</span>
1170
- </td>
1171
- <td><?php $this->googlelanguagetranslator_floating_widget_cb(); ?></td>
1172
- </tr>
1173
-
1174
- <tr class="floating_widget_text notranslate">
1175
- <td>Custom text for the floating widget:</td>
1176
- <td><?php $this->googlelanguagetranslator_floating_widget_text_cb(); ?></td>
1177
- </tr>
1178
-
1179
- <tr class="floating_widget_text notranslate">
1180
- <td>Allow floating widget text to translate?:</td>
1181
- <td><?php $this->googlelanguagetranslator_floating_widget_text_allow_translation_cb(); ?></td>
1182
- </tr>
1183
- </table>
1184
- </div> <!-- .postbox -->
1185
-
1186
- <div class="postbox glt-behavior-settings" style="width: 100%">
1187
- <h3 class="notranslate">Behavior Settings</h3>
1188
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1189
- <tr class="multilanguage notranslate">
1190
- <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 you activate this setting, Google will translate all text into a single language when requested by your user, even if text is written in multiple languages. In most cases, this setting is not recommended, although for certain websites it might be necessary.</p></div></td>
1191
- <td><?php $this->googlelanguagetranslator_multilanguage_cb(); ?></td>
1192
- </tr>
1193
-
1194
- <tr class="notranslate">
1195
- <td>Google Analytics:</td>
1196
- <td><?php $this->googlelanguagetranslator_analytics_cb(); ?></td>
1197
- </tr>
1198
-
1199
- <tr class="analytics notranslate">
1200
- <td>Google Analytics ID (Ex. 'UA-11117410-2')</td>
1201
- <td><?php $this->googlelanguagetranslator_analytics_id_cb(); ?></td>
1202
- </tr>
1203
- </table>
1204
- </div> <!-- .postbox -->
1205
-
1206
- <div class="postbox glt-usage-settings" style="width: 100%">
1207
- <h3 class="notranslate">Usage</h3>
1208
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1209
- <tr class="notranslate">
1210
- <td>For usage in pages/posts/sidebar:</td>
1211
- <td><code>[google-translator]</code></td>
1212
- </tr>
1213
-
1214
- <tr class="notranslate">
1215
- <td style="width:40%">For usage in header/footer/page templates:</td>
1216
- <td style="width:60%"><code>&lt;?php echo do_shortcode('[google-translator]'); ?&gt;</code></td>
1217
- </tr>
1218
-
1219
- <tr class="notranslate">
1220
- <td colspan="2">Single language usage in menus/pages/posts</td>
1221
- </tr>
1222
-
1223
- <tr class="notranslate">
1224
- <td colspan="2"><code>[glt language="Spanish" label="Espa&ntilde;ol" image="yes" text="yes" image_size="24"]</code></td>
1225
- </tr>
1226
-
1227
- <tr class="notranslate">
1228
- <td colspan="2">
1229
- <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>
1230
- <div id="single-language-shortcode-description" style="display:none">
1231
- <p>For menu usage, you need to create a new menu, or use an existing menu, by navigating to "Appearance > Menus".</p>
1232
- <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>
1233
- <p>Once descriptions are enabled, follow these steps:<br/>
1234
- <ol>
1235
- <li>Create a new menu item using "Link" as the menu item type.</li>
1236
- <li>Use <code style="border:none">#</code> for the URL</li>
1237
- <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>
1238
- <li>Place the following shortcode into the "description" field, and modify it to display the language and navigation label of your choice:</li>
1239
- </ol>
1240
- <p><code>[glt language="Spanish" label="Espa&ntilde;ol"]</code></p>
1241
- </div> <!-- .single-language-shortcode-description -->
1242
- </td>
1243
- </tr>
1244
-
1245
- <tr class="notranslate">
1246
- <td colspan="2">
1247
- <?php
1248
- if (isset($_POST['submit'])) {
1249
- if (empty($_POST['submit']) && !check_admin_referer( 'glt-save-settings', 'glt-save-settings-nonce' )) {
1250
- wp_die();
1251
- }
1252
- }
1253
- wp_nonce_field('glt-save-settings, glt-save-settings-nonce', false);
1254
- submit_button(); ?>
1255
- </td>
1256
- </tr>
1257
- </table>
1258
- </div> <!-- .postbox -->
1259
- </div> <!-- .metbox-holder -->
1260
-
1261
- <div class="metabox-holder" style="float:right; clear:right; width:33%">
1262
- <div class="postbox glt-preview-settings">
1263
- <h3 class="notranslate">Preview</h3>
1264
- <table style="width:100%">
1265
- <tr>
1266
- <td style="box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; padding:15px 15px; margin:0px"><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>
1267
- </td>
1268
- </tr>
1269
- </table>
1270
- </div> <!-- .postbox -->
1271
- </div> <!-- .metabox-holder -->
1272
-
1273
- <div class="metabox-holder box-right notranslate" style="float: right; width: 33%; clear:right">
1274
- <div class="postbox glt-advanced-settings">
1275
- <h3>Advanced Settings</h3>
1276
- <div class="inside">
1277
- <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1278
- <tr class="notranslate">
1279
- <td class="advanced">Select flag size:</td>
1280
- <td class="advanced"><?php $this->googlelanguagetranslator_flag_size_cb(); ?></td>
1281
- </tr>
1282
-
1283
- <tr class="notranslate">
1284
- <td class="advanced">Flag for English:</td>
1285
- <td class="advanced"><?php $this->googlelanguagetranslator_english_flag_choice_cb(); ?></td>
1286
- </tr>
1287
-
1288
- <tr class="notranslate">
1289
- <td class="advanced">Flag for Spanish:</td>
1290
- <td class="advanced"><?php $this->googlelanguagetranslator_spanish_flag_choice_cb(); ?></td>
1291
- </tr>
1292
-
1293
- <tr class="notranslate">
1294
- <td class="advanced">Flag for Portuguese:</td>
1295
- <td class="advanced"><?php $this->googlelanguagetranslator_portuguese_flag_choice_cb(); ?></td>
1296
- </tr>
1297
- </table>
1298
- </div> <!-- .inside -->
1299
- </div> <!-- .postbox -->
1300
- </div> <!-- .metabox-holder -->
1301
-
1302
-
1303
- <div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
1304
- <div class="postbox glt-css-settings">
1305
- <h3>Add CSS Styles</h3>
1306
- <div class="inside">
1307
- <p>You can apply any necessary CSS styles below:</p>
1308
- <?php $this->googlelanguagetranslator_css_cb(); ?>
1309
- </div> <!-- .inside -->
1310
- </div> <!-- .postbox -->
1311
- </div> <!-- .metabox-holder -->
1312
- <?php $this->googlelanguagetranslator_flags_order_cb(); ?>
1313
- </form>
1314
-
1315
- <div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
1316
- <div class="postbox">
1317
- <h3>GLT Premium 5.0.39 is Here! $30</h3>
1318
- <div class="inside">
1319
- <a class="wp-studio-logo" href="http://www.wp-studio.net/" target="_blank"><img style="background:#444; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px; width:177px;" src="<?php echo plugins_url( 'images/logo.png' , __FILE__ ); ?>"></a><br />
1320
- <ul id="features" style="margin-left:15px">
1321
- <li style="list-style:square outside">104 Languages with flags</li>
1322
- <li style="list-style:square outside">Edit up to 5 phrases in any language, while using auto-translation</li>
1323
- <li style="list-style:square outside">6 Floating Widget positions</li>
1324
- <li style="list-style:square outside">Exclude specific areas from translation</li>
1325
- <li style="list-style:square outside">jQuery-powered language switcher</li>
1326
- <li style="list-style:square outside">Add single languages to your menus/pages/posts</li>
1327
- <li style="list-style:square outside">Language switcher loads inline with page content</li>
1328
- <li style="list-style:square outside">Custom flag choices for English, Spanish and Portuguese</li>
1329
- <li style="list-style:square outside">User-friendly URLs, hide or show <code>lang</code> attribute</li>
1330
- <li style="list-style:square outside">Drag/drop flags to re-arrange their order</li>
1331
- <li style="list-style:square outside">Duplicate pages/posts into your chosen languages (for editing)</li>
1332
- <li style="list-style:square outside">FREE access to all future updates</li>
1333
- </ul>
1334
- </div> <!-- .inside -->
1335
- </div> <!-- .postbox -->
1336
- </div> <!-- .metabox-holder -->
1337
-
1338
- <div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
1339
- <div class="postbox">
1340
- <h3>Please Consider A Donation</h3>
1341
- <div class="inside">If you find our plugin useful, help keep it actively developed by clicking the donate button <br /><br />
1342
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1343
- <input type="hidden" name="cmd" value="_donations">
1344
- <input type="hidden" name="business" value="robertmyrick@hotmail.com">
1345
- <input type="hidden" name="lc" value="US">
1346
- <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!">
1347
- <input type="hidden" name="no_note" value="0">
1348
- <input type="hidden" name="currency_code" value="USD">
1349
- <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
1350
- <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!">
1351
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
1352
- </form>
1353
- </div> <!-- .inside -->
1354
- </div> <!-- .postbox -->
1355
- </div> <!-- .metabox-holder -->
1356
- </div> <!-- .wrap -->
1357
- <?php
1358
- }
1359
- }
1360
  $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: 5.0.40
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
+ //ini_set('display_errors', 1);
12
+ //ini_set('display_startup_errors', 1);
13
+ //error_reporting(E_ALL);
14
+
15
+ include( plugin_dir_path( __FILE__ ) . 'widget.php');
16
+
17
+ class google_language_translator {
18
+
19
+ public $languages_array;
20
+
21
+ public function __construct() {
22
+
23
+ $this->languages_array = array (
24
+ 'af' => 'Afrikaans',
25
+ 'sq' => 'Albanian',
26
+ 'am' => 'Amharic',
27
+ 'ar' => 'Arabic',
28
+ 'hy' => 'Armenian',
29
+ 'az' => 'Azerbaijani',
30
+ 'eu' => 'Basque',
31
+ 'be' => 'Belarusian',
32
+ 'bn' => 'Bengali',
33
+ 'bs' => 'Bosnian',
34
+ 'bg' => 'Bulgarian',
35
+ 'ca' => 'Catalan',
36
+ 'ceb' => 'Cebuano',
37
+ 'ny' => 'Chichewa',
38
+ 'zh-CN' => 'Chinese (Simplified)',
39
+ 'zh-TW' => 'Chinese (Traditional)',
40
+ 'co' => 'Corsican',
41
+ 'hr' => 'Croatian',
42
+ 'cs' => 'Czech',
43
+ 'da' => 'Danish',
44
+ 'nl' => 'Dutch',
45
+ 'en' => 'English',
46
+ 'eo' => 'Esperanto',
47
+ 'et' => 'Estonian',
48
+ 'tl' => 'Filipino',
49
+ 'fi' => 'Finnish',
50
+ 'fr' => 'French',
51
+ 'fy' => 'Frisian',
52
+ 'gl' => 'Galician',
53
+ 'ka' => 'Georgian',
54
+ 'de' => 'German',
55
+ 'el' => 'Greek',
56
+ 'gu' => 'Gujarati',
57
+ 'ht' => 'Haitian',
58
+ 'ha' => 'Hausa',
59
+ 'haw' => 'Hawaiian',
60
+ 'iw' => 'Hebrew',
61
+ 'hi' => 'Hindi',
62
+ 'hmn' => 'Hmong',
63
+ 'hu' => 'Hungarian',
64
+ 'is' => 'Icelandic',
65
+ 'ig' => 'Igbo',
66
+ 'id' => 'Indonesian',
67
+ 'ga' => 'Irish',
68
+ 'it' => 'Italian',
69
+ 'ja' => 'Japanese',
70
+ 'jw' => 'Javanese',
71
+ 'kn' => 'Kannada',
72
+ 'kk' => 'Kazakh',
73
+ 'km' => 'Khmer',
74
+ 'ko' => 'Korean',
75
+ 'ku' => 'Kurdish',
76
+ 'ky' => 'Kyrgyz',
77
+ 'lo' => 'Lao',
78
+ 'la' => 'Latin',
79
+ 'lv' => 'Latvian',
80
+ 'lt' => 'Lithuanian',
81
+ 'lb' => 'Luxembourgish',
82
+ 'mk' => 'Macedonian',
83
+ 'mg' => 'Malagasy',
84
+ 'ml' => 'Malayalam',
85
+ 'ms' => 'Malay',
86
+ 'mt' => 'Maltese',
87
+ 'mi' => 'Maori',
88
+ 'mr' => 'Marathi',
89
+ 'mn' => 'Mongolian',
90
+ 'my' => 'Myanmar (Burmese)',
91
+ 'ne' => 'Nepali',
92
+ 'no' => 'Norwegian',
93
+ 'ps' => 'Pashto',
94
+ 'fa' => 'Persian',
95
+ 'pl' => 'Polish',
96
+ 'pt' => 'Portuguese',
97
+ 'pa' => 'Punjabi',
98
+ 'ro' => 'Romanian',
99
+ 'ru' => 'Russian',
100
+ 'sr' => 'Serbian',
101
+ 'sn' => 'Shona',
102
+ 'st' => 'Sesotho',
103
+ 'sd' => 'Sindhi',
104
+ 'si' => 'Sinhala',
105
+ 'sk' => 'Slovak',
106
+ 'sl' => 'Slovenian',
107
+ 'sm' => 'Samoan',
108
+ 'gd' => 'Scots Gaelic',
109
+ 'so' => 'Somali',
110
+ 'es' => 'Spanish',
111
+ 'su' => 'Sundanese',
112
+ 'sw' => 'Swahili',
113
+ 'sv' => 'Swedish',
114
+ 'tg' => 'Tajik',
115
+ 'ta' => 'Tamil',
116
+ 'te' => 'Telugu',
117
+ 'th' => 'Thai',
118
+ 'tr' => 'Turkish',
119
+ 'uk' => 'Ukrainian',
120
+ 'ur' => 'Urdu',
121
+ 'uz' => 'Uzbek',
122
+ 'vi' => 'Vietnamese',
123
+ 'cy' => 'Welsh',
124
+ 'xh' => 'Xhosa',
125
+ 'yi' => 'Yiddish',
126
+ 'yo' => 'Yoruba',
127
+ 'zu' => 'Zulu',
128
+ );
129
+
130
+ register_activation_hook( __FILE__, array(&$this,'glt_activate'));
131
+ register_deactivation_hook( __FILE__, array(&$this,'glt_deactivate'));
132
+
133
+ add_action( 'admin_menu', array( &$this, 'add_my_admin_menus'));
134
+ add_action('admin_init',array(&$this, 'initialize_settings'));
135
+ add_action('wp_head',array(&$this, 'load_css'));
136
+ add_action('wp_footer',array(&$this, 'footer_script'));
137
+ add_shortcode( 'google-translator',array(&$this, 'google_translator_shortcode'));
138
+ add_shortcode( 'glt', array(&$this, 'google_translator_menu_language'));
139
+ add_filter('widget_text','do_shortcode');
140
+ add_filter('walker_nav_menu_start_el', array(&$this,'menu_shortcodes') , 10 , 2);
141
+ add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'glt_settings_link') );
142
+
143
+ if (!is_admin()) {
144
+ add_action('init',array(&$this, 'flags'));
145
+ }
146
+ }
147
+
148
+ public function glt_activate() {
149
+ add_option('googlelanguagetranslator_active', 1);
150
+ add_option('googlelanguagetranslator_language','en');
151
+ add_option('googlelanguagetranslator_flags', 1);
152
+ add_option('language_display_settings',array ('en' => 1));
153
+ add_option('googlelanguagetranslator_translatebox','yes');
154
+ add_option('googlelanguagetranslator_display','Vertical');
155
+ add_option('googlelanguagetranslator_toolbar','Yes');
156
+ add_option('googlelanguagetranslator_showbranding','Yes');
157
+ add_option('googlelanguagetranslator_flags_alignment','flags_left');
158
+ add_option('googlelanguagetranslator_analytics', 0);
159
+ add_option('googlelanguagetranslator_analytics_id','');
160
+ add_option('googlelanguagetranslator_css','');
161
+ add_option('googlelanguagetranslator_multilanguage',0);
162
+ add_option('googlelanguagetranslator_floating_widget','yes');
163
+ add_option('googlelanguagetranslator_flag_size','18');
164
+ add_option('googlelanguagetranslator_flags_order','');
165
+ add_option('googlelanguagetranslator_english_flag_choice','');
166
+ add_option('googlelanguagetranslator_spanish_flag_choice','');
167
+ add_option('googlelanguagetranslator_portuguese_flag_choice','');
168
+ add_option('googlelanguagetranslator_floating_widget_text', 'Translate &raquo;');
169
+ add_option('googlelanguagetranslator_floating_widget_text_allow_translation', 0);
170
+ delete_option('googlelanguagetranslator_manage_translations',0);
171
+ delete_option('flag_display_settings');
172
+ }
173
+
174
+ public function glt_deactivate() {
175
+ delete_option('flag_display_settings');
176
+ delete_option('googlelanguagetranslator_language_option');
177
+ }
178
+
179
+ public function glt_settings_link ( $links ) {
180
+ $settings_link = array(
181
+ '<a href="' . admin_url( 'options-general.php?page=google_language_translator' ) . '">Settings</a>',
182
+ );
183
+ return array_merge( $links, $settings_link );
184
+ }
185
+
186
+ public function add_my_admin_menus(){
187
+ $p = add_options_page('Google Language Translator', 'Google Language Translator', 'manage_options', 'google_language_translator', array(&$this, 'page_layout_cb'));
188
+
189
+ add_action( 'load-' . $p, array(&$this, 'load_admin_js' ));
190
+ }
191
+
192
+ public function load_admin_js(){
193
+ add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_admin_js' ));
194
+ add_action('admin_footer',array(&$this, 'footer_script'));
195
+ }
196
+
197
+ public function enqueue_admin_js(){
198
+ wp_enqueue_script( 'my-admin-script', plugins_url('js/admin.js',__FILE__), array('jquery'));
199
+
200
+ if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
201
+ wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
202
+ wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
203
+ wp_enqueue_style( 'glt-toolbar-styles' );
204
+ }
205
+
206
+ wp_enqueue_script( 'jquery-ui-core');
207
+ wp_enqueue_script( 'jquery-ui-sortable');
208
+ wp_enqueue_script( 'load_flags', plugins_url('js/load-flags.js',__FILE__), array('jquery'));
209
+ wp_register_style( 'jquery-ui.css', plugins_url('css/jquery-ui.css',__FILE__) );
210
+ wp_register_style( 'style.css', plugins_url('css/style.css', __FILE__) );
211
+ wp_enqueue_style( 'style.css' );
212
+ }
213
+
214
+ public function flags() {
215
+ wp_enqueue_script( 'glt-flags', plugins_url('js/load-flags.js',__FILE__), array('jquery'));
216
+
217
+ if (get_option ('googlelanguagetranslator_floating_widget') == 'yes') {
218
+ wp_enqueue_script( 'glt-load-toolbar', plugins_url('js/load-toolbar.js',__FILE__), array('jquery'));
219
+ wp_register_style( 'glt-toolbar-styles', plugins_url('css/toolbar.css', __FILE__) );
220
+ wp_enqueue_style( 'glt-toolbar-styles' );
221
+ }
222
+
223
+ wp_register_style( 'google-language-translator', plugins_url('css/style.css', __FILE__) );
224
+ wp_enqueue_style( 'google-language-translator' );
225
+ }
226
+
227
+ public function load_css() {
228
+ include( plugin_dir_path( __FILE__ ) . '/css/style.php');
229
+ }
230
+
231
+ public function google_translator_shortcode() {
232
+
233
+ if (get_option('googlelanguagetranslator_display')=='Vertical' || get_option('googlelanguagetranslator_display')=='SIMPLE'){
234
+ return $this->googlelanguagetranslator_vertical();
235
+ }
236
+ elseif(get_option('googlelanguagetranslator_display')=='Horizontal'){
237
+ return $this->googlelanguagetranslator_horizontal();
238
+ }
239
+ }
240
+
241
+ public function googlelanguagetranslator_included_languages() {
242
+ $get_language_choices = get_option ('language_display_settings');
243
+
244
+ foreach ($get_language_choices as $key=>$value):
245
+ if ($value == 1):
246
+ $items[] = $key;
247
+ endif;
248
+ endforeach;
249
+
250
+ $comma_separated = implode(",",array_values($items));
251
+ $lang = ", includedLanguages:'".$comma_separated."'";
252
+ return $lang;
253
+ }
254
+
255
+ public function analytics() {
256
+ if ( get_option('googlelanguagetranslator_analytics') == 1 ) {
257
+ $analytics_id = get_option('googlelanguagetranslator_analytics_id');
258
+ $analytics = "gaTrack: true, gaId: '".$analytics_id."'";
259
+
260
+ if (!empty ($analytics_id) ):
261
+ return ', '.$analytics;
262
+ endif;
263
+ }
264
+ }
265
+
266
+ public function menu_shortcodes( $item_output,$item ) {
267
+ if ( !empty($item->description)) {
268
+ $output = do_shortcode($item->description);
269
+
270
+ if ( $output != $item->description )
271
+ $item_output = $output;
272
+ }
273
+ return $item_output;
274
+ }
275
+
276
+ public function google_translator_menu_language($atts, $content = '') {
277
+ extract(shortcode_atts(array(
278
+ "language" => 'Spanish',
279
+ "label" => 'Spanish',
280
+ "image" => 'no',
281
+ "text" => 'yes',
282
+ "image_size" => '24',
283
+ "label" => 'Espa&ntilde;ol'
284
+ ), $atts));
285
+
286
+ $default_language = get_option('googlelanguagetranslator_language');
287
+ $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
288
+ $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
289
+ $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
290
+ $language_code = array_search($language,$this->languages_array);
291
+ $language_name = $language;
292
+ $language_name_flag = $language_name;
293
+
294
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
295
+ $language_name_flag = 'canada';
296
+ }
297
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
298
+ $language_name_flag = 'united-states';
299
+ }
300
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
301
+ $language_name_flag = 'mexico';
302
+ }
303
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
304
+ $language_name_flag = 'brazil';
305
+ }
306
+
307
+ return "<a class='nturl notranslate ".$language_code." ".$language_name_flag." single-language flag' title='".$language."'>".($image=='yes' ? "<span class='flag size".$image_size."'></span>" : '') .($text=='yes' ? $label : '')."</a>";
308
+ }
309
+
310
+ public function footer_script() {
311
+ global $shortcode_started;
312
+ $default_language = get_option('googlelanguagetranslator_language');
313
+ $language_choices = $this->googlelanguagetranslator_included_languages();
314
+ $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
315
+ $new_languages_array = explode(",",$new_languages_array_string);
316
+ $new_languages_array_codes = array_values($new_languages_array);
317
+ $new_languages_array_count = count($new_languages_array);
318
+ $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
319
+ $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
320
+ $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
321
+ $flag_width = get_option('googlelanguagetranslator_flag_size');
322
+ $get_language_choices = get_option('language_display_settings');
323
+ $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
324
+ $floating_widget_text = get_option ('googlelanguagetranslator_floating_widget_text');
325
+ $floating_widget_text_translation_allowed = get_option ('googlelanguagetranslator_floating_widget_text_allow_translation');
326
+ $is_active = get_option ( 'googlelanguagetranslator_active' );
327
+ $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
328
+ $str = ''; ?>
329
+ <script>jQuery(document).ready(function($) { $('#flags a, a.single-language, .tool-items a').each(function() { $(this).attr('data-lang', $(this).attr('title')); }); $(document.body).on("click","a.flag", function(){function l(){doGoogleLanguageTranslator(default_lang+"|"+default_lang); }function n(){doGoogleLanguageTranslator(default_lang+"|"+lang_prefix); } lang_text=$(this).attr('data-lang'),default_lang="<?php echo get_option('googlelanguagetranslator_language'); ?>",lang_prefix=$(this).attr("class").split(" ")[2],$(".tool-container").hide(),lang_prefix==default_lang?l():n()}),0==$("body > #google_language_translator").length&&$("#glt-footer").html("<div id='google_language_translator'></div>"); });</script><script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=GoogleLanguageTranslatorInit'></script>
330
+
331
+ <?php
332
+
333
+ if( $is_active == 1) {
334
+ if ($floating_widget=='yes') {
335
+ $str.='<div id="glt-translate-trigger"><span'.($floating_widget_text_translation_allowed != 1 ? ' class="notranslate"' : ' class="translate"').'>'.(empty($floating_widget_text) ? 'Translate &raquo;' : $floating_widget_text).'</span></div>';
336
+ $str.='<div id="glt-toolbar"></div>';
337
+ } //endif $floating_widget
338
+
339
+ $str.='<div id="flags" style="display:none" class="size'.$flag_width.'">';
340
+ $str.='<ul id="sortable" class="ui-sortable">';
341
+ if (empty($new_languages_array_string)) {
342
+ foreach ($this->languages_array as $key=>$value) {
343
+ $language_code = $key;
344
+ $language_name = $value;
345
+ $language_name_flag = $language_name;
346
+ if (get_option('googlelanguagetranslator_flags') == 1) {
347
+ if (!empty($get_language_choices[$language_code]) && $get_language_choices[$language_code]==1) {
348
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
349
+ $language_name_flag = 'canada';
350
+ }
351
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
352
+ $language_name_flag = 'united-states';
353
+ }
354
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
355
+ $language_name_flag = 'mexico';
356
+ }
357
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
358
+ $language_name_flag = 'brazil';
359
+ }
360
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
361
+ } //isset
362
+ } //endif
363
+ }//foreach
364
+ } else {
365
+ if ($new_languages_array_count != count($get_language_choices)):
366
+ foreach ($get_language_choices as $key => $value) {
367
+ $language_code = $key;
368
+ $language_name = $this->languages_array[$key];
369
+ $language_name_flag = $language_name;
370
+ if (get_option('googlelanguagetranslator_flags') == 1) {
371
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
372
+ $language_name_flag = 'canada';
373
+ }
374
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
375
+ $language_name_flag = 'united-states';
376
+ }
377
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
378
+ $language_name_flag = 'mexico';
379
+ }
380
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
381
+ $language_name_flag = 'brazil';
382
+ }
383
+
384
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
385
+ } //get_option
386
+ } //foreach
387
+ else:
388
+ foreach ($new_languages_array_codes as $value) {
389
+ $language_name = $value;
390
+ $language_code = array_search ($language_name, $this->languages_array);
391
+ $language_name_flag = $language_name;
392
+ if (get_option('googlelanguagetranslator_flags') == 1) {
393
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
394
+ $language_name_flag = 'canada';
395
+ }
396
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
397
+ $language_name_flag = 'united-states';
398
+ }
399
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
400
+ $language_name_flag = 'mexico';
401
+ }
402
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
403
+ $language_name_flag = 'brazil';
404
+ }
405
+
406
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
407
+ } //get_option
408
+ }//foreach
409
+ endif;
410
+ }//endif
411
+ $str.='</ul>';
412
+ $str.='</div>';
413
+ }
414
+
415
+ $language_choices = $this->googlelanguagetranslator_included_languages();
416
+ $layout = get_option('googlelanguagetranslator_display');
417
+ $is_multilanguage = get_option('googlelanguagetranslator_multilanguage');
418
+ $horizontal_layout = ', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL';
419
+ $simple_layout = ', layout: google.translate.TranslateElement.InlineLayout.SIMPLE';
420
+ $auto_display = ', autoDisplay: false';
421
+ $default_language = get_option('googlelanguagetranslator_language');
422
+
423
+ if ($is_multilanguage == 1) {
424
+ $multilanguagePage = ', multilanguagePage:true';
425
+ $str.="<div id='glt-footer'></div><script type='text/javascript'>function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : ($layout=='SIMPLE' ? $simple_layout : '')) . $auto_display . $multilanguagePage . $this->analytics()."}, 'google_language_translator');}</script>";
426
+ echo $str;
427
+
428
+ } elseif ($is_multilanguage == 0) {
429
+ $str.="<div id='glt-footer'></div><script type='text/javascript'>function GoogleLanguageTranslatorInit() { new google.translate.TranslateElement({pageLanguage: '".$default_language."'".$language_choices . ($layout=='Horizontal' ? $horizontal_layout : ($layout=='SIMPLE' ? $simple_layout : '')) . $auto_display . $this->analytics()."}, 'google_language_translator');}</script>";
430
+ echo $str;
431
+ }
432
+ }
433
+
434
+ public function googlelanguagetranslator_vertical() {
435
+ global $shortcode_started;
436
+ $shortcode_started = 'true';
437
+ $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
438
+ $new_languages_array = explode(",",$new_languages_array_string);
439
+ $new_languages_array_codes = array_values($new_languages_array);
440
+ $new_languages_array_count = count($new_languages_array);
441
+ $get_language_choices = get_option ('language_display_settings');
442
+ $flag_width = get_option('googlelanguagetranslator_flag_size');
443
+ $default_language_code = get_option('googlelanguagetranslator_language');
444
+ $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
445
+ $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
446
+ $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
447
+ $is_active = get_option ( 'googlelanguagetranslator_active' );
448
+ $language_choices = $this->googlelanguagetranslator_included_languages();
449
+ $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
450
+ $str = '';
451
+
452
+ if( $is_active == 1):
453
+ $str.='<div id="flags" class="size'.$flag_width.'">';
454
+ $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
455
+
456
+ if (empty($new_languages_array_string)):
457
+ foreach ($this->languages_array as $key=>$value) {
458
+ $language_code = $key;
459
+ $language_name = $value;
460
+ $language_name_flag = $language_name;
461
+
462
+ if (get_option('googlelanguagetranslator_flags') == 1) {
463
+ if (!empty($get_language_choices[$language_code]) && $get_language_choices[$language_code]==1) {
464
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
465
+ $language_name_flag = 'canada';
466
+ }
467
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
468
+ $language_name_flag = 'united-states';
469
+ }
470
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
471
+ $language_name_flag = 'mexico';
472
+ }
473
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
474
+ $language_name_flag = 'brazil';
475
+ }
476
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
477
+ } //endif
478
+ } //endif
479
+ }//foreach
480
+ else:
481
+ if ($new_languages_array_count != count($get_language_choices)):
482
+ foreach ($get_language_choices as $key => $value) {
483
+ $language_code = $key;
484
+ $language_name = $this->languages_array[$key];
485
+ $language_name_flag = $language_name;
486
+
487
+ if (get_option('googlelanguagetranslator_flags') == 1) {
488
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
489
+ $language_name_flag = 'canada';
490
+ }
491
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
492
+ $language_name_flag = 'united-states';
493
+ }
494
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
495
+ $language_name_flag = 'mexico';
496
+ }
497
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
498
+ $language_name_flag = 'brazil';
499
+ }
500
+
501
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
502
+ } //get_option
503
+ } //foreach
504
+ else:
505
+ foreach ($new_languages_array_codes as $value) {
506
+ $language_name = $value;
507
+ $language_code = array_search ($language_name, $this->languages_array);
508
+ $language_name_flag = $language_name;
509
+
510
+ if (get_option('googlelanguagetranslator_flags') == 1) {
511
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
512
+ $language_name_flag = 'canada';
513
+ }
514
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
515
+ $language_name_flag = 'united-states';
516
+ }
517
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
518
+ $language_name_flag = 'mexico';
519
+ }
520
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
521
+ $language_name_flag = 'brazil';
522
+ }
523
+
524
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
525
+ } //get_option
526
+ }//foreach
527
+ endif;
528
+ endif;
529
+ $str.='</ul>';
530
+ $str.='</div>';
531
+ $str.='<div id="google_language_translator"></div>';
532
+ return $str;
533
+ endif;
534
+ } // End glt_vertical
535
+
536
+ public function googlelanguagetranslator_horizontal(){
537
+ $shortcode_started = 'true';
538
+ $new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
539
+ $new_languages_array = explode(",",$new_languages_array_string);
540
+ $new_languages_array_codes = array_values($new_languages_array);
541
+ $new_languages_array_count = count($new_languages_array);
542
+ $get_language_choices = get_option ('language_display_settings');
543
+ $flag_width = get_option('googlelanguagetranslator_flag_size');
544
+ $default_language_code = get_option('googlelanguagetranslator_language');
545
+ $english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
546
+ $spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
547
+ $portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
548
+ $is_active = get_option ( 'googlelanguagetranslator_active' );
549
+ $language_choices = $this->googlelanguagetranslator_included_languages();
550
+ $floating_widget = get_option ('googlelanguagetranslator_floating_widget');
551
+ $str = '';
552
+
553
+ if( $is_active == 1):
554
+ $str.='<div id="flags" class="size'.$flag_width.'">';
555
+ $str.='<ul id="sortable" class="ui-sortable" style="float:left">';
556
+
557
+ if (empty($new_languages_array_string)):
558
+ foreach ($this->languages_array as $key=>$value) {
559
+ $language_code = $key;
560
+ $language_name = $value;
561
+ $language_name_flag = $language_name;
562
+ if (get_option('googlelanguagetranslator_flags') == 1) {
563
+ if (!empty($get_language_choices[$language_code]) && $get_language_choices[$language_code]==1) {
564
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
565
+ $language_name_flag = 'canada';
566
+ }
567
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
568
+ $language_name_flag = 'united-states';
569
+ }
570
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
571
+ $language_name_flag = 'mexico';
572
+ }
573
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
574
+ $language_name_flag = 'brazil';
575
+ }
576
+ $str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
577
+ } //endif
578
+ } //endif
579
+ }//foreach
580
+ else:
581
+ if ($new_languages_array_count != count($get_language_choices)):
582
+ foreach ($get_language_choices as $key => $value) {
583
+ $language_code = $key;
584
+ $language_name = $this->languages_array[$key];
585
+ $language_name_flag = $language_name;
586
+
587
+ if (get_option('googlelanguagetranslator_flags') == 1) {
588
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
589
+ $language_name_flag = 'canada';
590
+ }
591
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
592
+ $language_name_flag = 'united-states';
593
+ }
594
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
595
+ $language_name_flag = 'mexico';
596
+ }
597
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
598
+ $language_name_flag = 'brazil';
599
+ }
600
+
601
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
602
+ } //get_option
603
+ } //foreach
604
+ else:
605
+ foreach ($new_languages_array_codes as $value) {
606
+ $language_name = $value;
607
+ $language_code = array_search ($language_name, $this->languages_array);
608
+ $language_name_flag = $language_name;
609
+
610
+ if (get_option('googlelanguagetranslator_flags') == 1) {
611
+ if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
612
+ $language_name_flag = 'canada';
613
+ }
614
+ if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
615
+ $language_name_flag = 'united-states';
616
+ }
617
+ if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
618
+ $language_name_flag = 'mexico';
619
+ }
620
+ if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
621
+ $language_name_flag = 'brazil';
622
+ }
623
+
624
+ $str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
625
+ } //get_option
626
+ }//foreach
627
+ endif;
628
+ endif;
629
+ $str.='</ul>';
630
+ $str.='</div>';
631
+ $str.='<div id="google_language_translator"></div>';
632
+ return $str;
633
+ endif;
634
+ } // End glt_horizontal
635
+
636
+ public function initialize_settings() {
637
+ add_settings_section('glt_settings','Settings','','google_language_translator');
638
+
639
+ $settings_name_array = array (
640
+ 'googlelanguagetranslator_active','googlelanguagetranslator_language','language_display_settings','googlelanguagetranslator_flags','googlelanguagetranslator_translatebox','googlelanguagetranslator_display','googlelanguagetranslator_toolbar','googlelanguagetranslator_showbranding','googlelanguagetranslator_flags_alignment','googlelanguagetranslator_analytics','googlelanguagetranslator_analytics_id','googlelanguagetranslator_css','googlelanguagetranslator_multilanguage','googlelanguagetranslator_floating_widget','googlelanguagetranslator_flag_size','googlelanguagetranslator_flags_order','googlelanguagetranslator_english_flag_choice','googlelanguagetranslator_spanish_flag_choice','googlelanguagetranslator_portuguese_flag_choice','googlelanguagetranslator_floating_widget_text','googlelanguagetranslator_floating_widget_text_allow_translation'
641
+ );
642
+
643
+ foreach ($settings_name_array as $setting) {
644
+ add_settings_field( $setting,'',$setting.'_cb','google_language_translator','glt_settings');
645
+ register_setting( 'google_language_translator',$setting);
646
+ }
647
+ }
648
+
649
+ public function googlelanguagetranslator_active_cb() {
650
+ $option_name = 'googlelanguagetranslator_active' ;
651
+ $new_value = 1;
652
+ if ( get_option( $option_name ) === false ) {
653
+
654
+ // The option does not exist, so we update it.
655
+ update_option( $option_name, $new_value );
656
+ }
657
+
658
+ $options = get_option (''.$option_name.'');
659
+
660
+ $html = '<input type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" '.checked(1,$options,false).'/> &nbsp; Check this box to activate';
661
+ echo $html;
662
+ }
663
+
664
+ public function googlelanguagetranslator_language_cb() {
665
+
666
+ $option_name = 'googlelanguagetranslator_language';
667
+ $new_value = 'en';
668
+
669
+ if ( get_option( $option_name ) === false ) {
670
+
671
+ // The option does not exist, so we update it.
672
+ update_option( $option_name, $new_value );
673
+ }
674
+
675
+ $options = get_option (''.$option_name.''); ?>
676
+
677
+ <select name="googlelanguagetranslator_language" id="googlelanguagetranslator_language">
678
+
679
+ <?php
680
+
681
+ foreach ($this->languages_array as $key => $value) {
682
+ $language_code = $key;
683
+ $language_name = $value; ?>
684
+ <option value="<?php echo $language_code; ?>" <?php if($options==''.$language_code.''){echo "selected";}?>><?php echo $language_name; ?></option>
685
+ <?php } ?>
686
+ </select>
687
+ <?php
688
+ }
689
+
690
+ public function language_display_settings_cb() {
691
+ $default_language_code = get_option('googlelanguagetranslator_language');
692
+ $option_name = 'language_display_settings';
693
+ $new_value = array(''.$default_language_code.'' => 1);
694
+
695
+ if ( get_option( $option_name ) == false ) {
696
+ // The option does not exist, so we update it.
697
+ update_option( $option_name, $new_value );
698
+ }
699
+
700
+ $get_language_choices = get_option (''.$option_name.''); ?>
701
+
702
+ <script>jQuery(document).ready(function($) { $('.select-all-languages').on('click',function(e) { e.preventDefault(); $('.languages').find('input:checkbox').prop('checked', true); }); $('.clear-all-languages').on('click',function(e) { e.preventDefault();
703
+ $('.languages').find('input:checkbox').prop('checked', false); }); }); </script>
704
+
705
+ <?php
706
+
707
+ foreach ($this->languages_array as $key => $value) {
708
+ $language_code = $key;
709
+ $language_name = $value;
710
+ $language_code_array[] = $key;
711
+
712
+ if (!isset($get_language_choices[''.$language_code.''])) {
713
+ $get_language_choices[''.$language_code.''] = 0;
714
+ }
715
+
716
+ $items[] = $get_language_choices[''.$language_code.''];
717
+ $language_codes = $language_code_array;
718
+ $item_count = count($items);
719
+
720
+ if ($item_count == 1 || $item_count == 27 || $item_count == 53 || $item_count == 79) { ?>
721
+ <div class="languages" style="width:25%; float:left">
722
+ <?php } ?>
723
+ <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>
724
+ <?php
725
+ if ($item_count == 26 || $item_count == 52 || $item_count == 78 || $item_count == 104) { ?>
726
+ </div>
727
+ <?php }
728
+ } ?>
729
+ <div class="clear"></div>
730
+ <?php
731
+ }
732
+
733
+ public function googlelanguagetranslator_flags_cb() {
734
+
735
+ $option_name = 'googlelanguagetranslator_flags' ;
736
+ $new_value = 1;
737
+
738
+ if ( get_option( $option_name ) === false ) {
739
+
740
+ // The option does not exist, so we update it.
741
+ update_option( $option_name, $new_value );
742
+ }
743
+
744
+ $options = get_option (''.$option_name.'');
745
+
746
+ $html = '<input type="checkbox" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="1" '.checked(1,$options,false).'/> &nbsp; Check to show flags';
747
+
748
+ echo $html;
749
+ }
750
+
751
+ public function googlelanguagetranslator_floating_widget_cb() {
752
+
753
+ $option_name = 'googlelanguagetranslator_floating_widget' ;
754
+ $new_value = 'yes';
755
+
756
+ if ( get_option( $option_name ) === false ) {
757
+
758
+ // The option does not exist, so we update it.
759
+ update_option( $option_name, $new_value );
760
+ }
761
+
762
+ $options = get_option (''.$option_name.''); ?>
763
+
764
+ <select name="googlelanguagetranslator_floating_widget" id="googlelanguagetranslator_floating_widget" style="width:170px">
765
+ <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Yes, show widget</option>
766
+ <option value="no" <?php if($options=='no'){echo "selected";}?>>No, hide widget</option>
767
+ </select>
768
+ <?php }
769
+
770
+ public function googlelanguagetranslator_floating_widget_text_cb() {
771
+
772
+ $option_name = 'googlelanguagetranslator_floating_widget_text' ;
773
+ $new_value = 'Translate &raquo;';
774
+
775
+ if ( get_option( $option_name ) === false ) {
776
+ // The option does not exist, so we update it.
777
+ update_option( $option_name, $new_value );
778
+ }
779
+
780
+ $options = get_option (''.$option_name.''); ?>
781
+
782
+ <input type="text" name="googlelanguagetranslator_floating_widget_text" id="googlelanguagetranslator_floating_widget_text" value="<?php echo esc_attr($options); ?>" style="width:170px"/>
783
+
784
+ <?php }
785
+
786
+ public function googlelanguagetranslator_floating_widget_text_allow_translation_cb() {
787
+ $option_name = 'googlelanguagetranslator_floating_widget_text_allow_translation' ;
788
+ $new_value = 0;
789
+
790
+ if ( get_option( $option_name ) === false ) {
791
+ // The option does not exist, so we update it.
792
+ update_option( $option_name, $new_value );
793
+ }
794
+
795
+ $options = get_option (''.$option_name.'');
796
+
797
+ $html = '<input type="checkbox" name="googlelanguagetranslator_floating_widget_text_allow_translation" id="googlelanguagetranslator_floating_widget_text_allow_translation" value="1" '.checked(1,$options,false).'/> &nbsp; Check to allow';
798
+ echo $html;
799
+ }
800
+
801
+ public function googlelanguagetranslator_translatebox_cb() {
802
+
803
+ $option_name = 'googlelanguagetranslator_translatebox' ;
804
+ $new_value = 'yes';
805
+
806
+ if ( get_option( $option_name ) === false ) {
807
+
808
+ // The option does not exist, so we update it.
809
+ update_option( $option_name, $new_value );
810
+ }
811
+
812
+ $options = get_option (''.$option_name.''); ?>
813
+
814
+ <select name="googlelanguagetranslator_translatebox" id="googlelanguagetranslator_translatebox" style="width:190px">
815
+ <option value="yes" <?php if($options=='yes'){echo "selected";}?>>Show language switcher</option>
816
+ <option value="no" <?php if($options=='no'){echo "selected";}?>>Hide language switcher</option>
817
+ </select>
818
+ <?php }
819
+
820
+ public function googlelanguagetranslator_display_cb() {
821
+
822
+ $option_name = 'googlelanguagetranslator_display' ;
823
+ $new_value = 'Vertical';
824
+
825
+ if ( get_option( $option_name ) === false ) {
826
+
827
+ // The option does not exist, so we update it.
828
+ update_option( $option_name, $new_value );
829
+ }
830
+
831
+ $options = get_option (''.$option_name.''); ?>
832
+
833
+ <select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:170px;">
834
+ <option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
835
+ <option value="Horizontal" <?php if(get_option('googlelanguagetranslator_display')=='Horizontal'){echo "selected";}?>>Horizontal</option>
836
+ <?php
837
+ $browser_lang = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : '';
838
+ if (!empty($get_http_accept_language)):
839
+ $get_http_accept_language = explode(",",$browser_lang);
840
+ else:
841
+ $get_http_accept_language = explode(",",$browser_lang);
842
+ endif;
843
+ $bestlang = $get_http_accept_language[0];
844
+ $bestlang_prefix = substr($get_http_accept_language[0],0,2);
845
+
846
+ if ($bestlang_prefix == 'en'): ?>
847
+ <option value="SIMPLE" <?php if (get_option('googlelanguagetranslator_display')=='SIMPLE'){echo "selected";}?>>SIMPLE</option>
848
+ <?php endif; ?>
849
+ </select>
850
+ <?php }
851
+
852
+ public function googlelanguagetranslator_toolbar_cb() {
853
+
854
+ $option_name = 'googlelanguagetranslator_toolbar' ;
855
+ $new_value = 'Yes';
856
+
857
+ if ( get_option( $option_name ) === false ) {
858
+
859
+ // The option does not exist, so we update it.
860
+ update_option( $option_name, $new_value );
861
+ }
862
+
863
+ $options = get_option (''.$option_name.''); ?>
864
+
865
+ <select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:170px;">
866
+ <option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
867
+ <option value="No" <?php if(get_option('googlelanguagetranslator_toolbar')=='No'){echo "selected";}?>>No</option>
868
+ </select>
869
+ <?php }
870
+
871
+ public function googlelanguagetranslator_showbranding_cb() {
872
+
873
+ $option_name = 'googlelanguagetranslator_showbranding' ;
874
+ $new_value = 'Yes';
875
+
876
+ if ( get_option( $option_name ) === false ) {
877
+
878
+ // The option does not exist, so we update it.
879
+ update_option( $option_name, $new_value );
880
+ }
881
+
882
+ $options = get_option (''.$option_name.''); ?>
883
+
884
+ <select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:170px;">
885
+ <option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
886
+ <option value="No" <?php if(get_option('googlelanguagetranslator_showbranding')=='No'){echo "selected";}?>>No</option>
887
+ </select>
888
+ <?php }
889
+
890
+ public function googlelanguagetranslator_flags_alignment_cb() {
891
+
892
+ $option_name = 'googlelanguagetranslator_flags_alignment' ;
893
+ $new_value = 'flags_left';
894
+
895
+ if ( get_option( $option_name ) === false ) {
896
+
897
+ // The option does not exist, so we update it.
898
+ update_option( $option_name, 'flags_left' );
899
+ }
900
+
901
+ $options = get_option (''.$option_name.''); ?>
902
+
903
+ <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_left" value="flags_left" <?php if($options=='flags_left'){echo "checked";}?>/> Align Left<br/>
904
+ <input type="radio" name="googlelanguagetranslator_flags_alignment" id="flags_right" value="flags_right" <?php if($options=='flags_right'){echo "checked";}?>/> Align Right
905
+ <?php }
906
+
907
+ public function googlelanguagetranslator_analytics_cb() {
908
+
909
+ $option_name = 'googlelanguagetranslator_analytics' ;
910
+ $new_value = 0;
911
+
912
+ if ( get_option( $option_name ) === false ) {
913
+
914
+ // The option does not exist, so we update it.
915
+ update_option( $option_name, $new_value );
916
+ }
917
+
918
+ $options = get_option (''.$option_name.'');
919
+
920
+ $html = '<input type="checkbox" name="googlelanguagetranslator_analytics" id="googlelanguagetranslator_analytics" value="1" '.checked(1,$options,false).'/> &nbsp; Activate Google Analytics tracking?';
921
+ echo $html;
922
+ }
923
+
924
+ public function googlelanguagetranslator_analytics_id_cb() {
925
+
926
+ $option_name = 'googlelanguagetranslator_analytics_id' ;
927
+ $new_value = '';
928
+
929
+ if ( get_option( $option_name ) === false ) {
930
+
931
+ // The option does not exist, so we update it.
932
+ update_option( $option_name, $new_value );
933
+ }
934
+
935
+ $options = get_option (''.$option_name.'');
936
+
937
+ $html = '<input type="text" name="googlelanguagetranslator_analytics_id" id="googlelanguagetranslator_analytics_id" value="'.$options.'" />';
938
+ echo $html;
939
+ }
940
+
941
+ public function googlelanguagetranslator_flag_size_cb() {
942
+
943
+ $option_name = 'googlelanguagetranslator_flag_size' ;
944
+ $new_value = '18';
945
+
946
+ if ( get_option( $option_name ) === false ) {
947
+
948
+ // The option does not exist, so we update it.
949
+ update_option( $option_name, $new_value );
950
+ }
951
+
952
+ $options = get_option (''.$option_name.''); ?>
953
+
954
+ <select name="googlelanguagetranslator_flag_size" id="googlelanguagetranslator_flag_size" style="width:110px;">
955
+ <option value="16" <?php if($options=='16'){echo "selected";}?>>16px</option>
956
+ <option value="18" <?php if($options=='18'){echo "selected";}?>>18px</option>
957
+ <option value="20" <?php if($options=='20'){echo "selected";}?>>20px</option>
958
+ <option value="22" <?php if($options=='22'){echo "selected";}?>>22px</option>
959
+ <option value="24" <?php if($options=='24'){echo "selected";}?>>24px</option>
960
+ </select>
961
+ <?php }
962
+
963
+ public function googlelanguagetranslator_flags_order_cb() {
964
+ $option_name = 'googlelanguagetranslator_flags_order';
965
+ $new_value = '';
966
+
967
+ if ( get_option ( $option_name ) === false ) {
968
+
969
+ // The option does not exist, so we update it.
970
+ update_option( $option_name, $new_value );
971
+ }
972
+
973
+ $options = get_option ( ''.$option_name.'' ); ?>
974
+
975
+ <input type="hidden" id="order" name="googlelanguagetranslator_flags_order" value="<?php print_r(get_option('googlelanguagetranslator_flags_order')); ?>" />
976
+ <?php
977
+ }
978
+
979
+ public function googlelanguagetranslator_english_flag_choice_cb() {
980
+ $option_name = 'googlelanguagetranslator_english_flag_choice';
981
+ $new_value = 'us_flag';
982
+
983
+ if ( get_option ( $option_name ) === false ) {
984
+
985
+ // The option does not exist, so we update it.
986
+ update_option( $option_name, $new_value );
987
+ }
988
+
989
+ $options = get_option ( ''.$option_name.'' ); ?>
990
+
991
+ <select name="googlelanguagetranslator_english_flag_choice" id="googlelanguagetranslator_english_flag_choice">
992
+ <option value="us_flag" <?php if($options=='us_flag'){echo "selected";}?>>U.S. Flag</option>
993
+ <option value="uk_flag" <?php if ($options=='uk_flag'){echo "selected";}?>>U.K Flag</option>
994
+ <option value="canadian_flag" <?php if ($options=='canadian_flag'){echo "selected";}?>>Canadian Flag</option>
995
+ </select>
996
+ <?php
997
+ }
998
+
999
+ public function googlelanguagetranslator_spanish_flag_choice_cb() {
1000
+ $option_name = 'googlelanguagetranslator_spanish_flag_choice';
1001
+ $new_value = 'spanish_flag';
1002
+
1003
+ if ( get_option ( $option_name ) === false ) {
1004
+
1005
+ // The option does not exist, so we update it.
1006
+ update_option( $option_name, $new_value );
1007
+ }
1008
+
1009
+ $options = get_option ( ''.$option_name.'' ); ?>
1010
+
1011
+ <select name="googlelanguagetranslator_spanish_flag_choice" id="googlelanguagetranslator_spanish_flag_choice">
1012
+ <option value="spanish_flag" <?php if($options=='spanish_flag'){echo "selected";}?>>Spanish Flag</option>
1013
+ <option value="mexican_flag" <?php if ($options=='mexican_flag'){echo "selected";}?>>Mexican Flag</option>
1014
+ </select>
1015
+ <?php
1016
+ }
1017
+
1018
+ public function googlelanguagetranslator_portuguese_flag_choice_cb() {
1019
+ $option_name = 'googlelanguagetranslator_portuguese_flag_choice';
1020
+ $new_value = 'portuguese_flag';
1021
+
1022
+ if ( get_option ( $option_name ) === false ) {
1023
+
1024
+ // The option does not exist, so we update it.
1025
+ update_option( $option_name, $new_value );
1026
+ }
1027
+
1028
+ $options = get_option ( ''.$option_name.'' ); ?>
1029
+
1030
+ <select name="googlelanguagetranslator_portuguese_flag_choice" id="googlelanguagetranslator_spanish_flag_choice">
1031
+ <option value="portuguese_flag" <?php if($options=='portuguese_flag'){echo "selected";}?>>Portuguese Flag</option>
1032
+ <option value="brazilian_flag" <?php if ($options=='brazilian_flag'){echo "selected";}?>>Brazilian Flag</option>
1033
+ </select>
1034
+ <?php
1035
+ }
1036
+
1037
+ public function googlelanguagetranslator_css_cb() {
1038
+
1039
+ $option_name = 'googlelanguagetranslator_css' ;
1040
+ $new_value = '';
1041
+
1042
+ if ( get_option( $option_name ) === false ) {
1043
+
1044
+ // The option does not exist, so we update it.
1045
+ update_option( $option_name, $new_value );
1046
+ }
1047
+
1048
+ $options = get_option (''.$option_name.'');
1049
+
1050
+ $html = '<textarea style="width:100%; height:200px" name="googlelanguagetranslator_css" id="googlelanguagetranslator_css">'.$options.'</textarea>';
1051
+ echo $html;
1052
+ }
1053
+
1054
+ public function googlelanguagetranslator_multilanguage_cb() {
1055
+
1056
+ $option_name = 'googlelanguagetranslator_multilanguage' ;
1057
+ $new_value = 0;
1058
+
1059
+ if ( get_option( $option_name ) === false ) {
1060
+
1061
+ // The option does not exist, so we update it.
1062
+ update_option( $option_name, $new_value );
1063
+ }
1064
+
1065
+ $options = get_option (''.$option_name.'');
1066
+
1067
+ $html = '<input type="checkbox" name="googlelanguagetranslator_multilanguage" id="googlelanguagetranslator_multilanguage" value="1" '.checked(1,$options,false).'/> &nbsp; Turn on multilanguage mode?';
1068
+ echo $html;
1069
+ }
1070
+
1071
+ public function googlelanguagetranslator_exclude_translation_cb() {
1072
+
1073
+ $option_name = 'googlelanguagetranslator_exclude_translation';
1074
+ $new_value = '';
1075
+
1076
+ if (get_option($option_name) === false ) {
1077
+ // The option does not exist, so we update it.
1078
+ update_option( $option_name, $new_value );
1079
+ }
1080
+
1081
+ $options = get_option (''.$option_name.'');
1082
+
1083
+ $html = '<input type="text" name="'.$option_name.'" id="'.$option_name.'" value="'.$options.'" />';
1084
+
1085
+ echo $html;
1086
+ }
1087
+
1088
+ public function page_layout_cb() {
1089
+ include( plugin_dir_path( __FILE__ ) . '/css/style.php'); add_thickbox(); ?>
1090
+ <div id="glt-settings" class="wrap">
1091
+ <div id="icon-options-general" class="icon32"></div>
1092
+ <h2><span class="notranslate">Google Language Translator</span></h2>
1093
+ <form action="<?php echo admin_url( '/options.php'); ?>" method="post">
1094
+ <div class="metabox-holder has-right-sidebar" style="float:left; width:65%">
1095
+ <div class="postbox glt-main-settings" style="width: 100%">
1096
+ <h3 class="notranslate">Main Settings</h3>
1097
+ <?php settings_fields('google_language_translator'); ?>
1098
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1099
+ <tr>
1100
+ <td style="width:60%" class="notranslate">Plugin Status:</td>
1101
+ <td class="notranslate"><?php $this->googlelanguagetranslator_active_cb(); ?></td>
1102
+ </tr>
1103
+
1104
+ <tr class="notranslate">
1105
+ <td>Choose the original language of your website</td>
1106
+ <td><?php $this->googlelanguagetranslator_language_cb(); ?></td>
1107
+ </tr>
1108
+ </table>
1109
+ </div> <!-- .postbox -->
1110
+
1111
+ <div class="postbox glt-layout-settings" style="width: 100%">
1112
+ <h3 class="notranslate">Layout Settings</h3>
1113
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1114
+ <tr class="notranslate">
1115
+ <td colspan="2">What languages will display in the language switcher? (<a class="select-all-languages" href="#">Select All</a> | <a class="clear-all-languages" href="#">Clear</a>)</td>
1116
+ </tr>
1117
+
1118
+ <tr class="notranslate languages">
1119
+ <td colspan="2"><?php $this->language_display_settings_cb(); ?></td>
1120
+ </tr>
1121
+
1122
+ <tr class="notranslate">
1123
+ <td class="choose_flags_intro">Show flag images?<br/>(Display up to 104 flags above the language switcher)</td>
1124
+ <td class="choose_flags_intro"><?php $this->googlelanguagetranslator_flags_cb(); ?></td>
1125
+ </tr>
1126
+
1127
+
1128
+
1129
+ <tr class="notranslate">
1130
+ <td>Show or hide the langauge switcher?</td>
1131
+ <td><?php $this->googlelanguagetranslator_translatebox_cb(); ?></td>
1132
+ </tr>
1133
+
1134
+ <tr class="notranslate">
1135
+ <td>Layout option:</td>
1136
+ <td><?php $this->googlelanguagetranslator_display_cb(); ?></td>
1137
+ </tr>
1138
+
1139
+ <tr class="notranslate">
1140
+ <td>Show Google Toolbar?</td>
1141
+ <td><?php $this->googlelanguagetranslator_toolbar_cb(); ?></td>
1142
+ </tr>
1143
+
1144
+ <tr class="notranslate">
1145
+ <td>Show Google Branding? &nbsp;<a href="https://developers.google.com/translate/v2/attribution" target="_blank">Learn more</a></td>
1146
+ <td><?php $this->googlelanguagetranslator_showbranding_cb(); ?></td>
1147
+ </tr>
1148
+
1149
+ <tr class="alignment notranslate">
1150
+ <td class="flagdisplay">Align the translator left or right?</td>
1151
+ <td class="flagdisplay"><?php $this->googlelanguagetranslator_flags_alignment_cb(); ?></td>
1152
+ </tr>
1153
+ </table>
1154
+ </div> <!-- .postbox -->
1155
+
1156
+ <div class="postbox glt-floating-widget-settings" style="width: 100%">
1157
+ <h3 class="notranslate">Floating Widget Settings</h3>
1158
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1159
+ <tr class="floating_widget notranslate">
1160
+ <td>Show floating translation widget?<br/>
1161
+ <span>("All Languages" option <strong><u>must</u></strong> be chosen to show widget.)</span>
1162
+ </td>
1163
+ <td><?php $this->googlelanguagetranslator_floating_widget_cb(); ?></td>
1164
+ </tr>
1165
+
1166
+ <tr class="floating_widget_text notranslate">
1167
+ <td>Custom text for the floating widget:</td>
1168
+ <td><?php $this->googlelanguagetranslator_floating_widget_text_cb(); ?></td>
1169
+ </tr>
1170
+
1171
+ <tr class="floating_widget_text notranslate">
1172
+ <td>Allow floating widget text to translate?:</td>
1173
+ <td><?php $this->googlelanguagetranslator_floating_widget_text_allow_translation_cb(); ?></td>
1174
+ </tr>
1175
+ </table>
1176
+ </div> <!-- .postbox -->
1177
+
1178
+ <div class="postbox glt-behavior-settings" style="width: 100%">
1179
+ <h3 class="notranslate">Behavior Settings</h3>
1180
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1181
+ <tr class="multilanguage notranslate">
1182
+ <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 you activate this setting, Google will translate all text into a single language when requested by your user, even if text is written in multiple languages. In most cases, this setting is not recommended, although for certain websites it might be necessary.</p></div></td>
1183
+ <td><?php $this->googlelanguagetranslator_multilanguage_cb(); ?></td>
1184
+ </tr>
1185
+
1186
+ <tr class="notranslate">
1187
+ <td>Google Analytics:</td>
1188
+ <td><?php $this->googlelanguagetranslator_analytics_cb(); ?></td>
1189
+ </tr>
1190
+
1191
+ <tr class="analytics notranslate">
1192
+ <td>Google Analytics ID (Ex. 'UA-11117410-2')</td>
1193
+ <td><?php $this->googlelanguagetranslator_analytics_id_cb(); ?></td>
1194
+ </tr>
1195
+ </table>
1196
+ </div> <!-- .postbox -->
1197
+
1198
+ <div class="postbox glt-usage-settings" style="width: 100%">
1199
+ <h3 class="notranslate">Usage</h3>
1200
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1201
+ <tr class="notranslate">
1202
+ <td>For usage in pages/posts/sidebar:</td>
1203
+ <td><code>[google-translator]</code></td>
1204
+ </tr>
1205
+
1206
+ <tr class="notranslate">
1207
+ <td style="width:40%">For usage in header/footer/page templates:</td>
1208
+ <td style="width:60%"><code>&lt;?php echo do_shortcode('[google-translator]'); ?&gt;</code></td>
1209
+ </tr>
1210
+
1211
+ <tr class="notranslate">
1212
+ <td colspan="2">Single language usage in menus/pages/posts</td>
1213
+ </tr>
1214
+
1215
+ <tr class="notranslate">
1216
+ <td colspan="2"><code>[glt language="Spanish" label="Espa&ntilde;ol" image="yes" text="yes" image_size="24"]</code></td>
1217
+ </tr>
1218
+
1219
+ <tr class="notranslate">
1220
+ <td colspan="2">
1221
+ <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>
1222
+ <div id="single-language-shortcode-description" style="display:none">
1223
+ <p>For menu usage, you need to create a new menu, or use an existing menu, by navigating to "Appearance > Menus".</p>
1224
+ <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>
1225
+ <p>Once descriptions are enabled, follow these steps:<br/>
1226
+ <ol>
1227
+ <li>Create a new menu item using "Link" as the menu item type.</li>
1228
+ <li>Use <code style="border:none">#</code> for the URL</li>
1229
+ <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>
1230
+ <li>Place the following shortcode into the "description" field, and modify it to display the language and navigation label of your choice:</li>
1231
+ </ol>
1232
+ <p><code>[glt language="Spanish" label="Espa&ntilde;ol"]</code></p>
1233
+ </div> <!-- .single-language-shortcode-description -->
1234
+ </td>
1235
+ </tr>
1236
+
1237
+ <tr class="notranslate">
1238
+ <td colspan="2">
1239
+ <?php
1240
+ if (isset($_POST['submit'])) {
1241
+ if (empty($_POST['submit']) && !check_admin_referer( 'glt-save-settings', 'glt-save-settings-nonce' )) {
1242
+ wp_die();
1243
+ }
1244
+ }
1245
+ wp_nonce_field('glt-save-settings, glt-save-settings-nonce', false);
1246
+ submit_button(); ?>
1247
+ </td>
1248
+ </tr>
1249
+ </table>
1250
+ </div> <!-- .postbox -->
1251
+ </div> <!-- .metbox-holder -->
1252
+
1253
+ <div class="metabox-holder" style="float:right; clear:right; width:33%">
1254
+ <div class="postbox glt-preview-settings">
1255
+ <h3 class="notranslate">Preview</h3>
1256
+ <table style="width:100%">
1257
+ <tr>
1258
+ <td style="box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; padding:15px 15px; margin:0px"><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>
1259
+ </td>
1260
+ </tr>
1261
+ </table>
1262
+ </div> <!-- .postbox -->
1263
+ </div> <!-- .metabox-holder -->
1264
+
1265
+ <div class="metabox-holder box-right notranslate" style="float: right; width: 33%; clear:right">
1266
+ <div class="postbox glt-advanced-settings">
1267
+ <h3>Advanced Settings</h3>
1268
+ <div class="inside">
1269
+ <table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
1270
+ <tr class="notranslate">
1271
+ <td class="advanced">Select flag size:</td>
1272
+ <td class="advanced"><?php $this->googlelanguagetranslator_flag_size_cb(); ?></td>
1273
+ </tr>
1274
+
1275
+ <tr class="notranslate">
1276
+ <td class="advanced">Flag for English:</td>
1277
+ <td class="advanced"><?php $this->googlelanguagetranslator_english_flag_choice_cb(); ?></td>
1278
+ </tr>
1279
+
1280
+ <tr class="notranslate">
1281
+ <td class="advanced">Flag for Spanish:</td>
1282
+ <td class="advanced"><?php $this->googlelanguagetranslator_spanish_flag_choice_cb(); ?></td>
1283
+ </tr>
1284
+
1285
+ <tr class="notranslate">
1286
+ <td class="advanced">Flag for Portuguese:</td>
1287
+ <td class="advanced"><?php $this->googlelanguagetranslator_portuguese_flag_choice_cb(); ?></td>
1288
+ </tr>
1289
+ </table>
1290
+ </div> <!-- .inside -->
1291
+ </div> <!-- .postbox -->
1292
+ </div> <!-- .metabox-holder -->
1293
+
1294
+
1295
+ <div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
1296
+ <div class="postbox glt-css-settings">
1297
+ <h3>Add CSS Styles</h3>
1298
+ <div class="inside">
1299
+ <p>You can apply any necessary CSS styles below:</p>
1300
+ <?php $this->googlelanguagetranslator_css_cb(); ?>
1301
+ </div> <!-- .inside -->
1302
+ </div> <!-- .postbox -->
1303
+ </div> <!-- .metabox-holder -->
1304
+ <?php $this->googlelanguagetranslator_flags_order_cb(); ?>
1305
+ </form>
1306
+
1307
+ <div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
1308
+ <div class="postbox">
1309
+ <h3>GLT Premium 5.0.39 is Here! $30</h3>
1310
+ <div class="inside">
1311
+ <a class="wp-studio-logo" href="http://www.wp-studio.net/" target="_blank"><img style="background:#444; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px; width:177px;" src="<?php echo plugins_url( 'images/logo.png' , __FILE__ ); ?>"></a><br />
1312
+ <ul id="features" style="margin-left:15px">
1313
+ <li style="list-style:square outside">104 Languages with flags</li>
1314
+ <li style="list-style:square outside">Edit up to 5 phrases in any language, while using auto-translation</li>
1315
+ <li style="list-style:square outside">6 Floating Widget positions</li>
1316
+ <li style="list-style:square outside">Exclude specific areas from translation</li>
1317
+ <li style="list-style:square outside">jQuery-powered language switcher</li>
1318
+ <li style="list-style:square outside">Add single languages to your menus/pages/posts</li>
1319
+ <li style="list-style:square outside">Language switcher loads inline with page content</li>
1320
+ <li style="list-style:square outside">Custom flag choices for English, Spanish and Portuguese</li>
1321
+ <li style="list-style:square outside">User-friendly URLs, hide or show <code>lang</code> attribute</li>
1322
+ <li style="list-style:square outside">Drag/drop flags to re-arrange their order</li>
1323
+ <li style="list-style:square outside">Duplicate pages/posts into your chosen languages (for editing)</li>
1324
+ <li style="list-style:square outside">FREE access to all future updates</li>
1325
+ </ul>
1326
+ </div> <!-- .inside -->
1327
+ </div> <!-- .postbox -->
1328
+ </div> <!-- .metabox-holder -->
1329
+
1330
+ <div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
1331
+ <div class="postbox">
1332
+ <h3>Please Consider A Donation</h3>
1333
+ <div class="inside">If you find our plugin useful, help keep it actively developed by clicking the donate button <br /><br />
1334
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
1335
+ <input type="hidden" name="cmd" value="_donations">
1336
+ <input type="hidden" name="business" value="robertmyrick@hotmail.com">
1337
+ <input type="hidden" name="lc" value="US">
1338
+ <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!">
1339
+ <input type="hidden" name="no_note" value="0">
1340
+ <input type="hidden" name="currency_code" value="USD">
1341
+ <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
1342
+ <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!">
1343
+ <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
1344
+ </form>
1345
+ </div> <!-- .inside -->
1346
+ </div> <!-- .postbox -->
1347
+ </div> <!-- .metabox-holder -->
1348
+ </div> <!-- .wrap -->
1349
+ <?php
1350
+ }
1351
+ }
 
 
 
 
 
 
 
 
1352
  $google_language_translator = new google_language_translator();
readme.txt CHANGED
@@ -1,404 +1,407 @@
1
- === Google Language Translator ===
2
- Contributors: Rob Myrick
3
- Donate link: http://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=47LFA33AC89S6
4
- Plugin link: http://wp-studio.net/how-it-works
5
- Tags: language translator, google translator, language translate, translate wordpress, google language translator, translation, translate, multi language
6
- Requires at least: 2.9
7
- Tested up to: 4.9.2
8
- Stable tag: 5.0.39
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
-
12
- == Description ==
13
-
14
- Settings include: inline or vertical layout, show/hide specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
15
-
16
- == Installation ==
17
-
18
- 1. Download the zip folder named google-language-translator.zip
19
- 2. Unzip the folder and put it in the plugins directory of your wordpress installation. (wp-content/plugins).
20
- 3. Activate the plugin through the plugin window in the admin panel.
21
- 4. Go to Settings > Google Language Translator, enable the plugin, and then choose your settings.
22
- 5. Copy the shortcode and paste it into a page, post or widget.
23
- 6. Do not use the shortcode twice on a single page - it will not work.
24
-
25
- == Frequently Asked Questions ==
26
-
27
- Q: What should I do if the translate widget does not show on my website?
28
-
29
- 1. Make sure that the plugin is installed and activated.
30
- 2. Verify that a check mark is placed in the activation setting located at "Settings > Google Language Translator".
31
- 3. Verify that the native Wordpress function, wp_footer(), is included in your theme's footer file.
32
- 4. Verify that "Show Language Box?" setting is enabled at "Settings > Google Language Translator".
33
- 5. Use your browser's web tools to ensure that CSS styles are not hiding the translation widget.
34
- 6. Contact support at http://www.wp-studio.net/submit-ticket.
35
-
36
- Q: What should I do if there are no languages being displayed in the language box?
37
-
38
- 1. Make sure that the plugin is installed and activated.
39
- 2. Verify that a check mark is placed in the activation setting located at "Settings > Google Language Translator".
40
- 3. Verify that Adobe Flash is installed in your web browser. Google uses Flash in order to display their language box.
41
- 4. Contact support at http://www.wp-studio.net/submit-ticket.
42
-
43
- Q: Can I exclude certain areas of my website from being translated?
44
-
45
- A: Yes! Add the "notranslate" class to the HTML element containing your text. For example, the following text will be excluded from translation: <span class="notranslate">Hello World!</span>
46
-
47
- == Changelog ==
48
-
49
- 5.0.39
50
- - Fixed a CSS issue associated with the settings panel changes from the previous update.
51
-
52
- 5.0.38
53
- - Fixed a CSS issue associated with the settings panel changes from the previous update. Flags were not aligning properly with align left/right settings.
54
-
55
- 5.0.37
56
- - Made some additional adjustments in code for the settings page.
57
-
58
- 5.0.36
59
- - Removed undefined variable PHP errors.
60
-
61
- 5.0.35
62
- - Updated the plugin to delete an unused option from the database, used in the settings panel.
63
-
64
- 5.0.34
65
- - Updated the settings panel to function more logically. Now users choose the languages they want, and can turn on/off flags associated with those langauges.
66
-
67
- 5.0.33
68
- - Removed a deprecated jQuery function, and replaced with updated code in the footer_script() function.
69
-
70
- 5.0.32
71
- - Fixed the issue with menu translation not working on some mobile devices.
72
- - Moved element.js script to the footer.
73
-
74
- 5.0.31
75
- - Fixed an issue with menu shortcode not displaying the correct flag choice (i.e. for English/Spanish/Portuguese flags).
76
-
77
- 5.0.30
78
- - Organized the settings page into sections.
79
- - Upgraded Wordpress.org plugin banner.
80
- - Added additional attributes to single language shortcodes. Users now have ability to display flag images, change flag sizes, or show/hide the text label.
81
- - Changed Chinese (Traditional) language flag to the Flag of Taiwan.
82
- - Fixed a minor display issue with the Google Analytics setting in Wordpress Dashboard.
83
-
84
- 5.0.29
85
- - Fixed CSS display issues with the floating widget.
86
-
87
- 5.0.28
88
- - Fixed CSS display issues with the floating widget.
89
-
90
- 5.0.27
91
- - Removed toolbar.js and flags.js and combined to existing files (to improve efficiency of page load and http requests).
92
- - Added new setting to allow or prevent floating widget text to translate.
93
-
94
- 5.0.26
95
- - Fixed a small error in adding the setting for Floating Widget text.
96
-
97
- 5.0.25
98
- - Added new setting for custom text in the Floating Widget.
99
- - Removed "notranslate" class from the Floating Widget text to allow for translation.
100
-
101
- 5.0.24
102
- - Improved functionality for flags. Users are now returned to original language when the flag is displayed. The Google Toolbar will be hidden once returning back to the original language. The Google Toolbar will appear again when another translation is made.
103
- - Fixed the issue with flags not functioning with SIMPLE layout.
104
- - Removed SIMPLE layout option (which was not working properly) for browsers not using English browsers. The coding challenge for implementing this option is difficult and must be postponed until we find a practical solution.
105
-
106
- 5.0.23
107
- - Reverted back to an older version of flags.js. We still have some bugs to work out before releasing the updated version. We apologize for the inconvenience.
108
-
109
- 5.0.22
110
- - Changed a line of text on the settings page.
111
- - Removed a line of redundant javascript to reduce unnecessary page load.
112
- - Fixed an HTML attribute issue displaying in the menu shortcode.
113
- - Improved functionality for flags. The flag for default language will now be disabled once users click it's flag. Flag will be re-enabled once user makes another translation.
114
-
115
- 5.0.21
116
- - Added 6 new languages with their associated flags: Hawaiian, Kurdish, Kyrgyz, Luxembourgish, Pashto, and Shona. You can now use these langauges using the menu shortcode, as well.
117
- - Added a "Select All / Clear All" feature to the settings page. No more finger cramps!
118
-
119
- 5.0.20
120
- - Added Corsican as a new language with its associated flag.
121
-
122
- 5.0.19
123
- - Added Frisian as a new language with its associated flag.
124
-
125
- 5.0.18
126
- - Added Sindhi as a new language with its associated flag.
127
-
128
- 5.0.17
129
- - Added Samoan as a new language with its associated flag.
130
- - Added mobile-responsive CSS to the GLT settings page.
131
-
132
- 5.0.16
133
- - Added Xhosa as a new language with its associated flag.
134
-
135
- 5.0.15
136
- - Added Amharic as a new language with its associated flag.
137
-
138
- 5.0.14
139
- - Fixed a file naming error in google-language-translator.php. This caused flags not to display - we apologize for the inconvenience.
140
-
141
- 5.0.13
142
- - Renamed some of the wp_enqueue_script calls to include more unique file names, thus avoiding conflict with other plugins overriding these files.
143
- - Corrected some file paths to be more accurate/secure.
144
- - Removed WP Helpdesk logo from the settings page. We are no longer offering these services officially.
145
-
146
- 5.0.12
147
- - Revert malicious changes made in 5.0.10
148
-
149
- 5.0.11
150
- - Fixed incorrect link
151
-
152
- 5.0.10
153
- - Tested up to 4.6
154
-
155
- 5.0.09
156
- - Turned off error reporting. I apologize for the inconvenience.
157
-
158
- 5.0.08
159
- - Added a new popup-style layout". You can find this new layout in the settings page located in "Settings > Google Language Translator".
160
-
161
- 5.0.07
162
- - Changed the flag for Chinese(Traditional) to the Taiwanese flag. Requested long ago by a few users - thanks for your months of patience!
163
-
164
- 5.0.06
165
- - Fixed a XSS Cross Scripting Vulnerability in the plugin, as requested by Wordpress.org. Unnecessary code (during testing) was being posted to the settings page, so the code was removed.
166
-
167
- 5.0.05
168
- - Added 3 new options to the settings page: English, Spanish, and Portuguese flag image variations.
169
- - Fixed an error with the Floating Widget: order of flags was not being honored in certain cases.
170
-
171
- 5.0.04
172
- - Corrected the text on the settings page to reflect 91 total flags, instead of 81 flags.
173
-
174
- 5.0.03
175
- - Added 10 new languages and associated flags: Chichewa, Kazakh, Malagasy, Malayalam, Myanmar(Burmese), Sesotho, Sinhala, Sundanese, Tajik, and Uzbek.
176
-
177
- 5.0.02
178
- - Updated the Tamil flag to use the Indian flag, instead of Tamil Tigers flag.
179
-
180
- 5.0.01
181
- - Updated style.css to reflect the syntax error connecting to the Chinese flag.
182
-
183
- 5.0.0
184
- - Wordpress security updates added to the settings page [wp_nonce_field()].
185
- - Removed 3 outside Javascript files - these files are now called upon directly from Wordpress CMS.
186
- - Unpacked flags.js p,a,c,k,e,r code. Unknowingly, this method of coding violated Wordpress plugin policy.
187
- - Updated pricing display for GLT Premium. It was displaying $15 previously, but the price had increased since the last update.
188
-
189
- 4.0.9
190
- - Replaced: incorrect Catalonian flag image, with the correct image. I apologize for any inconvenience.
191
- - Fixed: Floating Widget issue - previously it loaded 2 times when shortcode was added, which caused it not to work.
192
-
193
- 4.0.8
194
- - Fixed the small syntax issue related to the Google Analytics tracking number - it was another cause of the language box not displaying.
195
-
196
- 4.0.7
197
- - Fixed a CSS error in the settings panel display.
198
- - Fixed the coding issue when "Specific Languages" option is chosen - the shortcode was not displaying the language dropdown.
199
-
200
- 4.0.6
201
-
202
- - Removed: "onclick" events from diplaying directly inside HTML. Converted those events to jQuery.
203
- - Fixed the shortcode that allows adding single languages to Wordpress menus. (New example is shown on settings page.)
204
- - Consolidated all flag images into image sprites!
205
- - Re-designed 10 flag images to match the quality of the other flags.
206
- - Fixed the incorrect "alt" tags associated with flag images. The "alt" tag now displays the language name.
207
- - Modified text on the settings page - also added some lightbox pop-ups to help explain settings.
208
- - New updates have also been provided for our Premium version (currently version 4.0.1) located at http://www.wp-studio.net/
209
-
210
- 4.0.5
211
-
212
- - Fixed: Display bug when using single language shortcode.
213
- - Added: New link on the Plugins menu page, which links directly to Google Language Translator settings.
214
-
215
-
216
- 4.0.4
217
-
218
- - Added NEW shortcode! Allows placement of single languages into the navigation menu, pages, and posts. See settings panel for usage details.
219
- - Re-factored code in googlelanguagetranslator.php which reduced code to around 950 lines.
220
- - Removed the "de-activation" hook, which previously deleted options when plugin de-activated. Added "uninstall" hook instead, so that settings will be preserved only when user deletes the plugin completely.
221
- - Updated CSS styles for the flags area to prevent themes from overriding layouts.
222
-
223
- 4.0.3
224
-
225
- - Adjusted CSS styles for the flag display.
226
-
227
- 4.0.2
228
-
229
- - Eliminated all (or most) HTML validation errors. Big improvement!
230
- - Re-factored more code to increase efficiency.
231
- - Added de-activation hook to reset all plugin settings when plugin is de-activated. (CSS Overrides and Google Analytics ID setting will remain in place and won't be deleted.)
232
- - Fixed the issue with flag language checkboxes. Users can remove English flag if so desired. Previously, English flag was alway required to stay checked, which was not most user-friendly.
233
-
234
- 4.0.1
235
-
236
- - Fixed PHP errors that were neglected in upgrade to 4.0.
237
- - Added conditionals to prevent scripts from loading when the floating widget is turned off.
238
-
239
- 4.0
240
-
241
- - Added 2 new features: 1) Drag/drop flags to re-arrange their order, and 2) Custom flag sizes (16px to 24px).
242
- - Re-factored code in google-language-translator.php. Languages are now loaded dynamically and are not hard-coded.
243
- - GLT Premium is now released: Updates include multiple flags for English, Spanish, and Portuguese languages; customized URLs with 'lang' attribute; drag/drop flags to re-arrnage their order
244
-
245
- 3.0.9
246
-
247
- - Added a title field to the Google Language Translator widget.
248
- - Removed "unexpected text characters" error upon activation (due to error in activation hook).
249
-
250
- 3.0.8
251
-
252
- - Added 9 new languages into the plugin (Hausa, Igbo, Maori, Mongolian, Nepali, Punjabi, Somali, Yoruba, Zulu).
253
- - Corrected an "undefined variable" error that was being generated in Vertical and Horizontal layouts.
254
- - Re-structured coding once again into an Object-Oriented approach.
255
- - Moved all functions of the base class into 'googlelanguagetranslator.php' and the widget into 'widget.php'.
256
- - Moved all javascript files into it's own JS folder.
257
- - Fixed an display issue with "Edit Translations" - they were being hidden when "No branding" option was chosen.
258
- - Corrected various "comma" errors in the string that outputs the script for loading the translator.
259
- - Changed Changelog in readme.txt to show most recent changes first, instead of last.
260
-
261
- 3.0.7
262
-
263
- - Removed an unnecessary CSS file, left over from development. Sorry for any inconvenience if you received display errors.
264
-
265
- 3.0.6
266
-
267
- - Corrected a small display error in displaying the floating widget correctly.
268
-
269
- 3.0.5
270
-
271
- - Added new Floating Widget (see settings page). The Floating Widget is simply another way for allowing website visitors to translate languages. The functionality is built-in with the existing flag preferences, and can be turned on or off at the administrator's preference. The floating widget can also function in full with both the language box and/or flags showing OR hiding, so the administrator has full control of how it displays. The floating widget is placed at bottom right of the website in the free version, but can be placed in other locations by changing CSS styles associated with the box. The premium version will allow more options as to changing the Floating Widget location.
272
- - Fixed the issue with Dashboard styles loading on the wrong pages. This was causing some annoying display issues on the Wordpress Dashboard.
273
-
274
- 3.0.4
275
-
276
- - Re-factored/re-arranged more code in google languagetransltor.php by placing them into separate files.
277
- - Fixed the issue of Custom CSS box not displaying it's styles to the website. This was only missed in this last update, due to re-arrangement of the files. Sorry for any inconvenience.
278
- - Removed style2.php file, which is unnecessary and was being used in testing.
279
-
280
- 3.0.3
281
-
282
- - Re-factored/re-arranged some of the code in googlelanguagetranslator.php by placing them into separate files.
283
- - Fixed a minor coding issue in glt_widget.php - this was generating an error in Wordpress when debugging.
284
- - Moved all CSS code into a single file. The result is nice, clean inline CSS code that is now called only once.
285
- - Fixed some additional CSS display issues.
286
-
287
- 3.0.2
288
-
289
- - Adjusted additional minor invalid HTML issues on the settings page, and also in the front-end plugin display.
290
-
291
- 3.0.1
292
-
293
- - Changed the url request to Google to allow both unsecured and secured page translations. Previously, some users experienced errors when trying to use the translator on "https://" (secured) pages.
294
- - Adjusted some minor spacing issues in the settings page HTML (caused some annoying red HTML errors when using "View Source" in right-click menu).
295
- - Removed old CSS styles that were added in the previous 3.0 update - the styles were added when Google servers were being updated, and were producing major translation dislay issues until their update was complete. Now the styles I added are no longer needed.
296
-
297
- 3.0
298
-
299
- - Correct a small CSS error that affected the showing/hiding of the Google toolbar.
300
-
301
- 2.9
302
-
303
- ***IMPORTANT: Google's most recent server update is producing display issues for website translation tool. There are major display issues with the translation toolbar and also the translations editing interface. Version 2.9 temporarily hides the edit translation functionality until Google decides to fix this issue, although you can still edit translations directly through your Google account at translate.google.com. Please direct any support requests through Wordpress.org and we will be happy to assist you.
304
-
305
- - Fixed Google Translation toolbar display issue
306
- - Fixed the Edit Translation interface by hiding it temporarily until Google fixes this
307
- - Removed some unneeded styles from the style sheet.
308
- - Fixed some CSS issues for the Google Branding display, which was affected by Google's most recent update
309
-
310
- 2.8
311
-
312
- - Added an option to allow users to manage their own translations directly through their Google Translate account (free). When activated, users can hover over the text of their website, and edit the translations from the webpage directly. Google will remember these translations, and then serve them to users once the edits are made. Users must install the Google Translate Customization meta tag provided through Google Translate here: translate.google.com/manager/website/settings. To obtain this meta tag, users need to configure the Google Translate tool directly from this website (although they will not use this because the plugin provides it), then the user can obtain the meta tag on the "Get Code" screen, which is displayed after configuring the Google Translate tool on this webpage.
313
- - Added an option to allow users to turn on/off Google's multilanguagePage option, that when activated, the original website content will be a forced translation, instead of original content (but only after a translation is made.)
314
- - Added more flexible styles to the settings page, so that left and right panels display nicely to the user.
315
-
316
- 2.7
317
-
318
- - Added Google Analytics tracking capability to the plugin.
319
-
320
- - Added a "CSS Styles" box in the settings panel.
321
-
322
- - Changed the Catalonian flag to its correct flag image.
323
-
324
- - Fixed coding issues that previously updated options incorrectly, which is why many users experienced display issues. All options are now initialized upon plugin activation, which should fix this issue permanently.
325
-
326
- - Fixed a glitch in our usage of the translate API. Previously, when the user clicked the default language, it would toggle back and forth between the default language and "Afrikaans" language. Now, users will see the correct language displayed at all times, no matter how many times it is clicked.
327
-
328
- 2.6
329
-
330
- - Added defaults to all options to ensure there are no more issues with the translator displaying upon installation. Again, sorry for any inconvenience.
331
-
332
- 2.5
333
-
334
- - Eliminated an internal Wordpress error being generated from a coding mistake.
335
-
336
- - Added a default option for the Translator alingment. Previously, this was causing the plugin to disapppear.
337
-
338
- 2.4
339
-
340
- - Found a couple of small display errors in the settings page after uploading version 2.3. Sorry for any inconvenience!
341
-
342
- 2.3
343
-
344
- - Added a "Preview" area on the settings page that allows you to see your settings in action.
345
-
346
- - Added custom flag support for all languages (custom flags available ONLY when selecting the "ALL Languages" setting.
347
-
348
- - Added an option that allows left/right alignment of the translation tool.
349
-
350
- - Added the "Google Language Translator" widget.
351
-
352
- - Updated googlelanguagetranslator.php to properly register setting in the admin settings panel.
353
-
354
- 2.2
355
-
356
- - Added language "Portuguese" and "German" to the Original Language drop-down option on the settings page.
357
-
358
- - Changed flag image for the English language (changed United States flag to the United Kingdom flag).
359
-
360
- - Added link in the settings panel that points to Google's Attribution Policy.
361
-
362
- 2.1
363
-
364
- - Added language "Dutch" to the Original Language drop-down option on the settings page.
365
-
366
- - Added a new CSS class that more accurately hides the "Powered by" text when hiding Google's branding. In previous version, the "Powered by" text was actually disguised by setting it's color to "transparent", but now we have set it's font-size to 0px instead.
367
-
368
- 2.0 Corrected some immediate errors in the 1.9 update.
369
-
370
- 1.9
371
-
372
- - Added 7 flag image choices that, when clicked by website visitors, will change the language displayed, both on the website, AND in the drop-down box (flag language choices are limited to those provided in this plugin).
373
-
374
- - Added 6 additional languages to the translator, as provided in Google's most recent updates ( new languages include Bosnian, Cebuano, Khmer, Marathi, Hmong, Javanese ).
375
-
376
- - Corrected a minor technical issue where the Czech option (on the backend) was incorrectly displaying the Croatian language on the front end.
377
-
378
- - Added jQuery functionality to the settings panel to improve the user experience.
379
-
380
- - Added an option for users to display/hide the flag images.
381
-
382
- - Added an option for users to display/hide the translate box when flags are displayed.
383
-
384
- - Removed the settings.css file - I found a better way of displaying the options without CSS.
385
-
386
- 1.8 Modified google-language-translator.php to display the correct output to the browser when horizontal layout is selected. Previously, it was not displaying at all.
387
-
388
- 1.7 Modified google-language-translator.php so that jQuery and CSS styles were enqueued properly onto the settings page only. Previously, jQuery functionality and CSS styles were being added to all pages of the Wordpresss Dashboard, which was causing functionality and display issues for some users.
389
-
390
- 1.6 Added "Specific Language" support to the plugin settings, which allows the user to choose specific languages that are displayed to website visitors.
391
-
392
- 1.5 Added "Original Language" support to the plugin settings, which allows the user to choose the original language of their website, which ultimately removes the original language as a choice in the language drop-down presented to website visitors.
393
-
394
- 1.4 Corrected display problems associated with CSS styles not being placed correctly in wp_head.
395
-
396
- 1.3 HTML display problem in the sidebar area now fixed. Previously, inserting the [google-translator] plugin into a text widget caused it to display above the widget, instead of inside of it.
397
-
398
- 1.2 Shortcode support is now available for adding [google-translator] to text widgets. I apologize for any inconvenience this may have caused.
399
-
400
- 1.1 The shortcode supplied on the settings page was updated to display '[google-translator]'.
401
-
402
- == Screenshots ==
403
-
404
- 1. Settings include: inline or vertical layout, hide/show Google toolbar, display specific languages, and show/hide Google branding. Add the shortcode to pages, posts, and widgets.
 
 
 
1
+ === Google Language Translator ===
2
+ Contributors: Rob Myrick
3
+ Donate link: http://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=47LFA33AC89S6
4
+ Plugin link: http://wp-studio.net/how-it-works
5
+ Tags: language translator, google translator, language translate, translate wordpress, google language translator, translation, translate, multi language
6
+ Requires at least: 2.9
7
+ Tested up to: 4.9.2
8
+ Stable tag: 5.0.40
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
+
12
+ == Description ==
13
+
14
+ Settings include: inline or vertical layout, show/hide specific languages, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
15
+
16
+ == Installation ==
17
+
18
+ 1. Download the zip folder named google-language-translator.zip
19
+ 2. Unzip the folder and put it in the plugins directory of your wordpress installation. (wp-content/plugins).
20
+ 3. Activate the plugin through the plugin window in the admin panel.
21
+ 4. Go to Settings > Google Language Translator, enable the plugin, and then choose your settings.
22
+ 5. Copy the shortcode and paste it into a page, post or widget.
23
+ 6. Do not use the shortcode twice on a single page - it will not work.
24
+
25
+ == Frequently Asked Questions ==
26
+
27
+ Q: What should I do if the translate widget does not show on my website?
28
+
29
+ 1. Make sure that the plugin is installed and activated.
30
+ 2. Verify that a check mark is placed in the activation setting located at "Settings > Google Language Translator".
31
+ 3. Verify that the native Wordpress function, wp_footer(), is included in your theme's footer file.
32
+ 4. Verify that "Show Language Box?" setting is enabled at "Settings > Google Language Translator".
33
+ 5. Use your browser's web tools to ensure that CSS styles are not hiding the translation widget.
34
+ 6. Contact support at http://www.wp-studio.net/submit-ticket.
35
+
36
+ Q: What should I do if there are no languages being displayed in the language box?
37
+
38
+ 1. Make sure that the plugin is installed and activated.
39
+ 2. Verify that a check mark is placed in the activation setting located at "Settings > Google Language Translator".
40
+ 3. Verify that Adobe Flash is installed in your web browser. Google uses Flash in order to display their language box.
41
+ 4. Contact support at http://www.wp-studio.net/submit-ticket.
42
+
43
+ Q: Can I exclude certain areas of my website from being translated?
44
+
45
+ A: Yes! Add the "notranslate" class to the HTML element containing your text. For example, the following text will be excluded from translation: <span class="notranslate">Hello World!</span>
46
+
47
+ == Changelog ==
48
+
49
+ 5.0.40
50
+ - Fixed a minor 'undefined index' error in google-language-translator.php
51
+
52
+ 5.0.39
53
+ - Fixed a CSS issue associated with the settings panel changes from the previous update.
54
+
55
+ 5.0.38
56
+ - Fixed a CSS issue associated with the settings panel changes from the previous update. Flags were not aligning properly with align left/right settings.
57
+
58
+ 5.0.37
59
+ - Made some additional adjustments in code for the settings page.
60
+
61
+ 5.0.36
62
+ - Removed undefined variable PHP errors.
63
+
64
+ 5.0.35
65
+ - Updated the plugin to delete an unused option from the database, used in the settings panel.
66
+
67
+ 5.0.34
68
+ - Updated the settings panel to function more logically. Now users choose the languages they want, and can turn on/off flags associated with those langauges.
69
+
70
+ 5.0.33
71
+ - Removed a deprecated jQuery function, and replaced with updated code in the footer_script() function.
72
+
73
+ 5.0.32
74
+ - Fixed the issue with menu translation not working on some mobile devices.
75
+ - Moved element.js script to the footer.
76
+
77
+ 5.0.31
78
+ - Fixed an issue with menu shortcode not displaying the correct flag choice (i.e. for English/Spanish/Portuguese flags).
79
+
80
+ 5.0.30
81
+ - Organized the settings page into sections.
82
+ - Upgraded Wordpress.org plugin banner.
83
+ - Added additional attributes to single language shortcodes. Users now have ability to display flag images, change flag sizes, or show/hide the text label.
84
+ - Changed Chinese (Traditional) language flag to the Flag of Taiwan.
85
+ - Fixed a minor display issue with the Google Analytics setting in Wordpress Dashboard.
86
+
87
+ 5.0.29
88
+ - Fixed CSS display issues with the floating widget.
89
+
90
+ 5.0.28
91
+ - Fixed CSS display issues with the floating widget.
92
+
93
+ 5.0.27
94
+ - Removed toolbar.js and flags.js and combined to existing files (to improve efficiency of page load and http requests).
95
+ - Added new setting to allow or prevent floating widget text to translate.
96
+
97
+ 5.0.26
98
+ - Fixed a small error in adding the setting for Floating Widget text.
99
+
100
+ 5.0.25
101
+ - Added new setting for custom text in the Floating Widget.
102
+ - Removed "notranslate" class from the Floating Widget text to allow for translation.
103
+
104
+ 5.0.24
105
+ - Improved functionality for flags. Users are now returned to original language when the flag is displayed. The Google Toolbar will be hidden once returning back to the original language. The Google Toolbar will appear again when another translation is made.
106
+ - Fixed the issue with flags not functioning with SIMPLE layout.
107
+ - Removed SIMPLE layout option (which was not working properly) for browsers not using English browsers. The coding challenge for implementing this option is difficult and must be postponed until we find a practical solution.
108
+
109
+ 5.0.23
110
+ - Reverted back to an older version of flags.js. We still have some bugs to work out before releasing the updated version. We apologize for the inconvenience.
111
+
112
+ 5.0.22
113
+ - Changed a line of text on the settings page.
114
+ - Removed a line of redundant javascript to reduce unnecessary page load.
115
+ - Fixed an HTML attribute issue displaying in the menu shortcode.
116
+ - Improved functionality for flags. The flag for default language will now be disabled once users click it's flag. Flag will be re-enabled once user makes another translation.
117
+
118
+ 5.0.21
119
+ - Added 6 new languages with their associated flags: Hawaiian, Kurdish, Kyrgyz, Luxembourgish, Pashto, and Shona. You can now use these langauges using the menu shortcode, as well.
120
+ - Added a "Select All / Clear All" feature to the settings page. No more finger cramps!
121
+
122
+ 5.0.20
123
+ - Added Corsican as a new language with its associated flag.
124
+
125
+ 5.0.19
126
+ - Added Frisian as a new language with its associated flag.
127
+
128
+ 5.0.18
129
+ - Added Sindhi as a new language with its associated flag.
130
+
131
+ 5.0.17
132
+ - Added Samoan as a new language with its associated flag.
133
+ - Added mobile-responsive CSS to the GLT settings page.
134
+
135
+ 5.0.16
136
+ - Added Xhosa as a new language with its associated flag.
137
+
138
+ 5.0.15
139
+ - Added Amharic as a new language with its associated flag.
140
+
141
+ 5.0.14
142
+ - Fixed a file naming error in google-language-translator.php. This caused flags not to display - we apologize for the inconvenience.
143
+
144
+ 5.0.13
145
+ - Renamed some of the wp_enqueue_script calls to include more unique file names, thus avoiding conflict with other plugins overriding these files.
146
+ - Corrected some file paths to be more accurate/secure.
147
+ - Removed WP Helpdesk logo from the settings page. We are no longer offering these services officially.
148
+
149
+ 5.0.12
150
+ - Revert malicious changes made in 5.0.10
151
+
152
+ 5.0.11
153
+ - Fixed incorrect link
154
+
155
+ 5.0.10
156
+ - Tested up to 4.6
157
+
158
+ 5.0.09
159
+ - Turned off error reporting. I apologize for the inconvenience.
160
+
161
+ 5.0.08
162
+ - Added a new popup-style layout". You can find this new layout in the settings page located in "Settings > Google Language Translator".
163
+
164
+ 5.0.07
165
+ - Changed the flag for Chinese(Traditional) to the Taiwanese flag. Requested long ago by a few users - thanks for your months of patience!
166
+
167
+ 5.0.06
168
+ - Fixed a XSS Cross Scripting Vulnerability in the plugin, as requested by Wordpress.org. Unnecessary code (during testing) was being posted to the settings page, so the code was removed.
169
+
170
+ 5.0.05
171
+ - Added 3 new options to the settings page: English, Spanish, and Portuguese flag image variations.
172
+ - Fixed an error with the Floating Widget: order of flags was not being honored in certain cases.
173
+
174
+ 5.0.04
175
+ - Corrected the text on the settings page to reflect 91 total flags, instead of 81 flags.
176
+
177
+ 5.0.03
178
+ - Added 10 new languages and associated flags: Chichewa, Kazakh, Malagasy, Malayalam, Myanmar(Burmese), Sesotho, Sinhala, Sundanese, Tajik, and Uzbek.
179
+
180
+ 5.0.02
181
+ - Updated the Tamil flag to use the Indian flag, instead of Tamil Tigers flag.
182
+
183
+ 5.0.01
184
+ - Updated style.css to reflect the syntax error connecting to the Chinese flag.
185
+
186
+ 5.0.0
187
+ - Wordpress security updates added to the settings page [wp_nonce_field()].
188
+ - Removed 3 outside Javascript files - these files are now called upon directly from Wordpress CMS.
189
+ - Unpacked flags.js p,a,c,k,e,r code. Unknowingly, this method of coding violated Wordpress plugin policy.
190
+ - Updated pricing display for GLT Premium. It was displaying $15 previously, but the price had increased since the last update.
191
+
192
+ 4.0.9
193
+ - Replaced: incorrect Catalonian flag image, with the correct image. I apologize for any inconvenience.
194
+ - Fixed: Floating Widget issue - previously it loaded 2 times when shortcode was added, which caused it not to work.
195
+
196
+ 4.0.8
197
+ - Fixed the small syntax issue related to the Google Analytics tracking number - it was another cause of the language box not displaying.
198
+
199
+ 4.0.7
200
+ - Fixed a CSS error in the settings panel display.
201
+ - Fixed the coding issue when "Specific Languages" option is chosen - the shortcode was not displaying the language dropdown.
202
+
203
+ 4.0.6
204
+
205
+ - Removed: "onclick" events from diplaying directly inside HTML. Converted those events to jQuery.
206
+ - Fixed the shortcode that allows adding single languages to Wordpress menus. (New example is shown on settings page.)
207
+ - Consolidated all flag images into image sprites!
208
+ - Re-designed 10 flag images to match the quality of the other flags.
209
+ - Fixed the incorrect "alt" tags associated with flag images. The "alt" tag now displays the language name.
210
+ - Modified text on the settings page - also added some lightbox pop-ups to help explain settings.
211
+ - New updates have also been provided for our Premium version (currently version 4.0.1) located at http://www.wp-studio.net/
212
+
213
+ 4.0.5
214
+
215
+ - Fixed: Display bug when using single language shortcode.
216
+ - Added: New link on the Plugins menu page, which links directly to Google Language Translator settings.
217
+
218
+
219
+ 4.0.4
220
+
221
+ - Added NEW shortcode! Allows placement of single languages into the navigation menu, pages, and posts. See settings panel for usage details.
222
+ - Re-factored code in googlelanguagetranslator.php which reduced code to around 950 lines.
223
+ - Removed the "de-activation" hook, which previously deleted options when plugin de-activated. Added "uninstall" hook instead, so that settings will be preserved only when user deletes the plugin completely.
224
+ - Updated CSS styles for the flags area to prevent themes from overriding layouts.
225
+
226
+ 4.0.3
227
+
228
+ - Adjusted CSS styles for the flag display.
229
+
230
+ 4.0.2
231
+
232
+ - Eliminated all (or most) HTML validation errors. Big improvement!
233
+ - Re-factored more code to increase efficiency.
234
+ - Added de-activation hook to reset all plugin settings when plugin is de-activated. (CSS Overrides and Google Analytics ID setting will remain in place and won't be deleted.)
235
+ - Fixed the issue with flag language checkboxes. Users can remove English flag if so desired. Previously, English flag was alway required to stay checked, which was not most user-friendly.
236
+
237
+ 4.0.1
238
+
239
+ - Fixed PHP errors that were neglected in upgrade to 4.0.
240
+ - Added conditionals to prevent scripts from loading when the floating widget is turned off.
241
+
242
+ 4.0
243
+
244
+ - Added 2 new features: 1) Drag/drop flags to re-arrange their order, and 2) Custom flag sizes (16px to 24px).
245
+ - Re-factored code in google-language-translator.php. Languages are now loaded dynamically and are not hard-coded.
246
+ - GLT Premium is now released: Updates include multiple flags for English, Spanish, and Portuguese languages; customized URLs with 'lang' attribute; drag/drop flags to re-arrnage their order
247
+
248
+ 3.0.9
249
+
250
+ - Added a title field to the Google Language Translator widget.
251
+ - Removed "unexpected text characters" error upon activation (due to error in activation hook).
252
+
253
+ 3.0.8
254
+
255
+ - Added 9 new languages into the plugin (Hausa, Igbo, Maori, Mongolian, Nepali, Punjabi, Somali, Yoruba, Zulu).
256
+ - Corrected an "undefined variable" error that was being generated in Vertical and Horizontal layouts.
257
+ - Re-structured coding once again into an Object-Oriented approach.
258
+ - Moved all functions of the base class into 'googlelanguagetranslator.php' and the widget into 'widget.php'.
259
+ - Moved all javascript files into it's own JS folder.
260
+ - Fixed an display issue with "Edit Translations" - they were being hidden when "No branding" option was chosen.
261
+ - Corrected various "comma" errors in the string that outputs the script for loading the translator.
262
+ - Changed Changelog in readme.txt to show most recent changes first, instead of last.
263
+
264
+ 3.0.7
265
+
266
+ - Removed an unnecessary CSS file, left over from development. Sorry for any inconvenience if you received display errors.
267
+
268
+ 3.0.6
269
+
270
+ - Corrected a small display error in displaying the floating widget correctly.
271
+
272
+ 3.0.5
273
+
274
+ - Added new Floating Widget (see settings page). The Floating Widget is simply another way for allowing website visitors to translate languages. The functionality is built-in with the existing flag preferences, and can be turned on or off at the administrator's preference. The floating widget can also function in full with both the language box and/or flags showing OR hiding, so the administrator has full control of how it displays. The floating widget is placed at bottom right of the website in the free version, but can be placed in other locations by changing CSS styles associated with the box. The premium version will allow more options as to changing the Floating Widget location.
275
+ - Fixed the issue with Dashboard styles loading on the wrong pages. This was causing some annoying display issues on the Wordpress Dashboard.
276
+
277
+ 3.0.4
278
+
279
+ - Re-factored/re-arranged more code in google languagetransltor.php by placing them into separate files.
280
+ - Fixed the issue of Custom CSS box not displaying it's styles to the website. This was only missed in this last update, due to re-arrangement of the files. Sorry for any inconvenience.
281
+ - Removed style2.php file, which is unnecessary and was being used in testing.
282
+
283
+ 3.0.3
284
+
285
+ - Re-factored/re-arranged some of the code in googlelanguagetranslator.php by placing them into separate files.
286
+ - Fixed a minor coding issue in glt_widget.php - this was generating an error in Wordpress when debugging.
287
+ - Moved all CSS code into a single file. The result is nice, clean inline CSS code that is now called only once.
288
+ - Fixed some additional CSS display issues.
289
+
290
+ 3.0.2
291
+
292
+ - Adjusted additional minor invalid HTML issues on the settings page, and also in the front-end plugin display.
293
+
294
+ 3.0.1
295
+
296
+ - Changed the url request to Google to allow both unsecured and secured page translations. Previously, some users experienced errors when trying to use the translator on "https://" (secured) pages.
297
+ - Adjusted some minor spacing issues in the settings page HTML (caused some annoying red HTML errors when using "View Source" in right-click menu).
298
+ - Removed old CSS styles that were added in the previous 3.0 update - the styles were added when Google servers were being updated, and were producing major translation dislay issues until their update was complete. Now the styles I added are no longer needed.
299
+
300
+ 3.0
301
+
302
+ - Correct a small CSS error that affected the showing/hiding of the Google toolbar.
303
+
304
+ 2.9
305
+
306
+ ***IMPORTANT: Google's most recent server update is producing display issues for website translation tool. There are major display issues with the translation toolbar and also the translations editing interface. Version 2.9 temporarily hides the edit translation functionality until Google decides to fix this issue, although you can still edit translations directly through your Google account at translate.google.com. Please direct any support requests through Wordpress.org and we will be happy to assist you.
307
+
308
+ - Fixed Google Translation toolbar display issue
309
+ - Fixed the Edit Translation interface by hiding it temporarily until Google fixes this
310
+ - Removed some unneeded styles from the style sheet.
311
+ - Fixed some CSS issues for the Google Branding display, which was affected by Google's most recent update
312
+
313
+ 2.8
314
+
315
+ - Added an option to allow users to manage their own translations directly through their Google Translate account (free). When activated, users can hover over the text of their website, and edit the translations from the webpage directly. Google will remember these translations, and then serve them to users once the edits are made. Users must install the Google Translate Customization meta tag provided through Google Translate here: translate.google.com/manager/website/settings. To obtain this meta tag, users need to configure the Google Translate tool directly from this website (although they will not use this because the plugin provides it), then the user can obtain the meta tag on the "Get Code" screen, which is displayed after configuring the Google Translate tool on this webpage.
316
+ - Added an option to allow users to turn on/off Google's multilanguagePage option, that when activated, the original website content will be a forced translation, instead of original content (but only after a translation is made.)
317
+ - Added more flexible styles to the settings page, so that left and right panels display nicely to the user.
318
+
319
+ 2.7
320
+
321
+ - Added Google Analytics tracking capability to the plugin.
322
+
323
+ - Added a "CSS Styles" box in the settings panel.
324
+
325
+ - Changed the Catalonian flag to its correct flag image.
326
+
327
+ - Fixed coding issues that previously updated options incorrectly, which is why many users experienced display issues. All options are now initialized upon plugin activation, which should fix this issue permanently.
328
+
329
+ - Fixed a glitch in our usage of the translate API. Previously, when the user clicked the default language, it would toggle back and forth between the default language and "Afrikaans" language. Now, users will see the correct language displayed at all times, no matter how many times it is clicked.
330
+
331
+ 2.6
332
+
333
+ - Added defaults to all options to ensure there are no more issues with the translator displaying upon installation. Again, sorry for any inconvenience.
334
+
335
+ 2.5
336
+
337
+ - Eliminated an internal Wordpress error being generated from a coding mistake.
338
+
339
+ - Added a default option for the Translator alingment. Previously, this was causing the plugin to disapppear.
340
+
341
+ 2.4
342
+
343
+ - Found a couple of small display errors in the settings page after uploading version 2.3. Sorry for any inconvenience!
344
+
345
+ 2.3
346
+
347
+ - Added a "Preview" area on the settings page that allows you to see your settings in action.
348
+
349
+ - Added custom flag support for all languages (custom flags available ONLY when selecting the "ALL Languages" setting.
350
+
351
+ - Added an option that allows left/right alignment of the translation tool.
352
+
353
+ - Added the "Google Language Translator" widget.
354
+
355
+ - Updated googlelanguagetranslator.php to properly register setting in the admin settings panel.
356
+
357
+ 2.2
358
+
359
+ - Added language "Portuguese" and "German" to the Original Language drop-down option on the settings page.
360
+
361
+ - Changed flag image for the English language (changed United States flag to the United Kingdom flag).
362
+
363
+ - Added link in the settings panel that points to Google's Attribution Policy.
364
+
365
+ 2.1
366
+
367
+ - Added language "Dutch" to the Original Language drop-down option on the settings page.
368
+
369
+ - Added a new CSS class that more accurately hides the "Powered by" text when hiding Google's branding. In previous version, the "Powered by" text was actually disguised by setting it's color to "transparent", but now we have set it's font-size to 0px instead.
370
+
371
+ 2.0 Corrected some immediate errors in the 1.9 update.
372
+
373
+ 1.9
374
+
375
+ - Added 7 flag image choices that, when clicked by website visitors, will change the language displayed, both on the website, AND in the drop-down box (flag language choices are limited to those provided in this plugin).
376
+
377
+ - Added 6 additional languages to the translator, as provided in Google's most recent updates ( new languages include Bosnian, Cebuano, Khmer, Marathi, Hmong, Javanese ).
378
+
379
+ - Corrected a minor technical issue where the Czech option (on the backend) was incorrectly displaying the Croatian language on the front end.
380
+
381
+ - Added jQuery functionality to the settings panel to improve the user experience.
382
+
383
+ - Added an option for users to display/hide the flag images.
384
+
385
+ - Added an option for users to display/hide the translate box when flags are displayed.
386
+
387
+ - Removed the settings.css file - I found a better way of displaying the options without CSS.
388
+
389
+ 1.8 Modified google-language-translator.php to display the correct output to the browser when horizontal layout is selected. Previously, it was not displaying at all.
390
+
391
+ 1.7 Modified google-language-translator.php so that jQuery and CSS styles were enqueued properly onto the settings page only. Previously, jQuery functionality and CSS styles were being added to all pages of the Wordpresss Dashboard, which was causing functionality and display issues for some users.
392
+
393
+ 1.6 Added "Specific Language" support to the plugin settings, which allows the user to choose specific languages that are displayed to website visitors.
394
+
395
+ 1.5 Added "Original Language" support to the plugin settings, which allows the user to choose the original language of their website, which ultimately removes the original language as a choice in the language drop-down presented to website visitors.
396
+
397
+ 1.4 Corrected display problems associated with CSS styles not being placed correctly in wp_head.
398
+
399
+ 1.3 HTML display problem in the sidebar area now fixed. Previously, inserting the [google-translator] plugin into a text widget caused it to display above the widget, instead of inside of it.
400
+
401
+ 1.2 Shortcode support is now available for adding [google-translator] to text widgets. I apologize for any inconvenience this may have caused.
402
+
403
+ 1.1 The shortcode supplied on the settings page was updated to display '[google-translator]'.
404
+
405
+ == Screenshots ==
406
+
407
+ 1. Settings include: inline or vertical layout, hide/show Google toolbar, display specific languages, and show/hide Google branding. Add the shortcode to pages, posts, and widgets.