Ticket #7649: 7649.r8780.diff
File 7649.r8780.diff, 4.1 KB (added by , 16 years ago) |
---|
-
script-loader.php
1 1 <?php 2 /** 3 * WordPress scripts and styles default loader. 4 * 5 * Most of the functionality that existed here was moved to 6 * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and 7 * plugins will only be concerned about the filters and actions set in this 8 * file. 9 * 10 * @package WordPress 11 */ 2 12 13 /** BackPress: WordPress Dependencies Class */ 3 14 require( ABSPATH . WPINC . '/class.wp-dependencies.php' ); 15 16 /** BackPress: WordPress Scripts Class */ 4 17 require( ABSPATH . WPINC . '/class.wp-scripts.php' ); 18 19 /** BackPress: WordPress Scripts Functions */ 5 20 require( ABSPATH . WPINC . '/functions.wp-scripts.php' ); 21 22 /** BackPress: WordPress Styles Class */ 6 23 require( ABSPATH . WPINC . '/class.wp-styles.php' ); 24 25 /** BackPress: WordPress Styles Functions */ 7 26 require( ABSPATH . WPINC . '/functions.wp-styles.php' ); 8 27 28 /** 29 * Setup WordPress scripts to load by default for Administration Panels. 30 * 31 * Localizes a few of the scripts. 32 * 33 * @since unknown 34 * 35 * @param object $scripts WP_Scripts object. 36 */ 9 37 function wp_default_scripts( &$scripts ) { 10 38 if (!$guessurl = site_url()) 11 39 $guessurl = wp_guess_url(); … … 217 245 } 218 246 } 219 247 248 /** 249 * Assign default styles to $styles object. 250 * 251 * Nothing is returned, because the $styles parameter is passed by reference. 252 * Meaning that whatever object is passed will be updated without having to 253 * reassign the variable that was passed back to the same value. This saves 254 * memory. 255 * 256 * Adding default styles is not the only task, it also assigns the base_url 257 * property, the default version, and text direction for the object. 258 * 259 * @since 2.6.0 260 * 261 * @param object $styles 262 */ 263 220 264 function wp_default_styles( &$styles ) { 221 if (!$guessurl = site_url()) 265 // This checks to see if site_url() returns something and if it does not 266 // then it assigns $guess_url to wp_guess_url(). Strange format, but it works. 267 if ( ! $guessurl = site_url() ) 222 268 $guessurl = wp_guess_url(); 223 269 $styles->base_url = $guessurl; 224 270 $styles->default_version = get_bloginfo( 'version' ); … … 254 300 $styles->add_data( $rtl_style, 'rtl', true ); 255 301 } 256 302 303 /** 304 * Reorder JavaScript scripts array to place prototype before jQuery. 305 * 306 * @since 2.3.1 307 * 308 * @param array $js_array JavaScript scripst array 309 * @return array Reordered array, if needed. 310 */ 311 257 312 function wp_prototype_before_jquery( $js_array ) { 258 313 if ( false === $jquery = array_search( 'jquery', $js_array ) ) 259 314 return $js_array; … … 271 326 return $js_array; 272 327 } 273 328 274 // These localizations require information that may not be loaded even by init 329 /** 330 * Load localized script just in time for MCE. 331 * 332 * These localizations require information that may not be loaded even by init. 333 * 334 * @since 2.5.0 335 */ 275 336 function wp_just_in_time_script_localization() { 276 337 wp_localize_script( 'tiny_mce', 'wpTinyMCEConfig', array( 'defaultEditor' => wp_default_editor() ) ); 277 338 wp_localize_script( 'autosave', 'autosaveL10n', array( … … 283 344 ) ); 284 345 } 285 346 347 /** 348 * Administration Panel CSS for changing the styles. 349 * 350 * If installing the 'wp-admin/' directory will be replaced with './'. 351 * 352 * The $_wp_admin_css_colors global manages the Administration Panels CSS 353 * stylesheet that is loaded. The option that is set is 'admin_color' and is the 354 * color and key for the array. The value for the color key is an object with 355 * a 'url' parameter that has the URL path to the CSS file. 356 * 357 * The query from $src parameter will be appended to the URL that is given from 358 * the $_wp_admin_css_colors array value URL. 359 * 360 * @since 2.6.0 361 * @uses $_wp_admin_css_colors 362 * 363 * @param string $src Source URL. 364 * @param string $handle Either 'colors' or 'colors-rtl'. 365 * @return string URL path to CSS stylesheet for Administration Panels. 366 */ 286 367 function wp_style_loader_src( $src, $handle ) { 287 368 if ( defined('WP_INSTALLING') ) 288 369 return preg_replace( '#^wp-admin/#', './', $src );