Google Language Translator - Version 5.0.13

Version Description

Download this release

Release Info

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

Code changes from version 5.0.12 to 5.0.13

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