Changeset 68 for trunk/WordPress/plugin/transposh/transposh_widget.php
- Timestamp:
- 03/17/2009 09:07:25 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/transposh_widget.php
r59 r68 36 36 37 37 global $wp_rewrite; 38 38 39 39 $ref=getenv('HTTP_REFERER'); 40 40 $lang = $_POST[LANG_PARAM]; 41 41 42 //remove existing language settings. 42 //remove existing language settings. 43 43 $ref = cleanup_url($ref); 44 44 45 45 if($lang != "none") 46 46 { … … 100 100 101 101 $is_showing_languages = FALSE; 102 102 103 103 echo $before_widget . $before_title . __(no_translate("Transposh")) . $after_title; 104 104 105 105 switch ($options['style']) { 106 106 case 1: // flags 107 107 //keep the flags in the same direction regardless of the overall page direction 108 echo "<div style=\"text-align: left;\" class=\"" . NO_TRANSLATE_CLASS . "\" >"; 108 echo "<div style=\"text-align: left;\" class=\"" . NO_TRANSLATE_CLASS . "\" >"; 109 109 110 110 global $plugin_url; 111 111 $using_permalinks = $wp_rewrite->using_permalinks(); 112 112 113 113 foreach($languages as $code => $lang2) 114 114 { 115 115 list($language,$flag) = explode (",",$lang2); 116 116 117 //remove any language identifier 117 //remove any language identifier 118 118 $page_url = cleanup_url($page_url); 119 119 120 120 //Only show languages which are viewable or (editable and the user is a translator) 121 121 if(strstr($viewable_langs, $code) || … … 123 123 { 124 124 $page_url = rewrite_url_lang_param($page_url, $code, $is_edit, !$using_permalinks); 125 125 126 126 echo "<a href=\"" . $page_url . "\"> 127 127 <img src=\"$plugin_url/flags/$flag.png\" title=\"$language\" alt=\"$language\" … … 131 131 } 132 132 echo "</div>"; 133 133 134 134 // this is the form for the edit... 135 135 echo "<form action=\"$page_url\" method=\"post\">"; … … 139 139 140 140 echo "<form action=\"$page_url\" method=\"post\">"; 141 echo "<span class=\"" . NO_TRANSLATE_CLASS . "\" >";141 echo "<span class=\"" .NO_TRANSLATE_CLASS . "\" >"; 142 142 echo "<select name=\"lang\" id=\"lang\" onchange=\"Javascript:this.form.submit();\">"; 143 143 echo "<option value=\"none\">[Language]</option>"; … … 171 171 "\" onClick=\"this.form.submit();\"/> Edit Translation"; 172 172 } 173 173 174 174 echo "<input type=\"hidden\" name=\"transposh_widget_posted\" value=\"1\"/>"; 175 175 } … … 181 181 182 182 echo "</form>"; 183 echo "<button onClick=\"do_auto_translate();\">translate all</button>"; 183 184 184 185 echo $after_widget; 185 186 } 186 187 187 188 /* 189 *Remove from url any language (or editing) params that were added for our use. 190 *Return the scrubed url 188 /* 189 * Remove from url any language (or editing) params that were added for our use. 190 * Return the scrubed url 191 191 */ 192 192 function cleanup_url($url) 193 193 { 194 194 global $home_url, $home_url_quoted; 195 195 196 196 //cleanup previous lang & edit parameter from url 197 197 $url = preg_replace("/(" . LANG_PARAM . "|" . EDIT_PARAM . ")=[^&]*/i", "", $url); 198 199 198 199 200 200 if(!$home_url) 201 201 { … … 203 203 init_global_vars(); 204 204 } 205 205 206 206 //cleanup lang identifier in permalinks 207 207 $url = preg_replace("/$home_url_quoted\/(..\/)/", "$home_url/", $url); … … 245 245 echo '<option ' . ($style == 1 ? 'selected="selected"' : '') . 246 246 'value="1">Flags</option>'; 247 247 248 248 echo '</select></label></p> 249 249 <input type="hidden" name="transposh-submit" id="transposh-submit" value="1" />'; 250 251 } 252 250 251 } 253 252 254 253 //Register callback for WordPress events … … 256 255 add_action('widgets_init', 'transposh_widget_init'); 257 256 258 259 257 ?>
Note: See TracChangeset
for help on using the changeset viewer.
