Google Language Translator - Version 1.1

Version Description

Download this release

Release Info

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

Version 1.1

Files changed (3) hide show
  1. google-language-translator.php +265 -0
  2. readme.txt +33 -0
  3. screenshot-1.png +0 -0
google-language-translator.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /*
5
+
6
+ Plugin Name: Google Language Translator
7
+
8
+ Plugin URI: http://www.studio88design.com/plugins/google-language-translator
9
+
10
+ Version: 1.1
11
+ Description: The MOST SIMPLE Google Translator plugin. This plugin adds Google Translator to your website by using a single shortcode, [google-translator]. Setting options include: layout style, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
12
+
13
+ Author: Rob Myrick
14
+
15
+ Author URI: http://www.studio88design.com/
16
+
17
+ */
18
+
19
+
20
+
21
+ add_action('admin_menu', 'googlelanguagetranslator_menu_options');
22
+
23
+ add_option("googlelanguagetranslator_active","0");
24
+
25
+ add_shortcode( 'google-translator', 'google_translator_shortcode');
26
+
27
+ function google_translator_shortcode() {
28
+ if (get_option('googlelanguagetranslator_display')=='Vertical'){
29
+ echo googlelanguagetranslator_vertical();
30
+ }
31
+
32
+ elseif(get_option('googlelanguagetranslator_display')=='Horizontal'){
33
+ echo googlelanguagetranslator_horizontal();
34
+ }
35
+
36
+ if (get_option('googlelanguagetranslator_toolbar')=='Yes'){
37
+ echo googlelanguagetranslator_toolbar_yes();
38
+ }
39
+
40
+ elseif(get_option('googlelanguagetranslator_toolbar')=='No'){
41
+ echo googlelanguagetranslator_toolbar_no();
42
+ }
43
+
44
+ if (get_option('googlelanguagetranslator_showbranding')=='Yes'){
45
+ echo googlelanguagetranslator_showbranding_yes();
46
+ }
47
+
48
+ elseif(get_option('googlelanguagetranslator_showbranding')=='No'){
49
+ echo googlelanguagetranslator_showbranding_no();
50
+ }
51
+
52
+ }
53
+
54
+ function googlelanguagetranslator_menu_options(){
55
+ add_options_page('Google Language Translator', 'Google Language Translator', 'manage_options', 'googlelanguagetranslator-menu-options', 'googlelanguagetranslator_menu');
56
+
57
+ if(isset($_POST['googlelanguagetranslator_update_options'])){
58
+ update_option('googlelanguagetranslator_display',$_POST['googlelanguagetranslator_display']);
59
+ update_option('googlelanguagetranslator_toolbar',$_POST['googlelanguagetranslator_toolbar']);
60
+ update_option('googlelanguagetranslator_showbranding',$_POST['googlelanguagetranslator_showbranding']);
61
+ }
62
+
63
+ }
64
+
65
+ function googlelanguagetranslator_menu(){
66
+ if (!current_user_can('manage_options')) {
67
+ wp_die( __('You do not have sufficient permissions to access this page.') );
68
+ }
69
+ ?>
70
+ <div class="wrap" style="width:65%">
71
+ <div id="icon-options-general" class="icon32"></div>
72
+ <h2>Google Language Translator</h2>
73
+ <div id="poststuff" class="metabox-holder has-right-sidebar" >
74
+ <div class="postbox" style="width: 100%">
75
+ <h3>Settings</h3>
76
+ <form method="post" action="options.php">
77
+ <?php wp_nonce_field('update-options');?>
78
+ <table width="100%" border="0" cellspacing="8" cellpadding="0" class="form-table">
79
+ <tr>
80
+ <td>Plugin Status:</td>
81
+ <td><input type="checkbox" name="googlelanguagetranslator_active" id="googlelanguagetranslator_active" value="1" <?php if(get_option('googlelanguagetranslator_active')==1){echo "checked";}?> />
82
+ Click Here to Activate Google Language Translator</td>
83
+ </tr>
84
+
85
+ <tr>
86
+ <td width="25%">Display options:</td>
87
+ <td width="75%">
88
+ <select name="googlelanguagetranslator_display" id="googlelanguagetranslator_display" style="width:100px;">
89
+ <option value="Vertical" <?php if(get_option('googlelanguagetranslator_display')=='Vertical'){echo "selected";}?>>Vertical</option>
90
+ <option value="Horizontal" <?php if(get_option('googlelanguagetranslator_display')=='Horizontal'){echo "selected";}?>>Horizontal</option>
91
+ </select> </td>
92
+ </tr>
93
+
94
+ <tr>
95
+ <td width="25%">Show Google Toolbar?</td>
96
+ <td width="75%">
97
+ <select name="googlelanguagetranslator_toolbar" id="googlelanguagetranslator_toolbar" style="width:100px;">
98
+ <option value="Yes" <?php if(get_option('googlelanguagetranslator_toolbar')=='Yes'){echo "selected";}?>>Yes</option>
99
+ <option value="No" <?php if(get_option('googlelanguagetranslator_toolbar')=='No'){echo "selected";}?>>No</option>
100
+ </select> </td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <td width="25%">Show Google Branding?</td>
105
+ <td width="75%">
106
+ <select name="googlelanguagetranslator_showbranding" id="googlelanguagetranslator_showbranding" style="width:100px;">
107
+ <option value="Yes" <?php if(get_option('googlelanguagetranslator_showbranding')=='Yes'){echo "selected";}?>>Yes</option>
108
+ <option value="No" <?php if(get_option('googlelanguagetranslator_showbranding')=='No'){echo "selected";}?>>No</option>
109
+ </select> </td>
110
+ </tr>
111
+
112
+ <tr>
113
+ <td>&nbsp;</td>
114
+ <td><input type="submit" class="button-primary" value="<?php _e('Update Option')?>" name="googlelanguagetranslator_update_options" /></td>
115
+ </tr>
116
+ <tr>
117
+ <td>&nbsp;</td>
118
+ <td>&nbsp;</td>
119
+ </tr>
120
+
121
+ <tr>
122
+ <td width="25%">Copy/Paste This Shortcode:</td>
123
+ <td width="75%">
124
+ [google-translator]
125
+ </td>
126
+ </tr>
127
+
128
+ </table>
129
+ <input type="hidden" name="action" value="update" />
130
+ <input type="hidden" name="page_options" value="googlelanguagetranslator_active" />
131
+ </form>
132
+ </div>
133
+ </div>
134
+
135
+ <div id="poststuff" class="metabox-holder" style="float: left; width: 48%;">
136
+ <div class="postbox">
137
+ <h3>Another Plugin You Might Like:</h3>
138
+ <table class="form-table" width="100%">
139
+ <tr><td align="left" valign="top">
140
+ <table width="100%" border="0" cellspacing="0" cellpadding="4">
141
+
142
+ <tr>
143
+ <td>
144
+ <div>
145
+ <div>
146
+ <div>
147
+ <a href="http://wordpress.org/extend/plugins/malware-finder/" target="_blank">Malware Finder</a>
148
+ This plugin enables you to look inside all your WordPress files at once to find malicious code.<br>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </td>
153
+ </tr>
154
+
155
+ <tr>
156
+ <td><strong>You can also download this plugin at <a href="http://www.studio88design.com" target="_blank">www.studio88design.com</a></strong></td>
157
+ </tr>
158
+ </table>
159
+ </td>
160
+ </tr>
161
+ </table></div></div>
162
+ <div id="poststuff" class="metabox-holder" style="float: right; width: 48%;">
163
+ <div class="postbox">
164
+ <h3>Please Consider A Donation</h3>
165
+ <div class="inside">
166
+ If you like this plugin and find it useful, help keep this plugin actively developed by clicking the donate button <br /><br />
167
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
168
+ <input type="hidden" name="cmd" value="_donations">
169
+ <input type="hidden" name="business" value="robertmyrick@hotmail.com">
170
+ <input type="hidden" name="lc" value="US">
171
+ <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!">
172
+ <input type="hidden" name="no_note" value="0">
173
+ <input type="hidden" name="currency_code" value="USD">
174
+ <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
175
+ <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!">
176
+ <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
177
+ </form>
178
+
179
+ <br /><br />
180
+ </div>
181
+ </div></div>
182
+ </div>
183
+
184
+ <?php
185
+ }
186
+
187
+ function googlelanguagetranslator_vertical(){
188
+ if(get_option('googlelanguagetranslator_active')==1){
189
+ $str.='<div id="google_translate_element"></div><script>
190
+ function googleTranslateElementInit() {
191
+ new google.translate.TranslateElement({
192
+ pageLanguage: \'en\'
193
+ }, \'google_translate_element\');
194
+ }
195
+ </script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>';
196
+ echo '<div>'.$str.'</div>';
197
+ }
198
+ }
199
+
200
+ function googlelanguagetranslator_horizontal(){
201
+ if(get_option('googlelanguagetranslator_active')==1){
202
+ $str.='<div id="google_translate_element"></div><script>
203
+ function googleTranslateElementInit() {
204
+ new google.translate.TranslateElement({
205
+ pageLanguage: \'en\', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
206
+ }, \'google_translate_element\');
207
+ }
208
+ </script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>';
209
+ echo '<div>'.$str.'</div>';
210
+ }
211
+ }
212
+
213
+ function googlelanguagetranslator_toolbar_yes(){
214
+ if(get_option('googlelanguagetranslator_active')==1) {
215
+ $str.='<style type="text/css">
216
+ #google_translate_element {color: transparent;}
217
+ .goog-te-gadget .goog-te-combo {margin: 2px 0px !important;}
218
+ .goog-tooltip {display: none !important;}
219
+ .goog-tooltip:hover {display: none !important;}
220
+ .goog-text-highlight {background-color: transparent !important; border: none !important;box-shadow: none !important;}
221
+ </style>';
222
+ echo $str;
223
+ }
224
+ }
225
+
226
+ function googlelanguagetranslator_toolbar_no(){
227
+ if(get_option('googlelanguagetranslator_active')==1) {
228
+ $str.='<style type="text/css">
229
+
230
+
231
+ .goog-te-banner-frame{visibility:hidden !important;}
232
+ body {top:0px !important;}
233
+ </style>';
234
+ echo $str;
235
+ }
236
+ }
237
+
238
+ function googlelanguagetranslator_showbranding_yes() {
239
+ if(get_option('googlelanguagetranslator_active')==1) {
240
+ $str.='<style type="text/css">
241
+
242
+ .goog-te-gadget .goog-te-combo {margin: 2px 0px !important;}
243
+ .goog-tooltip {display: none !important;}
244
+ .goog-tooltip:hover {display: none !important;}
245
+ .goog-text-highlight {background-color: transparent !important; border: none !important; box-shadow: none !important;}
246
+ </style>';
247
+ echo $str;
248
+ }
249
+ }
250
+
251
+ function googlelanguagetranslator_showbranding_no() {
252
+ if(get_option('googlelanguagetranslator_active')==1) {
253
+ $str.='<style type="text/css">
254
+ #google_translate_element a {display: none;}
255
+ div.goog-te-gadget {color: transparent !important;}
256
+ .goog-te-gadget .goog-te-combo {margin: 2px 0px !important;}
257
+ .goog-tooltip {display: none !important;}
258
+ .goog-tooltip:hover {display: none !important;}
259
+ .goog-text-highlight {background-color: transparent !important; border: none !important; box-shadow: none !important;}
260
+ </style>';
261
+ echo $str;
262
+ }
263
+ }
264
+
265
+ ?>
readme.txt ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Google Language Translator ===
2
+ Contributors: Rob Myrick
3
+ Donate link: https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=c6aycTLE8Qho4lN9-QgzmJQKxNrRLomhJQ8gEAM2t5EZc5enxqC4Dpii-1C&dispatch=5885d80a13c0db1f8e263663d3faee8d0b7e678a25d883d0fa72c947f193f8fd
4
+ Plugin link: http://www.studio88design.com/plugins/google-language-translator
5
+ Tags: language translator, language translate, google language translator, translation, translate, multi language
6
+ Requires at least: 2.9
7
+ Tested up to: 3.4.2
8
+ stable tag: 1.1
9
+
10
+ Welcome to Google Language Tranlator! 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, 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
+ == Changelog ==
28
+
29
+ 1.1 The shortcode supplied on the settings page was updated to display '[google-translator]'.
30
+
31
+ == Screenshots ==
32
+
33
+ 1. Settings include: inline or vertical layout, hide/show Google toolbar, and hide/show Google branding. Add the shortcode to pages, posts, and widgets.
screenshot-1.png ADDED
Binary file