Changeset 21132
- Timestamp:
- 06/26/2012 05:33:19 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/load-scripts.php
r19684 r21132 51 51 */ 52 52 function add_action() {} 53 54 /** 55 * @ignore 56 */ 57 function did_action() {} 53 58 54 59 /** -
trunk/wp-includes/class.wp-scripts.php
r20000 r21132 32 32 33 33 function __construct() { 34 if ( ! function_exists( 'did_action' ) || did_action( 'init' ) ) 35 $this->init(); 36 else 37 add_action( 'init', array( $this, 'init' ), 0 ); 34 $this->init(); 35 add_action( 'init', array( $this, 'init' ), 0 ); 38 36 } 39 37 -
trunk/wp-includes/script-loader.php
r21031 r21132 63 63 64 64 $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 ); 65 $scripts->localize( 'common', 'commonL10n', array(65 did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array( 66 66 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete.") 67 67 ) ); … … 70 70 71 71 $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 ); 72 $scripts->localize( 'quicktags', 'quicktagsL10n', array(72 did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array( 73 73 'wordLookup' => __('Enter a word to look up:'), 74 74 'dictionaryLookup' => esc_attr(__('Dictionary lookup')), … … 94 94 95 95 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 ); 96 $scripts->localize( 'wp-ajax-response', 'wpAjax', array(96 did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 97 97 'noPerm' => __('You do not have permission to do that.'), 98 98 'broken' => __('An unidentified error has occurred.') … … 100 100 101 101 $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 ); 102 $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(102 did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array( 103 103 'dismiss' => __('Dismiss'), 104 104 ) ); … … 171 171 172 172 $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20111117', 1 ); 173 $scripts->localize( 'thickbox', 'thickboxL10n', array(173 did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array( 174 174 'next' => __('Next >'), 175 175 'prev' => __('< Prev'), … … 228 228 229 229 $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery') ); 230 $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );230 did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n ); 231 231 232 232 $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array('plupload-all', 'jquery', 'json2') ); 233 $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );233 did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n ); 234 234 235 235 // keep 'swfupload' for back-compat. … … 247 247 248 248 $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524'); 249 $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );249 did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n ); 250 250 251 251 $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js" ); … … 256 256 257 257 $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), false, 1 ); 258 $scripts->localize( 'password-strength-meter', 'pwsL10n', array(258 did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array( 259 259 'empty' => __('Strength indicator'), 260 260 'short' => __('Very weak'), … … 273 273 274 274 $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), false, 1 ); 275 $scripts->localize( 'wplink', 'wpLinkL10n', array(275 did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array( 276 276 'title' => __('Insert/edit link'), 277 277 'update' => __('Update'), … … 286 286 287 287 $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), false, 1 ); 288 $scripts->localize( 'word-count', 'wordCountL10n', array(288 did_action( 'init' ) && $scripts->localize( 'word-count', 'wordCountL10n', array( 289 289 /* translators: If your word count is based on single characters (East Asian characters), 290 290 enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */ … … 300 300 $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'customize-base' ), false, 1 ); 301 301 $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base' ), false, 1 ); 302 $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(302 did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array( 303 303 'activate' => __( 'Save & Activate' ), 304 304 'save' => __( 'Save & Publish' ), … … 312 312 $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ) ); 313 313 $scripts->add_data( 'ajaxcat', 'group', 1 ); 314 $scripts->localize( 'ajaxcat', 'catL10n', array(314 did_action( 'init' ) && $scripts->localize( 'ajaxcat', 'catL10n', array( 315 315 'add' => esc_attr(__('Add')), 316 316 'how' => __('Separate multiple categories with commas.') … … 320 320 321 321 $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), false, 1 ); 322 $scripts->localize( 'admin-tags', 'tagsl10n', array(322 did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array( 323 323 'noPerm' => __('You do not have permission to do that.'), 324 324 'broken' => __('An unidentified error has occurred.') … … 328 328 329 329 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 ); 330 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(330 did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 331 331 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 332 332 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']), … … 340 340 341 341 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), false, 1 ); 342 $scripts->localize( 'post', 'postL10n', array(342 did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array( 343 343 'ok' => __('OK'), 344 344 'cancel' => __('Cancel'), … … 366 366 $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery') ); 367 367 $scripts->add_data( 'comment', 'group', 1 ); 368 $scripts->localize( 'comment', 'commentL10n', array(368 did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array( 369 369 'submittedOn' => __('Submitted on:') 370 370 ) ); … … 380 380 381 381 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 ); 382 $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(382 did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 383 383 'error' => __('Error while saving the changes.'), 384 384 'ntdeltitle' => __('Remove From Bulk Edit'), … … 388 388 389 389 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 ); 390 $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(390 did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 391 391 'error' => __('Error while saving the changes.') 392 392 ) ); 393 393 394 394 $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), false, 1 ); 395 $scripts->localize( 'plugin-install', 'plugininstallL10n', array(395 did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 396 396 'plugin_information' => __('Plugin Information:'), 397 397 'ays' => __('Are you sure you want to install this plugin?') … … 407 407 408 408 $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 ); 409 $scripts->localize( 'image-edit', 'imageEditL10n', array(409 did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array( 410 410 'error' => __( 'Could not load the preview image. Please reload the page and try again.' ) 411 411 )); 412 412 413 413 $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 ); 414 $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(414 did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array( 415 415 'setThumbnail' => __( 'Use as featured image' ), 416 416 'saving' => __( 'Saving...' ), … … 421 421 // Navigation Menus 422 422 $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array('jquery-ui-sortable') ); 423 $scripts->localize( 'nav-menu', 'navMenuL10n', array(423 did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array( 424 424 'noResultsFound' => _x('No results found.', 'search results'), 425 425 'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
Note: See TracChangeset
for help on using the changeset viewer.