WordPress.org

Make WordPress Core

Ticket #11315: 11315_override.2.diff

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

Add documentation, use empty string instead of null

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

     
    3838 * Register new JavaScript file.
    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): '' - current WP version, false - no cache busting
     45 * @param bool (optional) Wether to enqueue the script before </head> or before </body>
     46 * @return null
    4247 */
    43 function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
     48function wp_register_script( $handle, $src, $deps = array(), $ver = '', $in_footer = false ) {
    4449        global $wp_scripts;
    4550        if ( !is_a($wp_scripts, 'WP_Scripts') )
    4651                $wp_scripts = new WP_Scripts();
     
    5661 * Localizes only if script has already been added.
    5762 *
    5863 * @since r16
    59  * @see WP_Script::localize()
     64 * @see WP_Scripts::localize()
    6065 */
    6166function wp_localize_script( $handle, $object_name, $l10n ) {
    6267        global $wp_scripts;
     
    8691 * Registers the script if src provided (does NOT overwrite) and enqueues.
    8792 *
    8893 * @since r16
    89  * @see WP_Script::add(), WP_Script::enqueue()
    90 */
    91 function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
     94 * @see wp_register_script() For parameter information.
     95 */
     96function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = '', $in_footer = false ) {
    9297        global $wp_scripts;
    9398        if ( !is_a($wp_scripts, 'WP_Scripts') )
    9499                $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 !== '' ? $this->registered[$handle]->ver : $this->default_version;
     39
    3940                if ( isset($this->args[$handle]) )
    4041                        $ver .= '&amp;' . $this->args[$handle];
    4142
     
    100101                        $src = $this->base_url . $src;
    101102                }
    102103
    103                 $src = add_query_arg('ver', $ver, $src);
     104                if (!empty($ver))
     105                        $src = add_query_arg('ver', $ver, $src);
    104106                $src = apply_filters( 'style_loader_src', $src, $handle );
    105107                return esc_url( $src );
    106108        }
  • 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/functions.wp-styles.php

     
    3636 * Register CSS style file.
    3737 *
    3838 * @since r79
    39  * @see WP_Styles::add() For parameter and additional information.
     39 * @param string $handle Style name
     40 * @param string $src Style url
     41 * @param array $deps (optional) Array of style names on which this script depends
     42 * @param string|bool $ver (optional) Style version (used for cache busting): '' - current WP version, false - no cache busting
     43 * @param string $media (optional) The media attribute value for the <link> tag
     44 * @return null
    4045 */
    41 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
     46function wp_register_style( $handle, $src, $deps = array(), $ver = '', $media = 'all' ) {
    4247        global $wp_styles;
    4348        if ( !is_a($wp_styles, 'WP_Styles') )
    4449                $wp_styles = new WP_Styles();
     
    6368/**
    6469 * Enqueue a CSS style file.
    6570 *
     71 * Registers the style if src provided (does NOT overwrite) and enqueues.
     72 *
    6673 * @since r79
    67  * @see WP_Styles::add(), WP_Styles::enqueue()
     74 * @see wp_register_style() For parameter information.
    6875 */
    69 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
     76function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = '', $media = false ) {
    7077        global $wp_styles;
    7178        if ( !is_a($wp_styles, 'WP_Styles') )
    7279                $wp_styles = new WP_Styles();
  • 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 !== '' ? $this->registered[$handle]->ver : $this->default_version;
     94
    9495                if ( isset($this->args[$handle]) )
    9596                        $ver .= '&amp;' . $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 )