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