Changeset 10135
- Timestamp:
- 12/09/2008 02:50:28 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
wp-admin/admin-header.php (modified) (1 diff)
-
wp-includes/class.wp-scripts.php (modified) (1 diff)
-
wp-includes/script-loader.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-header.php
r10086 r10135 30 30 //<![CDATA[ 31 31 addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}}; 32 33 function convertEntities(o) { 34 var c = function(s) { 35 if (/&[^;]+;/.test(s)) { 36 var e = document.createElement("div"); 37 e.innerHTML = s; 38 return !e.firstChild ? s : e.firstChild.nodeValue; 39 } 40 return s; 41 } 42 43 if ( typeof o === 'string' ) 44 return c(o); 45 else if ( typeof o === 'object' ) 46 for (var v in o) { 47 if ( typeof o[v] === 'string' ) 48 o[v] = c(o[v]); 49 } 50 return o; 51 }; 32 52 //]]> 33 53 </script> -
trunk/wp-includes/class.wp-scripts.php
r10086 r10135 45 45 echo "<script type='text/javascript'>\n"; 46 46 echo "/* <![CDATA[ */\n"; 47 echo "function convertEntities(o) {\n";48 echo " var c = function(s) {\n";49 echo " if (/&[^;]+;/.test(s)) {\n";50 echo " var e = document.createElement('div');\n";51 echo " e.innerHTML = s;\n";52 echo " return !e.firstChild ? s : e.firstChild.nodeValue;\n";53 echo " }\n";54 echo " return s;\n";55 echo " }\n";56 echo " if ( typeof o === 'string' ) {\n";57 echo " return c(o);\n";58 echo " } else if ( typeof o === 'object' ) {\n";59 echo " for (var v in o) {\n";60 echo " if ( typeof o[v] === 'string' )\n";61 echo " o[v] = c(o[v]);\n";62 echo " }\n";63 echo " }\n";64 echo " return o;\n";65 echo "};\n";66 47 echo "\t$object_name = {\n"; 67 48 $eol = ''; 68 49 foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) { 50 if ( 'l10n_print_after' == $var ) { 51 $after = $val; 52 continue; 53 } 69 54 echo "$eol\t\t$var: \"" . js_escape( $val ) . '"'; 70 55 $eol = ",\n"; 71 56 } 72 57 echo "\n\t}\n"; 73 echo "try{convertEntities($object_name);}catch(e){};\n";58 echo isset($after) ? "\t$after\n" : ''; 74 59 echo "/* ]]> */\n"; 75 60 echo "</script>\n"; -
trunk/wp-includes/script-loader.php
r10133 r10135 55 55 'enterURL' => __('Enter the URL'), 56 56 'enterImageURL' => __('Enter the URL of the image'), 57 'enterImageDescription' => __('Enter a description of the image') 57 'enterImageDescription' => __('Enter a description of the image'), 58 'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};' 58 59 ) ); 59 60 … … 73 74 $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 74 75 'noPerm' => __('You do not have permission to do that.'), 75 'broken' => __('An unidentified error has occurred.') 76 'broken' => __('An unidentified error has occurred.'), 77 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};' 76 78 ) ); 77 79 … … 128 130 'dismiss' => __('Dismiss'), 129 131 'crunching' => __('Crunching…'), 130 'deleted' => __('Deleted') 132 'deleted' => __('Deleted'), 133 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};' 131 134 ) ); 132 135 … … 144 147 $scripts->localize( 'ajaxcat', 'catL10n', array( 145 148 'add' => attribute_escape(__('Add')), 146 'how' => __('Separate multiple categories with commas.') 149 'how' => __('Separate multiple categories with commas.'), 150 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};' 147 151 ) ); 148 152 $scripts->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20081117' ); … … 155 159 'bad' => __('Weak'), 156 160 'good' => _c('Medium|password strength'), 157 'strong' => __('Strong') 161 'strong' => __('Strong'), 162 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 158 163 ) ); 159 164 $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081206' ); … … 172 177 'requestFile' => admin_url('admin-ajax.php'), 173 178 'save' => __('Save'), 174 'cancel' => __('Cancel') 179 'cancel' => __('Cancel'), 180 'l10n_print_after' => 'try{convertEntities(slugL10n);}catch(e){};' 175 181 ) ); 176 182 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081128' ); … … 197 203 'password' => __('Password Protected'), 198 204 'privatelyPublished' => __('Privately Published'), 199 'published' => __('Published') 205 'published' => __('Published'), 206 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' 200 207 ) ); 201 208 $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081128' ); … … 217 224 'password' => __('Password Protected'), 218 225 'privatelyPublished' => __('Privately Published'), 219 'published' => __('Published') 226 'published' => __('Published'), 227 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' 220 228 ) ); 221 229 $scripts->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080925' ); … … 224 232 'cancel' => __('Cancel'), 225 233 'edit' => __('Edit'), 226 'submittedOn' => __('Submitted on:') 234 'submittedOn' => __('Submitted on:'), 235 'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};' 227 236 ) ); 228 237 $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20081127' ); … … 235 244 'cancel' => __('Cancel'), 236 245 'lameReminder' => __('Remember to click the "Save Changes" button at the bottom of the Current Widgets column after you\'re all done!'), 237 'lamerReminder' => __("You're about to leave without having saved your changes!") 246 'lamerReminder' => __("You're about to leave without having saved your changes!"), 247 'l10n_print_after' => 'try{convertEntities(widgetsL10n);}catch(e){};' 238 248 )); 239 249 240 250 $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20080423' ); 241 251 $scripts->localize( 'word-count', 'wordCountL10n', array( 242 'count' => __('Word count: %d') 252 'count' => __('Word count: %d'), 253 'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};' 243 254 )); 244 255 … … 246 257 $scripts->localize( 'wp-gears', 'wpGearsL10n', array( 247 258 'updateCompleted' => __('Update completed.'), 248 'error' => __('Error:') 259 'error' => __('Error:'), 260 'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};' 249 261 )); 250 262 … … 255 267 'error' => __('Error while saving the changes.'), 256 268 'ntdeltitle' => __('Remove From Bulk Edit'), 257 'notitle' => __('(no title)') 269 'notitle' => __('(no title)'), 270 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 258 271 ) ); 259 272 260 273 $scripts->add( 'inline-edit-tax', '/wp-admin/js/inline-edit-tax.js', array( 'jquery', 'jquery-form' ), '20081206' ); 261 274 $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 262 'error' => __('Error while saving the changes.') 275 'error' => __('Error while saving the changes.'), 276 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 263 277 ) ); 264 278 265 279 $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20080803' ); 266 280 $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 267 'plugin_information' => __('Plugin Information:') 281 'plugin_information' => __('Plugin Information:'), 282 'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};' 268 283 ) ); 269 284 … … 371 386 'previewPostText' => __('Preview this Post'), 372 387 'requestFile' => admin_url('admin-ajax.php'), 373 'savingText' => __('Saving Draft…') 388 'savingText' => __('Saving Draft…'), 389 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};' 374 390 ) ); 375 391
Note: See TracChangeset
for help on using the changeset viewer.