Version Description
Download this release
Release Info
Developer | rm2773 |
Plugin | Google Language Translator |
Version | 5.0.34 |
Comparing to | |
See all releases |
Code changes from version 5.0.33 to 5.0.34
- css/style.css +1 -0
- google-language-translator.php +384 -407
- js/admin.js +1 -35
- readme.txt +5 -2
css/style.css
CHANGED
@@ -175,6 +175,7 @@ select.goog-te-combo {
|
|
175 |
|
176 |
#flags a,
|
177 |
.tool-container .tool-items a {
|
|
|
178 |
cursor:pointer;
|
179 |
}
|
180 |
|
175 |
|
176 |
#flags a,
|
177 |
.tool-container .tool-items a {
|
178 |
+
display:inline-block;
|
179 |
cursor:pointer;
|
180 |
}
|
181 |
|
google-language-translator.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Google Language Translator
|
4 |
Plugin URI: http://www.studio88design.com/plugins/google-language-translator
|
5 |
-
Version: 5.0.
|
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/
|
@@ -16,116 +16,120 @@ include( plugin_dir_path( __FILE__ ) . 'widget.php');
|
|
16 |
|
17 |
class google_language_translator {
|
18 |
|
19 |
-
public $languages_array
|
20 |
-
'af' => 'Afrikaans',
|
21 |
-
'sq' => 'Albanian',
|
22 |
-
'am' => 'Amharic',
|
23 |
-
'ar' => 'Arabic',
|
24 |
-
'hy' => 'Armenian',
|
25 |
-
'az' => 'Azerbaijani',
|
26 |
-
'eu' => 'Basque',
|
27 |
-
'be' => 'Belarusian',
|
28 |
-
'bn' => 'Bengali',
|
29 |
-
'bs' => 'Bosnian',
|
30 |
-
'bg' => 'Bulgarian',
|
31 |
-
'ca' => 'Catalan',
|
32 |
-
'ceb' => 'Cebuano',
|
33 |
-
'ny' => 'Chichewa',
|
34 |
-
'zh-CN' => 'Chinese (Simplified)',
|
35 |
-
'zh-TW' => 'Chinese (Traditional)',
|
36 |
-
'co' => 'Corsican',
|
37 |
-
'hr' => 'Croatian',
|
38 |
-
'cs' => 'Czech',
|
39 |
-
'da' => 'Danish',
|
40 |
-
'nl' => 'Dutch',
|
41 |
-
'en' => 'English',
|
42 |
-
'eo' => 'Esperanto',
|
43 |
-
'et' => 'Estonian',
|
44 |
-
'tl' => 'Filipino',
|
45 |
-
'fi' => 'Finnish',
|
46 |
-
'fr' => 'French',
|
47 |
-
'fy' => 'Frisian',
|
48 |
-
'gl' => 'Galician',
|
49 |
-
'ka' => 'Georgian',
|
50 |
-
'de' => 'German',
|
51 |
-
'el' => 'Greek',
|
52 |
-
'gu' => 'Gujarati',
|
53 |
-
'ht' => 'Haitian',
|
54 |
-
'ha' => 'Hausa',
|
55 |
-
'haw' => 'Hawaiian',
|
56 |
-
'iw' => 'Hebrew',
|
57 |
-
'hi' => 'Hindi',
|
58 |
-
'hmn' => 'Hmong',
|
59 |
-
'hu' => 'Hungarian',
|
60 |
-
'is' => 'Icelandic',
|
61 |
-
'ig' => 'Igbo',
|
62 |
-
'id' => 'Indonesian',
|
63 |
-
'ga' => 'Irish',
|
64 |
-
'it' => 'Italian',
|
65 |
-
'ja' => 'Japanese',
|
66 |
-
'jw' => 'Javanese',
|
67 |
-
'kn' => 'Kannada',
|
68 |
-
'kk' => 'Kazakh',
|
69 |
-
'km' => 'Khmer',
|
70 |
-
'ko' => 'Korean',
|
71 |
-
'ku' => 'Kurdish',
|
72 |
-
'ky' => 'Kyrgyz',
|
73 |
-
'lo' => 'Lao',
|
74 |
-
'la' => 'Latin',
|
75 |
-
'lv' => 'Latvian',
|
76 |
-
'lt' => 'Lithuanian',
|
77 |
-
'lb' => 'Luxembourgish',
|
78 |
-
'mk' => 'Macedonian',
|
79 |
-
'mg' => 'Malagasy',
|
80 |
-
'ml' => 'Malayalam',
|
81 |
-
'ms' => 'Malay',
|
82 |
-
'mt' => 'Maltese',
|
83 |
-
'mi' => 'Maori',
|
84 |
-
'mr' => 'Marathi',
|
85 |
-
'mn' => 'Mongolian',
|
86 |
-
'my' => 'Myanmar (Burmese)',
|
87 |
-
'ne' => 'Nepali',
|
88 |
-
'no' => 'Norwegian',
|
89 |
-
'ps' => 'Pashto',
|
90 |
-
'fa' => 'Persian',
|
91 |
-
'pl' => 'Polish',
|
92 |
-
'pt' => 'Portuguese',
|
93 |
-
'pa' => 'Punjabi',
|
94 |
-
'ro' => 'Romanian',
|
95 |
-
'ru' => 'Russian',
|
96 |
-
'sr' => 'Serbian',
|
97 |
-
'sn' => 'Shona',
|
98 |
-
'st' => 'Sesotho',
|
99 |
-
'sd' => 'Sindhi',
|
100 |
-
'si' => 'Sinhala',
|
101 |
-
'sk' => 'Slovak',
|
102 |
-
'sl' => 'Slovenian',
|
103 |
-
'sm' => 'Samoan',
|
104 |
-
'gd' => 'Scots Gaelic',
|
105 |
-
'so' => 'Somali',
|
106 |
-
'es' => 'Spanish',
|
107 |
-
'su' => 'Sundanese',
|
108 |
-
'sw' => 'Swahili',
|
109 |
-
'sv' => 'Swedish',
|
110 |
-
'tg' => 'Tajik',
|
111 |
-
'ta' => 'Tamil',
|
112 |
-
'te' => 'Telugu',
|
113 |
-
'th' => 'Thai',
|
114 |
-
'tr' => 'Turkish',
|
115 |
-
'uk' => 'Ukrainian',
|
116 |
-
'ur' => 'Urdu',
|
117 |
-
'uz' => 'Uzbek',
|
118 |
-
'vi' => 'Vietnamese',
|
119 |
-
'cy' => 'Welsh',
|
120 |
-
'xh' => 'Xhosa',
|
121 |
-
'yi' => 'Yiddish',
|
122 |
-
'yo' => 'Yoruba',
|
123 |
-
'zu' => 'Zulu',
|
124 |
-
);
|
125 |
|
126 |
public function __construct() {
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
add_action( 'admin_menu', array( &$this, 'add_my_admin_menus'));
|
130 |
add_action('admin_init',array(&$this, 'initialize_settings'));
|
131 |
add_action('wp_head',array(&$this, 'load_css'));
|
@@ -147,7 +151,6 @@ class google_language_translator {
|
|
147 |
add_option('googlelanguagetranslator_language_option','all');
|
148 |
add_option('googlelanguagetranslator_flags','show_flags');
|
149 |
add_option('language_display_settings',array ('en' => 1));
|
150 |
-
add_option('flag_display_settings',array ('flag-en' => 1));
|
151 |
add_option('googlelanguagetranslator_translatebox','yes');
|
152 |
add_option('googlelanguagetranslator_display','Vertical');
|
153 |
add_option('googlelanguagetranslator_toolbar','Yes');
|
@@ -169,27 +172,7 @@ class google_language_translator {
|
|
169 |
}
|
170 |
|
171 |
public function glt_deactivate() {
|
172 |
-
delete_option('
|
173 |
-
delete_option('googlelanguagetranslator_language','en');
|
174 |
-
delete_option('googlelanguagetranslator_language_option','all');
|
175 |
-
delete_option('googlelanguagetranslator_flags','show_flags');
|
176 |
-
delete_option('language_display_settings',array ('en' => 1));
|
177 |
-
delete_option('flag_display_settings',array ('flag-en' => 1));
|
178 |
-
delete_option('googlelanguagetranslator_translatebox','yes');
|
179 |
-
delete_option('googlelanguagetranslator_display','Vertical');
|
180 |
-
delete_option('googlelanguagetranslator_toolbar','Yes');
|
181 |
-
delete_option('googlelanguagetranslator_showbranding','Yes');
|
182 |
-
delete_option('googlelanguagetranslator_flags_alignment','flags_left');
|
183 |
-
delete_option('googlelanguagetranslator_analytics',1);
|
184 |
-
delete_option('googlelanguagetranslator_analytics_id','');
|
185 |
-
delete_option('googlelanguagetranslator_css','');
|
186 |
-
delete_option('googlelanguagetranslator_multilanguage',0);
|
187 |
-
delete_option('googlelanguagetranslator_floating_widget','yes');
|
188 |
-
delete_option('googlelanguagetranslator_flag_size','18');
|
189 |
-
delete_option('googlelanguagetranslator_flags_order','');
|
190 |
-
delete_option('googlelanguagetranslator_english_flag_choice','');
|
191 |
-
delete_option('googlelanguagetranslator_spanish_flag_choice','');
|
192 |
-
delete_option('googlelanguagetranslator_portuguese_flag_choice','');
|
193 |
}
|
194 |
|
195 |
public function glt_settings_link ( $links ) {
|
@@ -339,7 +322,7 @@ class google_language_translator {
|
|
339 |
$spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
|
340 |
$portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
|
341 |
$get_language_option = get_option('googlelanguagetranslator_language_option');
|
342 |
-
$
|
343 |
$get_flag_choices_count = count($get_flag_choices);
|
344 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
345 |
$floating_widget_text = get_option ('googlelanguagetranslator_floating_widget_text');
|
@@ -352,77 +335,88 @@ class google_language_translator {
|
|
352 |
<?php
|
353 |
|
354 |
if( $is_active == 1) {
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
if ($floating_widget=='yes' && $get_language_option != 'specific') {
|
359 |
-
$str.='<div id="glt-translate-trigger"><span'.($floating_widget_text_translation_allowed != 1 ? ' class="notranslate"' : ' class="translate"').'>'.(empty($floating_widget_text) ? 'Translate »' : $floating_widget_text).'</span></div>';
|
360 |
$str.='<div id="glt-toolbar"></div>';
|
361 |
} //endif $floating_widget
|
362 |
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
}
|
378 |
-
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
379 |
$language_name_flag = 'united-states';
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
$str.='</ul>';
|
424 |
$str.='</div>';
|
425 |
-
}
|
426 |
}
|
427 |
|
428 |
$language_choices = $this->googlelanguagetranslator_included_languages();
|
@@ -445,12 +439,9 @@ class google_language_translator {
|
|
445 |
}
|
446 |
|
447 |
public function googlelanguagetranslator_vertical() {
|
448 |
-
|
449 |
global $shortcode_started;
|
450 |
-
|
451 |
-
$i = 0;
|
452 |
$shortcode_started = 'true';
|
453 |
-
$get_flag_choices = get_option ('flag_display_settings');
|
454 |
$new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
|
455 |
$new_languages_array = explode(",",$new_languages_array_string);
|
456 |
$new_languages_array_codes = array_values($new_languages_array);
|
@@ -459,81 +450,102 @@ class google_language_translator {
|
|
459 |
$get_language_choices = get_option ('language_display_settings');
|
460 |
$flag_width = get_option('googlelanguagetranslator_flag_size');
|
461 |
$default_language_code = get_option('googlelanguagetranslator_language');
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
$is_active = get_option ( 'googlelanguagetranslator_active' );
|
466 |
$get_language_option = get_option('googlelanguagetranslator_language_option');
|
467 |
$language_choices = $this->googlelanguagetranslator_included_languages();
|
468 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
469 |
$str = '';
|
470 |
|
471 |
-
if( $is_active == 1)
|
|
|
|
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
if ($flag_choice_key == '1') {
|
484 |
-
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
485 |
-
$language_name_flag = 'canada';
|
486 |
-
}
|
487 |
-
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
488 |
-
$language_name_flag = 'united-states';
|
489 |
-
}
|
490 |
-
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
491 |
-
$language_name_flag = 'mexico';
|
492 |
-
}
|
493 |
-
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
494 |
-
$language_name_flag = 'brazil';
|
495 |
-
}
|
496 |
-
if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
|
497 |
-
$str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
|
498 |
-
}
|
499 |
-
} //$key
|
500 |
-
}//foreach
|
501 |
-
} else {
|
502 |
-
foreach ($new_languages_array_codes as $value) {
|
503 |
-
$language_name = $value;
|
504 |
-
$language_code = array_search ($language_name,$this->languages_array);
|
505 |
-
$language_name_flag = $language_name;
|
506 |
-
if ($flag_choice_key == '1') {
|
507 |
-
if (in_array($language_name,$this->languages_array)) {
|
508 |
-
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
509 |
$language_name_flag = 'canada';
|
510 |
}
|
511 |
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
512 |
-
|
513 |
}
|
514 |
-
|
515 |
$language_name_flag = 'mexico';
|
516 |
}
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
$str.='</ul>';
|
528 |
$str.='</div>';
|
529 |
$str.='<div id="google_language_translator"></div>';
|
530 |
-
|
531 |
-
|
532 |
} // End glt_vertical
|
533 |
|
534 |
public function googlelanguagetranslator_horizontal(){
|
535 |
$shortcode_started = 'true';
|
536 |
-
$get_flag_choices = get_option ('flag_display_settings');
|
537 |
$new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
|
538 |
$new_languages_array = explode(",",$new_languages_array_string);
|
539 |
$new_languages_array_codes = array_values($new_languages_array);
|
@@ -551,73 +563,96 @@ class google_language_translator {
|
|
551 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
552 |
$str = '';
|
553 |
|
554 |
-
if( $is_active == 1)
|
555 |
-
|
556 |
-
|
557 |
-
$str.='<ul id="sortable" class="ui-sortable" style="float:left">';
|
558 |
-
|
559 |
-
if ((empty($new_languages_array_string)) || ($new_languages_array_count != $get_flag_choices_count)) {
|
560 |
-
foreach ($this->languages_array as $key=>$value) {
|
561 |
-
$language_code = $key;
|
562 |
-
$language_name = $value;
|
563 |
-
$language_name_flag = $language_name;
|
564 |
|
565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
$language_name_flag = 'united-states';
|
571 |
-
|
572 |
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
573 |
-
|
574 |
-
|
575 |
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
576 |
-
$language_name_flag = 'brazil';
|
577 |
-
}
|
578 |
-
if ( isset ( $get_flag_choices['flag-'.$language_code.''] ) ) {
|
579 |
-
$str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
|
580 |
-
} //endif
|
581 |
-
} //$key
|
582 |
-
} //foreach
|
583 |
-
} else {
|
584 |
-
foreach ($new_languages_array_codes as $value) {
|
585 |
-
$language_name = $value;
|
586 |
-
$language_code = array_search ($language_name,$this->languages_array);
|
587 |
-
$language_name_flag = $language_name;
|
588 |
-
if ($flag_choice_key == '1') {
|
589 |
-
if (in_array($language_name,$this->languages_array)) {
|
590 |
-
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
591 |
-
$language_name_flag = 'canada';
|
592 |
-
}
|
593 |
-
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
594 |
-
$language_name_flag = 'united-states';
|
595 |
-
}
|
596 |
-
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
597 |
-
$language_name_flag = 'mexico';
|
598 |
-
}
|
599 |
-
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
600 |
$language_name_flag = 'brazil';
|
601 |
}
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
$str.='</ul>';
|
610 |
$str.='</div>';
|
611 |
$str.='<div id="google_language_translator"></div>';
|
612 |
-
|
613 |
-
|
614 |
} // End glt_horizontal
|
615 |
|
616 |
public function initialize_settings() {
|
617 |
add_settings_section('glt_settings','Settings','','google_language_translator');
|
618 |
|
619 |
$settings_name_array = array (
|
620 |
-
'googlelanguagetranslator_active','googlelanguagetranslator_language','googlelanguagetranslator_language_option','language_display_settings','googlelanguagetranslator_flags','
|
621 |
);
|
622 |
|
623 |
foreach ($settings_name_array as $setting) {
|
@@ -695,7 +730,12 @@ class google_language_translator {
|
|
695 |
update_option( $option_name, $new_value );
|
696 |
}
|
697 |
|
698 |
-
$get_language_choices = get_option (''.$option_name.'');
|
|
|
|
|
|
|
|
|
|
|
699 |
|
700 |
foreach ($this->languages_array as $key => $value) {
|
701 |
$language_code = $key;
|
@@ -723,61 +763,23 @@ class google_language_translator {
|
|
723 |
<?php
|
724 |
}
|
725 |
|
726 |
-
public function googlelanguagetranslator_flags_cb() {
|
727 |
-
|
728 |
-
|
729 |
-
$new_value =
|
730 |
|
731 |
if ( get_option( $option_name ) === false ) {
|
732 |
|
733 |
// The option does not exist, so we update it.
|
734 |
update_option( $option_name, $new_value );
|
735 |
-
}
|
736 |
-
|
737 |
-
$options = get_option (''.$option_name.'');
|
738 |
-
|
739 |
-
<input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="show_flags" <?php if($options=='show_flags'){echo "checked";}?>/> Yes, show flag images<br/>
|
740 |
-
<input type="radio" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="hide_flags" <?php if($options=='hide_flags'){echo "checked";}?>/> No, hide flag images
|
741 |
-
<?php
|
742 |
-
}
|
743 |
-
|
744 |
-
public function flag_display_settings_cb() {
|
745 |
-
$default_language_code = get_option('googlelanguagetranslator_language');
|
746 |
-
$option_name = 'flag_display_settings';
|
747 |
-
$new_value = array('flag-'.$default_language_code.'' => 1);
|
748 |
-
|
749 |
-
if ( get_option( $option_name ) == false ) {
|
750 |
-
// The option does not exist, so we update it.
|
751 |
-
update_option( $option_name, $new_value );
|
752 |
-
}
|
753 |
-
|
754 |
-
$get_flag_choices = get_option (''.$option_name.'');
|
755 |
-
|
756 |
-
foreach ($this->languages_array as $key => $value) {
|
757 |
-
$language_code = $key;
|
758 |
-
$language_name = $value;
|
759 |
-
$language_code_array[] = $key;
|
760 |
-
|
761 |
-
if (!isset($get_flag_choices['flag-'.$language_code.''])) {
|
762 |
-
$get_flag_choices['flag-'.$language_code.''] = 0;
|
763 |
-
}
|
764 |
-
|
765 |
-
$items[] = $get_flag_choices['flag-'.$language_code.''];
|
766 |
-
$language_codes = $language_code_array;
|
767 |
-
$item_count = count($items);
|
768 |
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
<?php
|
774 |
-
if ($item_count == 26 || $item_count == 52 || $item_count == 78 || $item_count == 104) { ?>
|
775 |
-
</div>
|
776 |
-
<?php }
|
777 |
-
} ?>
|
778 |
-
<div class="clear"></div>
|
779 |
-
<?php
|
780 |
-
}
|
781 |
|
782 |
public function googlelanguagetranslator_floating_widget_cb() {
|
783 |
|
@@ -1143,43 +1145,19 @@ class google_language_translator {
|
|
1143 |
<h3 class="notranslate">Layout Settings</h3>
|
1144 |
<table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
|
1145 |
<tr class="notranslate">
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
</td>
|
1160 |
-
</tr>
|
1161 |
-
|
1162 |
-
<tr class="notranslate">
|
1163 |
-
<td class="choose_flags_intro">Show flag images?<br/>(Display up to 104 flags above the translator)</td>
|
1164 |
-
<td class="choose_flags_intro"><?php $this->googlelanguagetranslator_flags_cb(); ?></td>
|
1165 |
-
</tr>
|
1166 |
-
|
1167 |
-
<tr class="notranslate choose_flags">
|
1168 |
-
<td colspan="2" class="choose_flags">Choose the flags you want to display:</td>
|
1169 |
-
</tr>
|
1170 |
-
|
1171 |
-
<tr class="notranslate">
|
1172 |
-
<td colspan="2" class="choose_flags">
|
1173 |
-
<script>
|
1174 |
-
jQuery(document).ready(function($) { $('.select-all-flags').on('click',function(e) { e.preventDefault(); $('.choose_flags').find('input:checkbox').prop('checked', true); }); $('.clear-all-flags').on('click',function(e) { e.preventDefault();
|
1175 |
-
$('.choose_flags').find('input:checkbox').prop('checked', false); }); });
|
1176 |
-
</script>
|
1177 |
-
<div class="glt-controls choose_flags notranslate">
|
1178 |
-
<a class="select-all-flags" href="#">Select All</a> <a class="clear-all-flags" href="#">Clear All</a>
|
1179 |
-
</div>
|
1180 |
-
<?php $this->flag_display_settings_cb(); ?>
|
1181 |
-
</td>
|
1182 |
-
</tr>
|
1183 |
|
1184 |
<tr class="notranslate">
|
1185 |
<td>Show or hide the langauge switcher?</td>
|
@@ -1361,24 +1339,23 @@ $('.choose_flags').find('input:checkbox').prop('checked', false); }); });
|
|
1361 |
|
1362 |
<div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
|
1363 |
<div class="postbox">
|
1364 |
-
<h3>GLT Premium 5.0.
|
1365 |
<div class="inside">
|
1366 |
<a class="wp-studio-logo" href="http://www.wp-studio.net/" target="_blank"><img style="background:#444; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px; width:177px;" src="<?php echo plugins_url( 'images/logo.png' , __FILE__ ); ?>"></a><br />
|
1367 |
<ul id="features" style="margin-left:15px">
|
1368 |
-
<li style="list-style:square outside">Duplicate pages/posts into your chosen languages (for editing)</li>
|
1369 |
-
<li style="list-style:square outside">6 Floating Widget positions</li>
|
1370 |
<li style="list-style:square outside">104 Languages with flags</li>
|
|
|
|
|
1371 |
<li style="list-style:square outside">Exclude specific areas from translation</li>
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
</ul>
|
1382 |
</div> <!-- .inside -->
|
1383 |
</div> <!-- .postbox -->
|
1384 |
</div> <!-- .metabox-holder -->
|
2 |
/*
|
3 |
Plugin Name: Google Language Translator
|
4 |
Plugin URI: http://www.studio88design.com/plugins/google-language-translator
|
5 |
+
Version: 5.0.34
|
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/
|
16 |
|
17 |
class google_language_translator {
|
18 |
|
19 |
+
public $languages_array;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
public function __construct() {
|
22 |
+
|
23 |
+
$this->languages_array = array (
|
24 |
+
'af' => 'Afrikaans',
|
25 |
+
'sq' => 'Albanian',
|
26 |
+
'am' => 'Amharic',
|
27 |
+
'ar' => 'Arabic',
|
28 |
+
'hy' => 'Armenian',
|
29 |
+
'az' => 'Azerbaijani',
|
30 |
+
'eu' => 'Basque',
|
31 |
+
'be' => 'Belarusian',
|
32 |
+
'bn' => 'Bengali',
|
33 |
+
'bs' => 'Bosnian',
|
34 |
+
'bg' => 'Bulgarian',
|
35 |
+
'ca' => 'Catalan',
|
36 |
+
'ceb' => 'Cebuano',
|
37 |
+
'ny' => 'Chichewa',
|
38 |
+
'zh-CN' => 'Chinese (Simplified)',
|
39 |
+
'zh-TW' => 'Chinese (Traditional)',
|
40 |
+
'co' => 'Corsican',
|
41 |
+
'hr' => 'Croatian',
|
42 |
+
'cs' => 'Czech',
|
43 |
+
'da' => 'Danish',
|
44 |
+
'nl' => 'Dutch',
|
45 |
+
'en' => 'English',
|
46 |
+
'eo' => 'Esperanto',
|
47 |
+
'et' => 'Estonian',
|
48 |
+
'tl' => 'Filipino',
|
49 |
+
'fi' => 'Finnish',
|
50 |
+
'fr' => 'French',
|
51 |
+
'fy' => 'Frisian',
|
52 |
+
'gl' => 'Galician',
|
53 |
+
'ka' => 'Georgian',
|
54 |
+
'de' => 'German',
|
55 |
+
'el' => 'Greek',
|
56 |
+
'gu' => 'Gujarati',
|
57 |
+
'ht' => 'Haitian',
|
58 |
+
'ha' => 'Hausa',
|
59 |
+
'haw' => 'Hawaiian',
|
60 |
+
'iw' => 'Hebrew',
|
61 |
+
'hi' => 'Hindi',
|
62 |
+
'hmn' => 'Hmong',
|
63 |
+
'hu' => 'Hungarian',
|
64 |
+
'is' => 'Icelandic',
|
65 |
+
'ig' => 'Igbo',
|
66 |
+
'id' => 'Indonesian',
|
67 |
+
'ga' => 'Irish',
|
68 |
+
'it' => 'Italian',
|
69 |
+
'ja' => 'Japanese',
|
70 |
+
'jw' => 'Javanese',
|
71 |
+
'kn' => 'Kannada',
|
72 |
+
'kk' => 'Kazakh',
|
73 |
+
'km' => 'Khmer',
|
74 |
+
'ko' => 'Korean',
|
75 |
+
'ku' => 'Kurdish',
|
76 |
+
'ky' => 'Kyrgyz',
|
77 |
+
'lo' => 'Lao',
|
78 |
+
'la' => 'Latin',
|
79 |
+
'lv' => 'Latvian',
|
80 |
+
'lt' => 'Lithuanian',
|
81 |
+
'lb' => 'Luxembourgish',
|
82 |
+
'mk' => 'Macedonian',
|
83 |
+
'mg' => 'Malagasy',
|
84 |
+
'ml' => 'Malayalam',
|
85 |
+
'ms' => 'Malay',
|
86 |
+
'mt' => 'Maltese',
|
87 |
+
'mi' => 'Maori',
|
88 |
+
'mr' => 'Marathi',
|
89 |
+
'mn' => 'Mongolian',
|
90 |
+
'my' => 'Myanmar (Burmese)',
|
91 |
+
'ne' => 'Nepali',
|
92 |
+
'no' => 'Norwegian',
|
93 |
+
'ps' => 'Pashto',
|
94 |
+
'fa' => 'Persian',
|
95 |
+
'pl' => 'Polish',
|
96 |
+
'pt' => 'Portuguese',
|
97 |
+
'pa' => 'Punjabi',
|
98 |
+
'ro' => 'Romanian',
|
99 |
+
'ru' => 'Russian',
|
100 |
+
'sr' => 'Serbian',
|
101 |
+
'sn' => 'Shona',
|
102 |
+
'st' => 'Sesotho',
|
103 |
+
'sd' => 'Sindhi',
|
104 |
+
'si' => 'Sinhala',
|
105 |
+
'sk' => 'Slovak',
|
106 |
+
'sl' => 'Slovenian',
|
107 |
+
'sm' => 'Samoan',
|
108 |
+
'gd' => 'Scots Gaelic',
|
109 |
+
'so' => 'Somali',
|
110 |
+
'es' => 'Spanish',
|
111 |
+
'su' => 'Sundanese',
|
112 |
+
'sw' => 'Swahili',
|
113 |
+
'sv' => 'Swedish',
|
114 |
+
'tg' => 'Tajik',
|
115 |
+
'ta' => 'Tamil',
|
116 |
+
'te' => 'Telugu',
|
117 |
+
'th' => 'Thai',
|
118 |
+
'tr' => 'Turkish',
|
119 |
+
'uk' => 'Ukrainian',
|
120 |
+
'ur' => 'Urdu',
|
121 |
+
'uz' => 'Uzbek',
|
122 |
+
'vi' => 'Vietnamese',
|
123 |
+
'cy' => 'Welsh',
|
124 |
+
'xh' => 'Xhosa',
|
125 |
+
'yi' => 'Yiddish',
|
126 |
+
'yo' => 'Yoruba',
|
127 |
+
'zu' => 'Zulu',
|
128 |
+
);
|
129 |
+
|
130 |
+
register_activation_hook( __FILE__, array(&$this,'glt_activate'));
|
131 |
+
register_deactivation_hook( __FILE__, array(&$this,'glt_deactivate'));
|
132 |
+
|
133 |
add_action( 'admin_menu', array( &$this, 'add_my_admin_menus'));
|
134 |
add_action('admin_init',array(&$this, 'initialize_settings'));
|
135 |
add_action('wp_head',array(&$this, 'load_css'));
|
151 |
add_option('googlelanguagetranslator_language_option','all');
|
152 |
add_option('googlelanguagetranslator_flags','show_flags');
|
153 |
add_option('language_display_settings',array ('en' => 1));
|
|
|
154 |
add_option('googlelanguagetranslator_translatebox','yes');
|
155 |
add_option('googlelanguagetranslator_display','Vertical');
|
156 |
add_option('googlelanguagetranslator_toolbar','Yes');
|
172 |
}
|
173 |
|
174 |
public function glt_deactivate() {
|
175 |
+
delete_option('flag_display_settings');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
|
178 |
public function glt_settings_link ( $links ) {
|
322 |
$spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
|
323 |
$portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
|
324 |
$get_language_option = get_option('googlelanguagetranslator_language_option');
|
325 |
+
$get_language_choices = get_option('language_display_settings');
|
326 |
$get_flag_choices_count = count($get_flag_choices);
|
327 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
328 |
$floating_widget_text = get_option ('googlelanguagetranslator_floating_widget_text');
|
335 |
<?php
|
336 |
|
337 |
if( $is_active == 1) {
|
338 |
+
if ($floating_widget=='yes') {
|
339 |
+
$str.='<div id="glt-translate-trigger"><span'.($floating_widget_text_translation_allowed != 1 ? ' class="notranslate"' : ' class="translate"').'>'.(empty($floating_widget_text) ? 'Translate »' : $floating_widget_text).'</span></div>';
|
|
|
|
|
|
|
340 |
$str.='<div id="glt-toolbar"></div>';
|
341 |
} //endif $floating_widget
|
342 |
|
343 |
+
$str.='<div id="flags" style="display:none" class="size'.$flag_width.'">';
|
344 |
+
$str.='<ul id="sortable" class="ui-sortable">';
|
345 |
+
if (empty($new_languages_array_string)) {
|
346 |
+
foreach ($this->languages_array as $key=>$value) {
|
347 |
+
$language_code = $key;
|
348 |
+
$language_name = $value;
|
349 |
+
$language_name_flag = $language_name;
|
350 |
+
|
351 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
352 |
+
if ( isset ( $get_language_choices[$language_code] ) ) {
|
353 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
354 |
+
$language_name_flag = 'canada';
|
355 |
+
}
|
356 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
|
|
|
|
357 |
$language_name_flag = 'united-states';
|
358 |
+
}
|
359 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
360 |
+
$language_name_flag = 'mexico';
|
361 |
+
}
|
362 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
363 |
+
$language_name_flag = 'brazil';
|
364 |
+
}
|
365 |
+
$str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
|
366 |
+
} //isset
|
367 |
+
} //endif
|
368 |
+
}//foreach
|
369 |
+
} else {
|
370 |
+
if ($new_languages_array_count != count($get_language_choices)):
|
371 |
+
foreach ($get_language_choices as $key => $value) {
|
372 |
+
$language_code = $key;
|
373 |
+
$language_name = $this->languages_array[$key];
|
374 |
+
$language_name_flag = $language_name;
|
375 |
+
|
376 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
377 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
378 |
+
$language_name_flag = 'canada';
|
379 |
+
}
|
380 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
381 |
+
$language_name_flag = 'united-states';
|
382 |
+
}
|
383 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
384 |
+
$language_name_flag = 'mexico';
|
385 |
+
}
|
386 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
387 |
+
$language_name_flag = 'brazil';
|
388 |
+
}
|
389 |
+
|
390 |
+
$str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
|
391 |
+
} //get_option
|
392 |
+
} //foreach
|
393 |
+
else:
|
394 |
+
foreach ($new_languages_array_codes as $value) {
|
395 |
+
$language_name = $value;
|
396 |
+
$language_code = array_search ($language_name, $this->languages_array);
|
397 |
+
$language_name_flag = $language_name;
|
398 |
+
|
399 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
400 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
401 |
+
$language_name_flag = 'canada';
|
402 |
+
}
|
403 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
404 |
+
$language_name_flag = 'united-states';
|
405 |
+
}
|
406 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
407 |
+
$language_name_flag = 'mexico';
|
408 |
+
}
|
409 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
410 |
+
$language_name_flag = 'brazil';
|
411 |
+
}
|
412 |
+
|
413 |
+
$str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
|
414 |
+
} //get_option
|
415 |
+
}//foreach
|
416 |
+
endif;
|
417 |
+
}//endif
|
418 |
$str.='</ul>';
|
419 |
$str.='</div>';
|
|
|
420 |
}
|
421 |
|
422 |
$language_choices = $this->googlelanguagetranslator_included_languages();
|
439 |
}
|
440 |
|
441 |
public function googlelanguagetranslator_vertical() {
|
|
|
442 |
global $shortcode_started;
|
443 |
+
$i = 0;
|
|
|
444 |
$shortcode_started = 'true';
|
|
|
445 |
$new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
|
446 |
$new_languages_array = explode(",",$new_languages_array_string);
|
447 |
$new_languages_array_codes = array_values($new_languages_array);
|
450 |
$get_language_choices = get_option ('language_display_settings');
|
451 |
$flag_width = get_option('googlelanguagetranslator_flag_size');
|
452 |
$default_language_code = get_option('googlelanguagetranslator_language');
|
453 |
+
$english_flag_choice = get_option('googlelanguagetranslator_english_flag_choice');
|
454 |
+
$spanish_flag_choice = get_option('googlelanguagetranslator_spanish_flag_choice');
|
455 |
+
$portuguese_flag_choice = get_option('googlelanguagetranslator_portuguese_flag_choice');
|
456 |
$is_active = get_option ( 'googlelanguagetranslator_active' );
|
457 |
$get_language_option = get_option('googlelanguagetranslator_language_option');
|
458 |
$language_choices = $this->googlelanguagetranslator_included_languages();
|
459 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
460 |
$str = '';
|
461 |
|
462 |
+
if( $is_active == 1):
|
463 |
+
$str.='<div id="flags" class="size'.$flag_width.'">';
|
464 |
+
$str.='<ul id="sortable" class="ui-sortable" style="float:left">';
|
465 |
|
466 |
+
if (empty($new_languages_array_string)):
|
467 |
+
foreach ($this->languages_array as $key=>$value) {
|
468 |
+
$language_code = $key;
|
469 |
+
$language_name = $value;
|
470 |
+
$language_name_flag = $language_name;
|
471 |
+
|
472 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
473 |
+
|
474 |
+
if ($get_language_choices[$language_code]==1) {
|
475 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
$language_name_flag = 'canada';
|
477 |
}
|
478 |
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
479 |
+
$language_name_flag = 'united-states';
|
480 |
}
|
481 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
482 |
$language_name_flag = 'mexico';
|
483 |
}
|
484 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
485 |
+
$language_name_flag = 'brazil';
|
486 |
+
}
|
487 |
+
$str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
|
488 |
+
} //endif
|
489 |
+
} //endif
|
490 |
+
}//foreach
|
491 |
+
else:
|
492 |
+
if ($new_languages_array_count != count($get_language_choices)):
|
493 |
+
foreach ($get_language_choices as $key => $value) {
|
494 |
+
$language_code = $key;
|
495 |
+
$language_name = $this->languages_array[$key];
|
496 |
+
$language_name_flag = $language_name;
|
497 |
+
|
498 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
499 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
500 |
+
$language_name_flag = 'canada';
|
501 |
+
}
|
502 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
503 |
+
$language_name_flag = 'united-states';
|
504 |
+
}
|
505 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
506 |
+
$language_name_flag = 'mexico';
|
507 |
+
}
|
508 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
509 |
+
$language_name_flag = 'brazil';
|
510 |
+
}
|
511 |
+
|
512 |
+
$str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
|
513 |
+
} //get_option
|
514 |
+
} //foreach
|
515 |
+
else:
|
516 |
+
foreach ($new_languages_array_codes as $value) {
|
517 |
+
$language_name = $value;
|
518 |
+
$language_code = array_search ($language_name, $this->languages_array);
|
519 |
+
$language_name_flag = $language_name;
|
520 |
+
|
521 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
522 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
523 |
+
$language_name_flag = 'canada';
|
524 |
+
}
|
525 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
526 |
+
$language_name_flag = 'united-states';
|
527 |
+
}
|
528 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
529 |
+
$language_name_flag = 'mexico';
|
530 |
+
}
|
531 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
532 |
+
$language_name_flag = 'brazil';
|
533 |
+
}
|
534 |
+
|
535 |
+
$str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
|
536 |
+
} //get_option
|
537 |
+
}//foreach
|
538 |
+
endif;
|
539 |
+
endif;
|
540 |
$str.='</ul>';
|
541 |
$str.='</div>';
|
542 |
$str.='<div id="google_language_translator"></div>';
|
543 |
+
return $str;
|
544 |
+
endif;
|
545 |
} // End glt_vertical
|
546 |
|
547 |
public function googlelanguagetranslator_horizontal(){
|
548 |
$shortcode_started = 'true';
|
|
|
549 |
$new_languages_array_string = get_option('googlelanguagetranslator_flags_order');
|
550 |
$new_languages_array = explode(",",$new_languages_array_string);
|
551 |
$new_languages_array_codes = array_values($new_languages_array);
|
563 |
$floating_widget = get_option ('googlelanguagetranslator_floating_widget');
|
564 |
$str = '';
|
565 |
|
566 |
+
if( $is_active == 1):
|
567 |
+
$str.='<div id="flags" class="size'.$flag_width.'">';
|
568 |
+
$str.='<ul id="sortable" class="ui-sortable" style="float:left">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
|
570 |
+
if (empty($new_languages_array_string)):
|
571 |
+
foreach ($this->languages_array as $key=>$value) {
|
572 |
+
$language_code = $key;
|
573 |
+
$language_name = $value;
|
574 |
+
$language_name_flag = $language_name;
|
575 |
+
|
576 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
577 |
+
|
578 |
+
if ($get_language_choices[$language_code]==1) {
|
579 |
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
580 |
+
$language_name_flag = 'canada';
|
581 |
+
}
|
582 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
583 |
$language_name_flag = 'united-states';
|
584 |
+
}
|
585 |
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
586 |
+
$language_name_flag = 'mexico';
|
587 |
+
}
|
588 |
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
$language_name_flag = 'brazil';
|
590 |
}
|
591 |
+
$str.="<li id='".$language_name."'><a title='".$language_name."' class='notranslate flag ".$language_code." ".$language_name_flag."'></a></li>";
|
592 |
+
} //endif
|
593 |
+
} //endif
|
594 |
+
}//foreach
|
595 |
+
else:
|
596 |
+
if ($new_languages_array_count != count($get_language_choices)):
|
597 |
+
foreach ($get_language_choices as $key => $value) {
|
598 |
+
$language_code = $key;
|
599 |
+
$language_name = $this->languages_array[$key];
|
600 |
+
$language_name_flag = $language_name;
|
601 |
+
|
602 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
603 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
604 |
+
$language_name_flag = 'canada';
|
605 |
+
}
|
606 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
607 |
+
$language_name_flag = 'united-states';
|
608 |
+
}
|
609 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
610 |
+
$language_name_flag = 'mexico';
|
611 |
+
}
|
612 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
613 |
+
$language_name_flag = 'brazil';
|
614 |
+
}
|
615 |
+
|
616 |
+
$str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
|
617 |
+
} //get_option
|
618 |
+
} //foreach
|
619 |
+
else:
|
620 |
+
foreach ($new_languages_array_codes as $value) {
|
621 |
+
$language_name = $value;
|
622 |
+
$language_code = array_search ($language_name, $this->languages_array);
|
623 |
+
$language_name_flag = $language_name;
|
624 |
+
|
625 |
+
if (get_option('googlelanguagetranslator_flags') == 1) {
|
626 |
+
if ( $language_name == 'English' && $english_flag_choice == 'canadian_flag') {
|
627 |
+
$language_name_flag = 'canada';
|
628 |
+
}
|
629 |
+
if ( $language_name == "English" && $english_flag_choice == 'us_flag') {
|
630 |
+
$language_name_flag = 'united-states';
|
631 |
+
}
|
632 |
+
if ( $language_name == 'Spanish' && $spanish_flag_choice == 'mexican_flag') {
|
633 |
+
$language_name_flag = 'mexico';
|
634 |
+
}
|
635 |
+
if ( $language_name == 'Portuguese' && $portuguese_flag_choice == 'brazilian_flag') {
|
636 |
+
$language_name_flag = 'brazil';
|
637 |
+
}
|
638 |
+
|
639 |
+
$str.='<li id="'.$language_name.'"><a title="'.$language_name.'" class="nturl notranslate '.$language_code.' flag '.$language_name_flag.'"></a>';
|
640 |
+
} //get_option
|
641 |
+
}//foreach
|
642 |
+
endif;
|
643 |
+
endif;
|
644 |
$str.='</ul>';
|
645 |
$str.='</div>';
|
646 |
$str.='<div id="google_language_translator"></div>';
|
647 |
+
return $str;
|
648 |
+
endif;
|
649 |
} // End glt_horizontal
|
650 |
|
651 |
public function initialize_settings() {
|
652 |
add_settings_section('glt_settings','Settings','','google_language_translator');
|
653 |
|
654 |
$settings_name_array = array (
|
655 |
+
'googlelanguagetranslator_active','googlelanguagetranslator_language','googlelanguagetranslator_language_option','language_display_settings','googlelanguagetranslator_flags','googlelanguagetranslator_translatebox','googlelanguagetranslator_display','googlelanguagetranslator_toolbar','googlelanguagetranslator_showbranding','googlelanguagetranslator_flags_alignment','googlelanguagetranslator_analytics','googlelanguagetranslator_analytics_id','googlelanguagetranslator_css','googlelanguagetranslator_multilanguage','googlelanguagetranslator_floating_widget','googlelanguagetranslator_flag_size','googlelanguagetranslator_flags_order','googlelanguagetranslator_english_flag_choice','googlelanguagetranslator_spanish_flag_choice','googlelanguagetranslator_portuguese_flag_choice','googlelanguagetranslator_floating_widget_text','googlelanguagetranslator_floating_widget_text_allow_translation'
|
656 |
);
|
657 |
|
658 |
foreach ($settings_name_array as $setting) {
|
730 |
update_option( $option_name, $new_value );
|
731 |
}
|
732 |
|
733 |
+
$get_language_choices = get_option (''.$option_name.''); ?>
|
734 |
+
|
735 |
+
<script>jQuery(document).ready(function($) { $('.select-all-languages').on('click',function(e) { e.preventDefault(); $('.languages').find('input:checkbox').prop('checked', true); }); $('.clear-all-languages').on('click',function(e) { e.preventDefault();
|
736 |
+
$('.languages').find('input:checkbox').prop('checked', false); }); }); </script>
|
737 |
+
|
738 |
+
<?php
|
739 |
|
740 |
foreach ($this->languages_array as $key => $value) {
|
741 |
$language_code = $key;
|
763 |
<?php
|
764 |
}
|
765 |
|
766 |
+
public function googlelanguagetranslator_flags_cb() {
|
767 |
+
|
768 |
+
$option_name = 'googlelanguagetranslator_flags' ;
|
769 |
+
$new_value = 1;
|
770 |
|
771 |
if ( get_option( $option_name ) === false ) {
|
772 |
|
773 |
// The option does not exist, so we update it.
|
774 |
update_option( $option_name, $new_value );
|
775 |
+
}
|
776 |
+
|
777 |
+
$options = get_option (''.$option_name.'');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
778 |
|
779 |
+
$html = '<input type="checkbox" name="googlelanguagetranslator_flags" id="googlelanguagetranslator_flags" value="1" '.checked(1,$options,false).'/> Check to show flags';
|
780 |
+
|
781 |
+
echo $html;
|
782 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
|
784 |
public function googlelanguagetranslator_floating_widget_cb() {
|
785 |
|
1145 |
<h3 class="notranslate">Layout Settings</h3>
|
1146 |
<table style="border-collapse:separate" width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
|
1147 |
<tr class="notranslate">
|
1148 |
+
<td colspan="2">What languages will display in the language switcher? (<a class="select-all-languages" href="#">Select All</a> | <a class="clear-all-languages" href="#">Clear</a>)</td>
|
1149 |
+
</tr>
|
1150 |
+
|
1151 |
+
<tr class="notranslate languages">
|
1152 |
+
<td colspan="2"><?php $this->language_display_settings_cb(); ?></td>
|
1153 |
+
</tr>
|
1154 |
+
|
1155 |
+
<tr class="notranslate">
|
1156 |
+
<td class="choose_flags_intro">Show flag images?<br/>(Display up to 104 flags above the language switcher)</td>
|
1157 |
+
<td class="choose_flags_intro"><?php $this->googlelanguagetranslator_flags_cb(); ?></td>
|
1158 |
+
</tr>
|
1159 |
+
|
1160 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1161 |
|
1162 |
<tr class="notranslate">
|
1163 |
<td>Show or hide the langauge switcher?</td>
|
1339 |
|
1340 |
<div class="metabox-holder box-right notranslate" style="float: right; width: 33%;">
|
1341 |
<div class="postbox">
|
1342 |
+
<h3>GLT Premium 5.0.39 is Here! $30</h3>
|
1343 |
<div class="inside">
|
1344 |
<a class="wp-studio-logo" href="http://www.wp-studio.net/" target="_blank"><img style="background:#444; border-radius:3px; -webkit-border-radius:3px; -moz-border-radius:3px; width:177px;" src="<?php echo plugins_url( 'images/logo.png' , __FILE__ ); ?>"></a><br />
|
1345 |
<ul id="features" style="margin-left:15px">
|
|
|
|
|
1346 |
<li style="list-style:square outside">104 Languages with flags</li>
|
1347 |
+
<li style="list-style:square outside">Edit up to 5 phrases in any language, while using auto-translation</li>
|
1348 |
+
<li style="list-style:square outside">6 Floating Widget positions</li>
|
1349 |
<li style="list-style:square outside">Exclude specific areas from translation</li>
|
1350 |
+
<li style="list-style:square outside">jQuery-powered language switcher</li>
|
1351 |
+
<li style="list-style:square outside">Add single languages to your menus/pages/posts</li>
|
1352 |
+
<li style="list-style:square outside">Language switcher loads inline with page content</li>
|
1353 |
+
<li style="list-style:square outside">Custom flag choices for English, Spanish and Portuguese</li>
|
1354 |
+
<li style="list-style:square outside">User-friendly URLs, hide or show <code>lang</code> attribute</li>
|
1355 |
+
<li style="list-style:square outside">Drag/drop flags to re-arrange their order</li>
|
1356 |
+
<li style="list-style:square outside">Duplicate pages/posts into your chosen languages (for editing)</li>
|
1357 |
+
<li style="list-style:square outside">FREE access to all future updates</li>
|
1358 |
+
</ul>
|
|
|
1359 |
</div> <!-- .inside -->
|
1360 |
</div> <!-- .postbox -->
|
1361 |
</div> <!-- .metabox-holder -->
|
js/admin.js
CHANGED
@@ -1,43 +1,9 @@
|
|
1 |
jQuery(document).ready(function($){
|
2 |
var language_display = $('input[name=googlelanguagetranslator_language_option]:checked').val();
|
3 |
-
|
4 |
-
if ( language_display == 'all') {
|
5 |
-
$('.languages').css('display','none');
|
6 |
-
$('.choose_flags').css('display','none');
|
7 |
-
} else if (language_display == 'specific') {
|
8 |
-
$('.choose_flags_intro').css('display','none');
|
9 |
-
$('.choose_flags').css('display','none');
|
10 |
-
}
|
11 |
-
|
12 |
var display = $('select[name=googlelanguagetranslator_display] option:selected').val();
|
13 |
-
|
14 |
-
$('input[name=googlelanguagetranslator_language_option]').change(function(){
|
15 |
-
if( $(this).val() == 'all'){
|
16 |
-
$('.languages').fadeOut("slow");
|
17 |
-
$('.choose_flags_intro').css('display','');
|
18 |
-
var flag_display = $('input[name=googlelanguagetranslator_flags]:checked').val();
|
19 |
-
if ( flag_display == 'show_flags') {
|
20 |
-
$('.choose_flags').css('display','');
|
21 |
-
}
|
22 |
-
} else if ($(this).val() == 'specific') {
|
23 |
-
$('.languages').fadeIn("slow");
|
24 |
-
$('.choose_flags_intro').css('display','none');
|
25 |
-
$('.choose_flags').css('display','none');
|
26 |
-
}
|
27 |
-
});
|
28 |
-
|
29 |
-
var language_display = $('input[name=googlelanguagetranslator_language_option]:checked').val();
|
30 |
var flag_display = $('input[name=googlelanguagetranslator_flags]:checked').val();
|
31 |
var floating_widget_display = $('select[name=googlelanguagetranslator_floating_widget] option:selected').val();
|
32 |
-
|
33 |
-
if ( flag_display == 'hide_flags') {
|
34 |
-
$('.choose_flags').css('display','none');
|
35 |
-
} else if (flag_display == 'show_flags') {
|
36 |
-
if ( language_display == 'all') {
|
37 |
-
$('.choose_flags').css('display','');
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
if(floating_widget_display == 'yes') {
|
42 |
$('.floating_widget_text').css('display','');
|
43 |
} else {
|
1 |
jQuery(document).ready(function($){
|
2 |
var language_display = $('input[name=googlelanguagetranslator_language_option]:checked').val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
var display = $('select[name=googlelanguagetranslator_display] option:selected').val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
var flag_display = $('input[name=googlelanguagetranslator_flags]:checked').val();
|
5 |
var floating_widget_display = $('select[name=googlelanguagetranslator_floating_widget] option:selected').val();
|
6 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
if(floating_widget_display == 'yes') {
|
8 |
$('.floating_widget_text').css('display','');
|
9 |
} else {
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: http://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id
|
|
4 |
Plugin link: http://wp-studio.net/how-it-works
|
5 |
Tags: language translator, google translator, language translate, translate wordpress, google language translator, translation, translate, multi language
|
6 |
Requires at least: 2.9
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 5.0.
|
9 |
|
10 |
Welcome to Google Language Translator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
|
11 |
|
@@ -46,6 +46,9 @@ A: Yes! Add the "notranslate" class to the HTML element containing your text. Fo
|
|
46 |
|
47 |
== Changelog ==
|
48 |
|
|
|
|
|
|
|
49 |
5.0.33
|
50 |
- Removed a deprecated jQuery function, and replaced with updated code in the footer_script() function.
|
51 |
|
4 |
Plugin link: http://wp-studio.net/how-it-works
|
5 |
Tags: language translator, google translator, language translate, translate wordpress, google language translator, translation, translate, multi language
|
6 |
Requires at least: 2.9
|
7 |
+
Tested up to: 4.9.2
|
8 |
+
Stable tag: 5.0.34
|
9 |
|
10 |
Welcome to Google Language Translator! This plugin allows you to insert the Google Language Translator tool anywhere on your website using shortcode.
|
11 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
+
5.0.34
|
50 |
+
- Updated the settings panel to function more logically. Now users choose the languages they want, and can turn on/off flags associated with those langauges.
|
51 |
+
|
52 |
5.0.33
|
53 |
- Removed a deprecated jQuery function, and replaced with updated code in the footer_script() function.
|
54 |
|