Ticket #25247: 25247_scripts.diff
| File 25247_scripts.diff, 2.2 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/class.wp-scripts.php
20 20 public $base_url; // Full URL with trailing slash 21 21 public $content_url; 22 22 public $default_version; 23 public $in_footer = array();24 23 public $concat = ''; 25 24 public $concat_version = ''; 26 25 public $do_concat = false; … … 88 87 return false; 89 88 90 89 if ( 0 === $group && $this->groups[$handle] > 0 ) { 91 $this->in_footer[] = $handle;92 90 return false; 93 91 } 94 92 95 if ( false === $group && in_array($handle, $this->in_footer, true) )96 $this->in_footer = array_diff( $this->in_footer, (array) $handle );97 98 93 if ( null === $this->registered[$handle]->ver ) 99 94 $ver = ''; 100 95 else … … 163 158 } 164 159 165 160 /** 161 * Register a script. 162 * 163 * Registers the script if no script of that name already exists. 164 * 165 * @access public 166 * @since 4.2 ??What should this be?? 167 * 168 * @param string $handle Unique script name. 169 * @param string $src The script url. 170 * @param array $deps Optional. An array of script handle strings on which this script depends. 171 * @param string $ver Optional. Version (used for cache busting). 172 * @param mixed $args Optional. Custom property of the script. NOT the class property $args. Examples: 1 for in_footer. 173 * @return bool True on success, false on failure. 174 */ 175 public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { 176 $in_footer = ( $args === 1 ); 177 178 $result = parent::add( $handle, $src, $deps, $ver, $in_footer ? null : $args ); 179 180 if ( $in_footer && $result ) { 181 $this->add_data( $handle, 'group', 1 ); 182 } 183 184 return $result; 185 } 186 187 /** 166 188 * Localizes a script 167 189 * 168 190 * Localizes only if the script has already been added … … 198 220 199 221 public function set_group( $handle, $recursion, $group = false ) { 200 222 201 if ( $this->registered[$handle]->args === 1 ) 202 $grp = 1; 203 else 204 $grp = (int) $this->get_data( $handle, 'group' ); 223 $grp = (int) $this->get_data( $handle, 'group' ); 205 224 206 225 if ( false !== $group && $grp > $group ) 207 226 $grp = $group;