Ticket #25247: 25247_scripts3.diff
| File 25247_scripts3.diff, 2.3 KB (added by , 10 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; … … 117 116 return false; 118 117 119 118 if ( 0 === $group && $this->groups[$handle] > 0 ) { 120 $this->in_footer[] = $handle;121 119 return false; 122 120 } 123 121 124 if ( false === $group && in_array($handle, $this->in_footer, true) )125 $this->in_footer = array_diff( $this->in_footer, (array) $handle );126 127 122 $obj = $this->registered[$handle]; 128 123 129 124 if ( null === $obj->ver ) { … … 213 208 } 214 209 215 210 /** 211 * Register a script. 212 * 213 * Registers the script if no script of that name already exists. 214 * 215 * @access public 216 * @since 4.2 ??What should this be?? 217 * 218 * @param string $handle Unique script name. 219 * @param string $src The script url. 220 * @param array $deps Optional. An array of script handle strings on which this script depends. 221 * @param string $ver Optional. Version (used for cache busting). 222 * @param mixed $args Optional. Custom property of the script. NOT the class property $args. Examples: 1 for in_footer. 223 * @return bool True on success, false on failure. 224 */ 225 public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { 226 $in_footer = ( $args === 1 ); 227 228 $result = parent::add( $handle, $src, $deps, $ver, $in_footer ? null : $args ); 229 230 if ( $in_footer && $result ) { 231 $this->add_data( $handle, 'group', 1 ); 232 } 233 234 return $result; 235 } 236 237 /** 216 238 * Localizes a script, only if the script has already been added 217 239 * 218 240 * @param string $handle … … 256 278 * @return bool Not already in the group or a lower group 257 279 */ 258 280 public function set_group( $handle, $recursion, $group = false ) { 259 if ( isset( $this->registered[$handle]->args ) && $this->registered[$handle]->args === 1 ) 260 $grp = 1; 261 else 262 $grp = (int) $this->get_data( $handle, 'group' ); 281 $grp = (int) $this->get_data( $handle, 'group' ); 263 282 264 283 if ( false !== $group && $grp > $group ) 265 284 $grp = $group;