Ticket #25247: 25247_scripts5.diff
| File 25247_scripts5.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 ) { … … 218 213 } 219 214 220 215 /** 216 * Register a script. 217 * 218 * Registers the script if no script of that name already exists. 219 * 220 * @access public 221 * @since 4.5 222 * 223 * @param string $handle Unique script name. 224 * @param string $src The script url. 225 * @param array $deps Optional. An array of script handle strings on which this script depends. 226 * @param string $ver Optional. Version (used for cache busting). 227 * @param mixed $args Optional. Custom property of the script. NOT the class property $args. Examples: 1 for in_footer. 228 * @return bool True on success, false on failure. 229 */ 230 public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { 231 $in_footer = ( $args === 1 ); 232 233 $result = parent::add( $handle, $src, $deps, $ver, $in_footer ? null : $args ); 234 235 if ( $in_footer && $result ) { 236 $this->add_data( $handle, 'group', 1 ); 237 } 238 239 return $result; 240 } 241 242 /** 221 243 * Localizes a script, only if the script has already been added 222 244 * 223 245 * @param string $handle … … 261 283 * @return bool Not already in the group or a lower group 262 284 */ 263 285 public function set_group( $handle, $recursion, $group = false ) { 264 if ( isset( $this->registered[$handle]->args ) && $this->registered[$handle]->args === 1 ) 265 $grp = 1; 266 else 267 $grp = (int) $this->get_data( $handle, 'group' ); 286 $grp = (int) $this->get_data( $handle, 'group' ); 268 287 269 288 if ( false !== $group && $grp > $group ) 270 289 $grp = $group;