Changeset 18464 for trunk/wp-includes/script-loader.php
- Timestamp:
- 07/25/2011 12:36:06 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/script-loader.php
r18453 r18464 59 59 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; 60 60 61 // Always ensure that we have the convertEntities function62 $scripts->add( 'l10n', "/wp-includes/js/l10n$suffix.js", false, '20101110' );63 $scripts->enqueue( 'l10n' );64 65 61 $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20101110' ); 66 62 67 63 $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20110711' ); 68 64 $scripts->add_data( 'common', 'group', 1 ); 69 $scripts->localize( 'common', 'commonL10n', array( 70 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."), 71 'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};' 65 $scripts->add_script_data( 'common', 'commonL10n', array( 66 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete.") 72 67 ) ); 73 68 … … 77 72 $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", false, '20110502' ); 78 73 $scripts->add_data( 'quicktags', 'group', 1 ); 79 $scripts-> localize( 'quicktags', 'quicktagsL10n', array(74 $scripts->add_script_data( 'quicktags', 'quicktagsL10n', array( 80 75 'quickLinks' => __('(Quick Links)'), 81 76 'wordLookup' => __('Enter a word to look up:'), … … 88 83 'enterImageDescription' => __('Enter a description of the image'), 89 84 'fullscreen' => __('fullscreen'), 90 'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') ), 91 'l10n_print_after' => 'try{convertEntities(quicktagsL10n);}catch(e){};' 85 'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') ) 92 86 ) ); 93 87 … … 104 98 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), '20091119' ); 105 99 $scripts->add_data( 'wp-ajax-response', 'group', 1 ); 106 $scripts-> localize( 'wp-ajax-response', 'wpAjax', array(100 $scripts->add_script_data( 'wp-ajax-response', 'wpAjax', array( 107 101 'noPerm' => __('You do not have permission to do that.'), 108 'broken' => __('An unidentified error has occurred.'), 109 'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};' 102 'broken' => __('An unidentified error has occurred.') 110 103 ) ); 111 104 … … 193 186 $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20110528'); 194 187 $scripts->add_data( 'thickbox', 'group', 1 ); 195 $scripts-> localize( 'thickbox', 'thickboxL10n', array(188 $scripts->add_script_data( 'thickbox', 'thickboxL10n', array( 196 189 'next' => __('Next >'), 197 190 'prev' => __('< Prev'), … … 201 194 'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'), 202 195 'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'), 203 'closeImage' => includes_url('js/thickbox/tb-close.png'), 204 'l10n_print_after' => 'try{convertEntities(thickboxL10n);}catch(e){};' 196 'closeImage' => includes_url('js/thickbox/tb-close.png') 205 197 ) ); 206 198 … … 226 218 $max_upload_size = __('not configured'); 227 219 // these error messages came from the sample swfupload js, they might need changing. 228 $scripts-> localize( 'swfupload-handlers', 'swfuploadL10n', array(220 $scripts->add_script_data( 'swfupload-handlers', 'swfuploadL10n', array( 229 221 'queue_limit_exceeded' => __('You have attempted to queue too many files.'), 230 222 'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'), … … 243 235 'crunching' => __('Crunching…'), 244 236 'deleted' => __('moved to the trash.'), 245 'error_uploading' => __('“%s” has failed to upload due to an error'), 246 'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};', 237 'error_uploading' => __('“%s” has failed to upload due to an error') 247 238 ) ); 248 239 … … 256 247 $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20101027' ); 257 248 $scripts->add_data( 'password-strength-meter', 'group', 1 ); 258 $scripts-> localize( 'password-strength-meter', 'pwsL10n', array(249 $scripts->add_script_data( 'password-strength-meter', 'pwsL10n', array( 259 250 'empty' => __('Strength indicator'), 260 251 'short' => __('Very weak'), … … 263 254 'good' => _x('Medium', 'password strength'), 264 255 'strong' => __('Strong'), 265 'mismatch' => __('Mismatch'), 266 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 256 'mismatch' => __('Mismatch') 267 257 ) ); 268 258 … … 275 265 $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), '20110528' ); 276 266 $scripts->add_data( 'wplink', 'group', 1 ); 277 $scripts-> localize( 'wplink', 'wpLinkL10n', array(267 $scripts->add_script_data( 'wplink', 'wpLinkL10n', array( 278 268 'title' => __('Insert/edit link'), 279 269 'update' => __('Update'), 280 270 'save' => __('Add Link'), 281 271 'noTitle' => __('(no title)'), 282 'noMatchesFound' => __('No matches found.'), 283 'l10n_print_after' => 'try{convertEntities(wpLinkL10n);}catch(e){};', 272 'noMatchesFound' => __('No matches found.') 284 273 ) ); 285 274 … … 293 282 $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ), '20090102' ); 294 283 $scripts->add_data( 'ajaxcat', 'group', 1 ); 295 $scripts-> localize( 'ajaxcat', 'catL10n', array(284 $scripts->add_script_data( 'ajaxcat', 'catL10n', array( 296 285 'add' => esc_attr(__('Add')), 297 'how' => __('Separate multiple categories with commas.'), 298 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};' 286 'how' => __('Separate multiple categories with commas.') 299 287 ) ); 300 288 … … 304 292 $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), '20110429' ); 305 293 $scripts->add_data( 'admin-tags', 'group', 1 ); 306 $scripts-> localize( 'admin-tags', 'tagsl10n', array(294 $scripts->add_script_data( 'admin-tags', 'tagsl10n', array( 307 295 'noPerm' => __('You do not have permission to do that.'), 308 'broken' => __('An unidentified error has occurred.'), 309 'l10n_print_after' => 'try{convertEntities(tagsl10n);}catch(e){};' 296 'broken' => __('An unidentified error has occurred.') 310 297 )); 311 298 … … 315 302 $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110602' ); 316 303 $scripts->add_data( 'admin-comments', 'group', 1 ); 317 $scripts-> localize( 'admin-comments', 'adminCommentsL10n', array(304 $scripts->add_script_data( 'admin-comments', 'adminCommentsL10n', array( 318 305 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 319 306 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']), … … 330 317 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524' ); 331 318 $scripts->add_data( 'post', 'group', 1 ); 332 $scripts-> localize( 'post', 'postL10n', array(319 $scripts->add_script_data( 'post', 'postL10n', array( 333 320 'tagsUsed' => __('Tags used on this post:'), 334 321 'add' => esc_attr(__('Add')), … … 353 340 'password' => __('Password Protected'), 354 341 'privatelyPublished' => __('Privately Published'), 355 'published' => __('Published'), 356 'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};' 342 'published' => __('Published') 357 343 ) ); 358 344 … … 362 348 $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery'), '20110429' ); 363 349 $scripts->add_data( 'comment', 'group', 1 ); 364 $scripts-> localize( 'comment', 'commentL10n', array(350 $scripts->add_script_data( 'comment', 'commentL10n', array( 365 351 'cancel' => __('Cancel'), 366 352 'edit' => __('Edit'), 367 'submittedOn' => __('Submitted on:'), 368 'l10n_print_after' => 'try{convertEntities(commentL10n);}catch(e){};' 353 'submittedOn' => __('Submitted on:') 369 354 ) ); 370 355 … … 388 373 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), '20110609' ); 389 374 $scripts->add_data( 'inline-edit-post', 'group', 1 ); 390 $scripts-> localize( 'inline-edit-post', 'inlineEditL10n', array(375 $scripts->add_script_data( 'inline-edit-post', 'inlineEditL10n', array( 391 376 'error' => __('Error while saving the changes.'), 392 377 'ntdeltitle' => __('Remove From Bulk Edit'), 393 'notitle' => __('(no title)'), 394 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 378 'notitle' => __('(no title)') 395 379 ) ); 396 380 397 381 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), '20110609' ); 398 382 $scripts->add_data( 'inline-edit-tax', 'group', 1 ); 399 $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 400 'error' => __('Error while saving the changes.'), 401 'l10n_print_after' => 'try{convertEntities(inlineEditL10n);}catch(e){};' 383 $scripts->add_script_data( 'inline-edit-tax', 'inlineEditL10n', array( 384 'error' => __('Error while saving the changes.') 402 385 ) ); 403 386 404 387 $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), '20110113' ); 405 388 $scripts->add_data( 'plugin-install', 'group', 1 ); 406 $scripts-> localize( 'plugin-install', 'plugininstallL10n', array(389 $scripts->add_script_data( 'plugin-install', 'plugininstallL10n', array( 407 390 'plugin_information' => __('Plugin Information:'), 408 'ays' => __('Are you sure you want to install this plugin?'), 409 'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};' 391 'ays' => __('Are you sure you want to install this plugin?') 410 392 ) ); 411 393 … … 428 410 $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20100518' ); 429 411 $scripts->add_data( 'set-post-thumbnail', 'group', 1 ); 430 $scripts-> localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(412 $scripts->add_script_data( 'set-post-thumbnail', 'setPostThumbnailL10n', array( 431 413 'setThumbnail' => __( 'Use as featured image' ), 432 414 'saving' => __( 'Saving...' ), 433 415 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ), 434 'done' => __( 'Done' ), 435 'l10n_print_after' => 'try{convertEntities(setPostThumbnailL10n);}catch(e){};' 416 'done' => __( 'Done' ) 436 417 ) ); 437 418 438 419 // Navigation Menus 439 420 $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array('jquery-ui-sortable'), '20110524' ); 440 $scripts-> localize( 'nav-menu', 'navMenuL10n', array(421 $scripts->add_script_data( 'nav-menu', 'navMenuL10n', array( 441 422 'noResultsFound' => _x('No results found.', 'search results'), 442 423 'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ), 443 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'), 444 'l10n_print_after' => 'try{convertEntities(navMenuL10n);}catch(e){};' 424 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.') 445 425 ) ); 446 426 … … 475 455 $styles->default_version = get_bloginfo( 'version' ); 476 456 $styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr'; 477 $styles->default_dirs = array('/wp-admin/', '/wp-includes/ ');457 $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/'); 478 458 479 459 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; … … 559 539 function wp_just_in_time_script_localization() { 560 540 561 wp_ localize_script( 'autosave', 'autosaveL10n', array(541 wp_add_script_data( 'autosave', 'autosaveL10n', array( 562 542 'autosaveInterval' => AUTOSAVE_INTERVAL, 563 543 'savingText' => __('Saving Draft…'), 564 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'), 565 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};' 544 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.') 566 545 ) ); 567 546 … … 636 615 637 616 script_concat_settings(); 638 $wp_scripts->do_items( 'l10n' );639 617 $wp_scripts->do_concat = $concatenate_scripts; 640 618 $wp_scripts->do_head_items(); … … 648 626 649 627 /** 650 * Prints the scripts that were queued for the footer o n admin pages.628 * Prints the scripts that were queued for the footer or too late for the HTML head. 651 629 * 652 630 * @since 2.8 … … 654 632 function print_footer_scripts() { 655 633 global $wp_scripts, $concatenate_scripts; 656 657 if ( ! did_action('wp_print_footer_scripts') )658 do_action('wp_print_footer_scripts');659 634 660 635 if ( !is_a($wp_scripts, 'WP_Scripts') ) … … 672 647 } 673 648 649 /** 650 * @internal use 651 */ 674 652 function _print_scripts() { 675 653 global $wp_scripts, $compress_scripts; … … 682 660 683 661 if ( !empty($wp_scripts->print_code) ) { 684 echo " <script type='text/javascript'>\n";685 echo "/* <![CDATA[ */\n"; 662 echo "\n<script type='text/javascript'>\n"; 663 echo "/* <![CDATA[ */\n"; // not needed in HTML 5 686 664 echo $wp_scripts->print_code; 687 665 echo "/* ]]> */\n"; … … 719 697 720 698 /** 721 * Prints the scripts that were queued for the footer on the front end.699 * Hooks to print the scripts and styles in the footer. 722 700 * 723 701 * @since 2.8 … … 726 704 print_late_styles(); 727 705 print_footer_scripts(); 706 707 if ( !is_admin() ) 708 do_action('wp_print_footer_scripts'); 709 728 710 return true; 729 711 } … … 741 723 } 742 724 725 /** 726 * Prints the styles queue in the HTML head on admin pages. 727 * 728 * @since 2.8 729 */ 743 730 function print_admin_styles() { 744 731 global $wp_styles, $concatenate_scripts, $compress_css; … … 762 749 } 763 750 751 /** 752 * Prints the styles that were queued too late for the HTML head. 753 * 754 * @since 3.3 755 */ 764 756 function print_late_styles() { 765 757 global $wp_styles, $concatenate_scripts; … … 778 770 } 779 771 772 /** 773 * @internal use 774 */ 780 775 function _print_styles() { 781 776 global $wp_styles, $compress_css; … … 790 785 $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . "&ver=$ver"; 791 786 echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n"; 787 788 if ( !empty($wp_styles->print_code) ) { 789 echo "<style type='text/css'>\n"; 790 echo $wp_styles->print_code; 791 echo "\n</style>\n"; 792 } 792 793 } 793 794 … … 796 797 } 797 798 799 /** 800 * Determine the concatenation and compression settings for scripts and styles. 801 * 802 * @since 2.8 803 */ 798 804 function script_concat_settings() { 799 805 global $concatenate_scripts, $compress_scripts, $compress_css;
Note: See TracChangeset
for help on using the changeset viewer.