Ticket #25247: 25247_scripts2.diff
| File 25247_scripts2.diff, 2.2 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; … … 108 107 return false; 109 108 110 109 if ( 0 === $group && $this->groups[$handle] > 0 ) { 111 $this->in_footer[] = $handle;112 110 return false; 113 111 } 114 112 115 if ( false === $group && in_array($handle, $this->in_footer, true) )116 $this->in_footer = array_diff( $this->in_footer, (array) $handle );117 118 113 $obj = $this->registered[$handle]; 119 114 120 115 if ( null === $obj->ver ) { … … 204 199 } 205 200 206 201 /** 202 * Register a script. 203 * 204 * Registers the script if no script of that name already exists. 205 * 206 * @access public 207 * @since 4.2 ??What should this be?? 208 * 209 * @param string $handle Unique script name. 210 * @param string $src The script url. 211 * @param array $deps Optional. An array of script handle strings on which this script depends. 212 * @param string $ver Optional. Version (used for cache busting). 213 * @param mixed $args Optional. Custom property of the script. NOT the class property $args. Examples: 1 for in_footer. 214 * @return bool True on success, false on failure. 215 */ 216 public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { 217 $in_footer = ( $args === 1 ); 218 219 $result = parent::add( $handle, $src, $deps, $ver, $in_footer ? null : $args ); 220 221 if ( $in_footer && $result ) { 222 $this->add_data( $handle, 'group', 1 ); 223 } 224 225 return $result; 226 } 227 228 /** 207 229 * Localizes a script, only if the script has already been added 208 230 * 209 231 * @param string $handle … … 247 269 * @return bool Not already in the group or a lower group 248 270 */ 249 271 public function set_group( $handle, $recursion, $group = false ) { 250 if ( $this->registered[$handle]->args === 1 ) 251 $grp = 1; 252 else 253 $grp = (int) $this->get_data( $handle, 'group' ); 272 $grp = (int) $this->get_data( $handle, 'group' ); 254 273 255 274 if ( false !== $group && $grp > $group ) 256 275 $grp = $group;