Make WordPress Core

Ticket #7649: 7649.r8780.diff

File 7649.r8780.diff, 4.1 KB (added by jacobsantos, 16 years ago)

Complete inline documentation for script-loader.php based off of r8780

  • script-loader.php

     
    11<?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 */
    212
     13/** BackPress: WordPress Dependencies Class */
    314require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
     15
     16/** BackPress: WordPress Scripts Class */
    417require( ABSPATH . WPINC . '/class.wp-scripts.php' );
     18
     19/** BackPress: WordPress Scripts Functions */
    520require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
     21
     22/** BackPress: WordPress Styles Class */
    623require( ABSPATH . WPINC . '/class.wp-styles.php' );
     24
     25/** BackPress: WordPress Styles Functions */
    726require( ABSPATH . WPINC . '/functions.wp-styles.php' );
    827
     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 */
    937function wp_default_scripts( &$scripts ) {
    1038        if (!$guessurl = site_url())
    1139                $guessurl = wp_guess_url();
     
    217245        }
    218246}
    219247
     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
    220264function 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() )
    222268                $guessurl = wp_guess_url();
    223269        $styles->base_url = $guessurl;
    224270        $styles->default_version = get_bloginfo( 'version' );
     
    254300                $styles->add_data( $rtl_style, 'rtl', true );
    255301}
    256302
     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
    257312function wp_prototype_before_jquery( $js_array ) {
    258313        if ( false === $jquery = array_search( 'jquery', $js_array ) )
    259314                return $js_array;
     
    271326        return $js_array;
    272327}
    273328
    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 */
    275336function wp_just_in_time_script_localization() {
    276337        wp_localize_script( 'tiny_mce', 'wpTinyMCEConfig', array( 'defaultEditor' => wp_default_editor() ) );
    277338        wp_localize_script( 'autosave', 'autosaveL10n', array(
     
    283344        ) );
    284345}
    285346
     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 */
    286367function wp_style_loader_src( $src, $handle ) {
    287368        if ( defined('WP_INSTALLING') )
    288369                return preg_replace( '#^wp-admin/#', './', $src );