Changeset 18464
- Timestamp:
- 07/25/2011 12:36:06 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/load-styles.php
r17630 r18464 126 126 } 127 127 128 $out .= str_replace( '../images/', 'images/', $content ); 128 if ( strpos( $style->src, '/wp-includes/css/' ) === 0 ) 129 $out .= str_replace( '../images/', '../wp-includes/images/', $content ); 130 else 131 $out .= str_replace( '../images/', 'images/', $content ); 129 132 } 130 133 -
trunk/wp-includes/class.wp-scripts.php
r18446 r18464 48 48 } 49 49 50 // Deprecated since 3.3, see print_script_data() 50 51 function print_scripts_l10n( $handle, $echo = true ) { 51 if ( empty($this->registered[$handle]->extra['l10n']) || empty($this->registered[$handle]->extra['l10n'][0]) || !is_array($this->registered[$handle]->extra['l10n'][1]) ) 52 return false; 53 54 $object_name = $this->registered[$handle]->extra['l10n'][0]; 55 56 $data = "var $object_name = {\n"; 57 $eol = ''; 58 foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) { 59 if ( 'l10n_print_after' == $var ) { 60 $after = $val; 61 continue; 52 _deprecated_function( __FUNCTION__, '3.3', 'print_script_data()' ); 53 return $this->print_script_data( $handle, $echo, true ); 54 } 55 56 function print_script_data( $handle, $echo = true, $_l10n = false ) { 57 if ( empty($this->registered[$handle]->extra['data']) ) 58 return false; 59 60 if ( $_l10n ) { 61 $name = $this->registered[$handle]->extra['l10n'][0]; 62 $data = $this->registered[$handle]->extra['l10n'][1]; 63 $after = ''; 64 65 if ( is_array($data) && isset($data['l10n_print_after']) ) { 66 $after = $data['l10n_print_after']; 67 unset($data['l10n_print_after']); 62 68 } 63 $data .= "$eol\t$var: \"" . esc_js( $val ) . '"'; 64 $eol = ",\n"; 65 } 66 $data .= "\n};\n"; 67 $data .= isset($after) ? "$after\n" : ''; 68 69 if ( $echo ) { 70 echo "<script type='text/javascript'>\n"; 71 echo "/* <![CDATA[ */\n"; 72 echo $data; 73 echo "/* ]]> */\n"; 74 echo "</script>\n"; 75 return true; 69 $output = "var $name = " . json_encode($data) . "; $after\n"; 76 70 } else { 77 return $data; 78 } 71 foreach ( (array) $this->registered[$handle]->extra['data'] as $name => $data ) { 72 $output = "var $name = " . json_encode($data) . ";\n"; 73 } 74 } 75 76 if ( !$echo ) 77 return $output; 78 79 echo "<script type='text/javascript'>\n"; 80 echo "/* <![CDATA[ */\n"; // not needed in HTML 5 81 echo $output; 82 echo "\n/* ]]> */"; 83 echo "\n</script>\n"; 84 85 return true; 79 86 } 80 87 … … 104 111 $srce = apply_filters( 'script_loader_src', $src, $handle ); 105 112 if ( $this->in_default_dir($srce) ) { 106 $this->print_code .= $this->print_script s_l10n( $handle, false );113 $this->print_code .= $this->print_script_data( $handle, false ); 107 114 $this->concat .= "$handle,"; 108 115 $this->concat_version .= "$handle$ver"; … … 114 121 } 115 122 116 $this->print_script s_l10n( $handle );123 $this->print_script_data( $handle ); 117 124 if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) { 118 125 $src = $this->base_url . $src; … … 132 139 133 140 /** 134 * Localizes a script 141 * Localizes a script (Deprecated) 135 142 * 136 143 * Localizes only if script has already been added 137 144 * 138 * @param string $handle Script name 139 * @param string $object_name Name of JS object to hold l10n info 140 * @param array $l10n Array of JS var name => localized string 141 * @return bool Successful localization 145 * @since 146 * @deprecated WP 3.3 142 147 */ 143 148 function localize( $handle, $object_name, $l10n ) { 144 if ( !$object_name || !$l10n ) 145 return false; 146 return $this->add_data( $handle, 'l10n', array( $object_name, $l10n ) ); 149 _deprecated_function( __FUNCTION__, '3.3', 'add_script_data()' ); 150 return $this->add_script_data( $handle, $object_name, $l10n ); 151 } 152 153 /** 154 * Add extra Javascript 155 * 156 * Only if script has already been added. 157 * 158 * @param string $handle Script name 159 * @param string $name Name of JS object to hold the data 160 * @param array $data Associative array of JS name => value 161 * @return bool Successful or not 162 */ 163 function add_script_data( $handle, $name, $data ) { 164 if ( !$name || !is_array($data) ) 165 return false; 166 167 if ( !empty( $this->registered[$handle]->extra['data'][$name] ) ) 168 $data = array_merge( $data, (array) $this->registered[$handle]->extra['data'][$name] ); 169 170 return $this->add_data( $handle, 'data', array( $name => $data ) ); 147 171 } 148 172 -
trunk/wp-includes/class.wp-styles.php
r18446 r18464 26 26 var $do_concat = false; 27 27 var $print_html = ''; 28 var $print_code = ''; 28 29 var $default_dirs; 29 30 … … 36 37 return false; 37 38 38 if ( null === $this->registered[$handle]->ver ) 39 $obj = $this->registered[$handle]; 40 if ( null === $obj->ver ) 39 41 $ver = ''; 40 42 else 41 $ver = $ this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;43 $ver = $obj->ver ? $obj->ver : $this->default_version; 42 44 43 45 if ( isset($this->args[$handle]) ) … … 45 47 46 48 if ( $this->do_concat ) { 47 if ( $this->in_default_dir($ this->registered[$handle]->src) && !isset($this->registered[$handle]->extra['conditional']) && !isset($this->registered[$handle]->extra['alt']) ) {49 if ( $this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt']) ) { 48 50 $this->concat .= "$handle,"; 49 51 $this->concat_version .= "$handle$ver"; 52 53 if ( !empty($this->registered[$handle]->extra['data']) ) 54 $this->print_code .= $this->registered[$handle]->extra['data']; 55 50 56 return true; 51 57 } 52 58 } 53 59 54 if ( isset($ this->registered[$handle]->args) )55 $media = esc_attr( $ this->registered[$handle]->args );60 if ( isset($obj->args) ) 61 $media = esc_attr( $obj->args ); 56 62 else 57 63 $media = 'all'; 58 64 59 $href = $this->_css_href( $ this->registered[$handle]->src, $ver, $handle );60 $rel = isset($ this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';61 $title = isset($ this->registered[$handle]->extra['title']) ? "title='" . esc_attr( $this->registered[$handle]->extra['title'] ) . "'" : '';65 $href = $this->_css_href( $obj->src, $ver, $handle ); 66 $rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; 67 $title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : ''; 62 68 63 69 $end_cond = $tag = ''; 64 if ( isset($ this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {65 $tag .= "<!--[if {$ this->registered[$handle]->extra['conditional']}]>\n";70 if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) { 71 $tag .= "<!--[if {$obj->extra['conditional']}]>\n"; 66 72 $end_cond = "<![endif]-->\n"; 67 73 } 68 74 69 75 $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle ); 70 if ( 'rtl' === $this->text_direction && isset($ this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) {71 if ( is_bool( $ this->registered[$handle]->extra['rtl'] ) ) {72 $suffix = isset( $ this->registered[$handle]->extra['suffix'] ) ? $this->registered[$handle]->extra['suffix'] : '';73 $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $ this->registered[$handle]->src , $ver, "$handle-rtl" ));76 if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) { 77 if ( is_bool( $obj->extra['rtl'] ) ) { 78 $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : ''; 79 $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $obj->src , $ver, "$handle-rtl" )); 74 80 } else { 75 $rtl_href = $this->_css_href( $ this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );81 $rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" ); 76 82 } 77 83 … … 81 87 $tag .= $end_cond; 82 88 83 if ( $this->do_concat ) 89 if ( $this->do_concat ) { 84 90 $this->print_html .= $tag; 85 else 91 $this->print_html .= $this->print_inline_style( $handle, false ); 92 } else { 86 93 echo $tag; 94 $this->print_inline_style( $handle ); 95 } 87 96 88 // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules 89 // echo "<style type='text/css'>\n"; 90 // echo "/* <![CDATA[ */\n"; 91 // echo "/* ]]> */\n"; 92 // echo "</style>\n"; 97 return true; 98 } 99 100 function add_inline_style( $handle, $data ) { 101 if ( !$data ) 102 return false; 103 104 if ( !empty( $this->registered[$handle]->extra['data'] ) ) 105 $data .= "\n" . $this->registered[$handle]->extra['data']; 106 107 return $this->add_data( $handle, 'data', $data ); 108 } 109 110 function print_inline_style( $handle, $echo = true ) { 111 if ( empty($this->registered[$handle]->extra['data']) ) 112 return false; 113 114 $output = $this->registered[$handle]->extra['data']; 115 116 if ( !$echo ) 117 return $output; 118 119 echo "<style type='text/css'>\n"; 120 echo "$output\n"; 121 echo "</style>\n"; 93 122 94 123 return true; -
trunk/wp-includes/deprecated.php
r18254 r18464 2616 2616 return true; 2617 2617 } 2618 2619 /** 2620 * Localizes a script. 2621 * 2622 * Localizes only if script has already been added. 2623 * 2624 * @since r16 2625 * @deprecated WP 3.3 2626 * @see wp_add_script_data() 2627 */ 2628 function wp_localize_script( $handle, $object_name, $l10n ) { 2629 _deprecated_function( __FUNCTION__, '3.3', 'wp_add_script_data()' ); 2630 return wp_add_script_data( $handle, $object_name, $l10n ); 2631 } 2632 -
trunk/wp-includes/functions.wp-scripts.php
r15601 r18464 27 27 if ( !is_a($wp_scripts, 'WP_Scripts') ) { 28 28 if ( !$handles ) 29 return array(); // No need to instantiate if nothing 's there.29 return array(); // No need to instantiate if nothing is there. 30 30 else 31 31 $wp_scripts = new WP_Scripts(); … … 36 36 37 37 /** 38 * Register new Java Script file.38 * Register new Javascript file. 39 39 * 40 40 * @since r16 … … 57 57 58 58 /** 59 * Localizes ascript.59 * Adds extra Javascript. 60 60 * 61 * Localizes only if script has already been added. 62 * 63 * @since r16 64 * @see WP_Scripts::localize() 61 * Works only if the script has already been added. 62 * Accepts an associative array $data and creates JS object: 63 * "$name" = { 64 * key: value, 65 * key: value, 66 * ... 67 * } 68 * The $name is passed directly so it should be qualified JS variable /[a-zA-Z0-9_]+/ 69 * The $data array is JSON encoded. If called more than once for the same $handle, with the same $name, 70 * the object would contain all values. In that case if two or more keys are the same, 71 * the first value is kept and subsequent values are ignored. 72 * 73 * @since 3.3 74 * @see WP_Scripts::add_script_data() 65 75 */ 66 function wp_ localize_script( $handle, $object_name, $l10n) {76 function wp_add_script_data( $handle, $name, $data ) { 67 77 global $wp_scripts; 68 78 if ( !is_a($wp_scripts, 'WP_Scripts') ) 69 79 return false; 70 80 71 return $wp_scripts-> localize( $handle, $object_name, $l10n);81 return $wp_scripts->add_script_data( $handle, $name, $data ); 72 82 } 73 83 -
trunk/wp-includes/functions.wp-styles.php
r15601 r18464 26 26 if ( !is_a($wp_styles, 'WP_Styles') ) { 27 27 if ( !$handles ) 28 return array(); // No need to instantiate if nothing 's there.28 return array(); // No need to instantiate if nothing is there. 29 29 else 30 30 $wp_styles = new WP_Styles(); … … 32 32 33 33 return $wp_styles->do_items( $handles ); 34 } 35 36 /** 37 * Adds extra CSS. 38 * 39 * Works only if the stylesheet has already been added. 40 * Accepts a string $data containing the CSS. 41 * 42 * @since 3.3 43 * @see WP_Scripts::add_inline_style() 44 */ 45 function wp_add_inline_style( $handle, $data ) { 46 global $wp_styles; 47 if ( !is_a($wp_styles, 'WP_Styles') ) 48 return false; 49 50 return $wp_styles->add_inline_style( $handle, $data ); 34 51 } 35 52 -
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.