Make WordPress Core

Changeset 12558


Ignore:
Timestamp:
12/28/2009 12:48:20 AM (13 years ago)
Author:
azaozz
Message:

WP_Dependencies: pass NULL to disable script and style version query strings, props scribu amattie, fixes #11315

Location:
trunk/wp-includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class.wp-dependencies.php

    r12049 r12558  
    233233        if ( !is_array($this->deps) )
    234234            $this->deps = array();
    235         if ( !$this->ver )
    236             $this->ver = false;
    237235    }
    238236
  • trunk/wp-includes/class.wp-scripts.php

    r11383 r12558  
    9191            $this->in_footer = array_diff( $this->in_footer, (array) $handle );
    9292
    93         $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
     93        if ( null === $this->registered[$handle]->ver )
     94            $ver = '';
     95        else
     96            $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
     97
    9498        if ( isset($this->args[$handle]) )
    95             $ver .= '&' . $this->args[$handle];
     99            $ver = $ver ? $ver . '&' . $this->args[$handle] : '?' . $this->args[$handle];
    96100
    97101        $src = $this->registered[$handle]->src;
     
    115119        }
    116120
    117         $src = add_query_arg('ver', $ver, $src);
     121        if ( !empty($ver) )
     122            $src = add_query_arg('ver', $ver, $src);
    118123        $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
    119124
  • trunk/wp-includes/class.wp-styles.php

    r11383 r12558  
    3636            return false;
    3737
    38         $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
     38        if ( null === $this->registered[$handle]->ver )
     39            $ver = '';
     40        else
     41            $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
     42
    3943        if ( isset($this->args[$handle]) )
    40             $ver .= '&' . $this->args[$handle];
     44            $ver = $ver ? $ver . '&' . $this->args[$handle] : '?' . $this->args[$handle];
    4145
    4246        if ( $this->do_concat ) {
     
    101105        }
    102106
    103         $src = add_query_arg('ver', $ver, $src);
     107        if ( !empty($ver) )
     108            $src = add_query_arg('ver', $ver, $src);
    104109        $src = apply_filters( 'style_loader_src', $src, $handle );
    105110        return esc_url( $src );
  • trunk/wp-includes/functions.wp-scripts.php

    r10572 r12558  
    3939 *
    4040 * @since r16
    41  * @see WP_Dependencies::add() For parameter information.
     41 * @param string $handle Script name
     42 * @param string $src Script url
     43 * @param array $deps (optional) Array of script names on which this script depends
     44 * @param string|bool $ver (optional) Script version (used for cache busting), set to NULL to disable
     45 * @param bool (optional) Wether to enqueue the script before </head> or before </body>
     46 * @return null
    4247 */
    4348function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
     
    5762 *
    5863 * @since r16
    59  * @see WP_Script::localize()
     64 * @see WP_Scripts::localize()
    6065 */
    6166function wp_localize_script( $handle, $object_name, $l10n ) {
     
    8792 *
    8893 * @since r16
    89  * @see WP_Script::add(), WP_Script::enqueue()
    90 */
     94 * @see wp_register_script() For parameter information.
     95 */
    9196function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
    9297    global $wp_scripts;
  • trunk/wp-includes/functions.wp-styles.php

    r12531 r12558  
    4646 * @param array $deps Array of handles of any stylesheet that this stylesheet depends on.
    4747 *  (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
    48  * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter
    49  *  is used to ensure that the correct version is sent to the client regardless of caching, and so should be included
    50  *  if a version number is available and makes sense for the stylesheet.
     48 * @param string|bool $ver String specifying the stylesheet version number. Set to NULL to disable.
     49 *  Used to ensure that the correct version is sent to the client regardless of caching.
    5150 * @param string $media The media for which this stylesheet has been defined.
    5251 */
     
    7877/**
    7978 * Enqueue a CSS style file.
     79 *
     80 * Registers the style if src provided (does NOT overwrite) and enqueues.
    8081 *
    8182 * @since r79
Note: See TracChangeset for help on using the changeset viewer.