Changeset 100
- Timestamp:
- 03/24/2009 07:54:48 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/transposh_admin.php
r69 r100 20 20 * Provide the admin page for configuring the translation options. eg. what languages ? 21 21 * who is allowed to translate ? 22 *23 22 */ 24 23 … … 26 25 require_once("constants.php"); 27 26 28 29 27 /* 30 28 * Add transposh to the admin menu. 31 *32 29 */ 33 30 function transposh_admin_menu() … … 36 33 } 37 34 38 39 35 /* 40 36 * Create the admin page. 41 *42 37 */ 43 38 function transposh_admin_page() … … 73 68 /* 74 69 * Insert supported languages section in admin page 75 *76 70 */ 77 71 function insert_supported_langs() … … 79 73 global $languages, $plugin_url; 80 74 81 echo ' 82 <script type="text/javascript" > 83 function chbx_change(lang) 84 { 85 var view = lang + "_view"; 86 if(document.getElementById(view).checked) 87 { 88 var edit = lang + "_edit"; 89 document.getElementById(edit).checked = true; 90 } 91 92 } 93 </script> 94 95 <table> 96 <tr>'; 97 75 echo '<script type="text/javascript">'. 76 'function chbx_change(lang)'. 77 '{'. 78 'var view = lang + "_view";'. 79 'if(document.getElementById(view).checked)'. 80 '{'. 81 'var edit = lang + "_edit";'. 82 'document.getElementById(edit).checked = true;'. 83 '}'. 84 '}'. 85 '</script>'; 86 echo '<table><tr>'; 98 87 99 88 $columns = 2; … … 101 90 for($hdr=0; $hdr < $columns; $hdr++) 102 91 { 103 echo '<th>Language</th><th>Viewable</th><th>Translatable</th> 104 <th>Default</th><th style="padding-right: 80px"></th>';92 echo '<th>Language</th><th>Viewable</th><th>Translatable</th>'. 93 '<th>Default</th><th style="padding-right: 80px"></th>'; 105 94 } 106 95 … … 112 101 if($i % $columns == 0) 113 102 { 114 echo '< /tr>';103 echo '<tr>'; 115 104 } 116 105 echo "\n"; … … 118 107 $i++; 119 108 120 echo "<td><img src=\"$plugin_url/flags/$flag.png\" /> $language</td>";109 echo "<td><img src=\"$plugin_url/flags/$flag.png\" alt=\"\"/> $language</td>"; 121 110 echo '<td align="center"> <input type="checkbox" id="' . $code .'_view" name="' . 122 $code . '_view" onChange="chbx_change(\'' . $code . '\')" ' . is_viewable($code) . '/></td>';111 $code . '_view" onChange="chbx_change(\'' . $code . '\')" ' . is_viewable($code) . '/></td>'; 123 112 echo "\n"; 124 113 echo '<td align="center"> <input type="checkbox" id="' . $code . '_edit" name="' . 125 114 $code . '_edit" ' . is_editable($code). '/></td>'; 126 115 echo "\n"; 127 echo "<td align=\"center\"><input type=\"radio\" name=\"default_lang\" value=\"$code\" " .128 is_default_lang($code). "/> </td>";116 echo "<td align=\"center\"><input type=\"radio\" name=\"default_lang\" value=\"$code\" " . 117 is_default_lang($code). "/></td>"; 129 118 130 119 if($i % $columns == 0) … … 134 123 else 135 124 { 136 echo "<td ><style padding-right: 60px></style></td>";125 echo "<td style=\"padding-right: 60px\"></td>"; 137 126 } 138 127 echo "\n"; … … 153 142 if(strstr($langs, $code)) 154 143 { 155 return "checked";144 return 'checked="checked"'; 156 145 } 157 146 … … 168 157 if(strstr($langs, $code)) 169 158 { 170 return "checked";159 return 'checked="checked"'; 171 160 } 172 161 … … 191 180 if($default == $code) 192 181 { 193 return "checked";182 return 'checked="checked"'; 194 183 } 195 184 … … 199 188 /* 200 189 * Insert permissiions section in the admin page 201 *202 190 */ 203 191 function insert_permissions() … … 209 197 { 210 198 echo '<input type="checkbox" value="1" name="' . $role_name . '" ' . can_translate($role_name) . 211 ' " />' . $role_name . '   </input>';199 '/>' . $role_name . ' '; 212 200 } 213 201 214 202 //Add our own custom role 215 echo '<input type="checkbox" value="1" name="anonymous" '.216 can_translate('anonymous') . ' " /> Anonymous</input>';203 echo '<input type="checkbox" value="1" name="anonymous" '. 204 can_translate('anonymous') . '/> Anonymous'; 217 205 } 218 206 … … 227 215 if(get_option(ENABLE_PERMALINKS_REWRITE)) 228 216 { 229 $checked = 'checked ';230 } 231 232 echo '<input type="checkbox" value="1" name="enable_permalinks" '. $checked . '"/>'.217 $checked = 'checked="checked"'; 218 } 219 220 echo '<input type="checkbox" value="1" name="enable_permalinks" '. $checked . '/>'. 233 221 'Rewrite URLs to be search engine friendly, '. 234 222 'e.g. (http://wordpress.org/<strong> en</strong>). '. 235 'Requires that permalinks will be enabled.'. 236 '</input>'; 223 'Requires that permalinks will be enabled.'; 237 224 } 238 225 … … 240 227 * Insert the option to enable/disable automatic translation. 241 228 * Enabled by default. 242 *243 229 */ 244 230 function insert_auto_translate_option() … … 247 233 if(get_option(ENABLE_AUTO_TRANSLATE,1)) 248 234 { 249 $checked = 'checked'; 250 } 251 252 echo '<input type="checkbox" value="1" name="enable_autotranslate"'.$checked.'"/>'. 253 'Allow automatic translation of pages (currently using Google Translate).'. 254 '</input>'; 235 $checked = 'checked="checked"'; 236 } 237 238 echo '<input type="checkbox" value="1" name="enable_autotranslate" '.$checked.'/>'. 239 'Allow automatic translation of pages (currently using Google Translate)'; 255 240 } 256 241 … … 267 252 if(isset($role) && $role->has_cap(TRANSLATOR)) 268 253 { 269 return 'checked ';254 return 'checked="checked"'; 270 255 } 271 256 } … … 275 260 if($allow_anonymous == "1") 276 261 { 277 return 'checked ';262 return 'checked="checked"'; 278 263 } 279 264 } … … 284 269 /* 285 270 * Handle newly posted admin options. 286 *287 271 */ 288 272 function update_admin_options() … … 351 335 } 352 336 353 echo '<div id="message" class="updated fade">';354 echo ('<p> Changes saved</p>');337 echo '<div id="message" class="updated fade">'; 338 echo '<p>Changes saved</p>'; 355 339 echo '</div>'; 356 340 }
Note: See TracChangeset
for help on using the changeset viewer.
