Google Language Translator - Version 5.0.48

Version Description

Download this release

Release Info

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

Code changes from version 5.0.47 to 5.0.48

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