WordPress.org

Make WordPress Core

Ticket #11315: 11315_override.diff

File 11315_override.diff, 4.2 KB (added by scribu, 8 years ago)

Add default version only for null value

  • wp-includes/functions.wp-scripts.php

     
    4040 * @since r16
    4141 * @see WP_Dependencies::add() For parameter information.
    4242 */
    43 function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
     43function wp_register_script( $handle, $src, $deps = array(), $ver = null, $in_footer = false ) {
    4444        global $wp_scripts;
    4545        if ( !is_a($wp_scripts, 'WP_Scripts') )
    4646                $wp_scripts = new WP_Scripts();
     
    8888 * @since r16
    8989 * @see WP_Script::add(), WP_Script::enqueue()
    9090*/
    91 function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
     91function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = null, $in_footer = false ) {
    9292        global $wp_scripts;
    9393        if ( !is_a($wp_scripts, 'WP_Scripts') )
    9494                $wp_scripts = new WP_Scripts();
  • wp-includes/class.wp-styles.php

     
    3535                if ( !parent::do_item($handle) )
    3636                        return false;
    3737
    38                 $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
     38                $ver = $this->registered[$handle]->ver !== null ? $this->registered[$handle]->ver : $this->default_version;
    3939                if ( isset($this->args[$handle]) )
    4040                        $ver .= '&' . $this->args[$handle];
    4141
     
    100100                        $src = $this->base_url . $src;
    101101                }
    102102
    103                 $src = add_query_arg('ver', $ver, $src);
     103                if (!empty($ver))
     104                        $src = add_query_arg('ver', $ver, $src);
    104105                $src = apply_filters( 'style_loader_src', $src, $handle );
    105106                return esc_url( $src );
    106107        }
  • wp-includes/functions.wp-styles.php

     
    3838 * @since r79
    3939 * @see WP_Styles::add() For parameter and additional information.
    4040 */
    41 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
     41function wp_register_style( $handle, $src, $deps = array(), $ver = null, $media = 'all' ) {
    4242        global $wp_styles;
    4343        if ( !is_a($wp_styles, 'WP_Styles') )
    4444                $wp_styles = new WP_Styles();
     
    6666 * @since r79
    6767 * @see WP_Styles::add(), WP_Styles::enqueue()
    6868 */
    69 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
     69function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = null, $media = false ) {
    7070        global $wp_styles;
    7171        if ( !is_a($wp_styles, 'WP_Styles') )
    7272                $wp_styles = new WP_Styles();
  • wp-includes/class.wp-dependencies.php

     
    232232                @list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args();
    233233                if ( !is_array($this->deps) )
    234234                        $this->deps = array();
    235                 if ( !$this->ver )
    236                         $this->ver = false;
    237235        }
    238236
    239237        function add_data( $name, $data ) {
  • wp-includes/class.wp-scripts.php

     
    9090                if ( false === $group && in_array($handle, $this->in_footer, true) )
    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                $ver = $this->registered[$handle]->ver !== null ? $this->registered[$handle]->ver : $this->default_version;
     94
    9495                if ( isset($this->args[$handle]) )
    9596                        $ver .= '&' . $this->args[$handle];
    9697
     
    114115                        $src = $this->base_url . $src;
    115116                }
    116117
    117                 $src = add_query_arg('ver', $ver, $src);
     118                if (!empty($ver))
     119                        $src = add_query_arg('ver', $ver, $src);
    118120                $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
    119121
    120122                if ( $this->do_concat )