Google Language Translator - Version 5.0.04

Version Description

Download this release

Release Info

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

Code changes from version 5.0.03 to 5.0.04

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