From d467c7522a14faa690f0da1469d0901752d4d394 Mon Sep 17 00:00:00 2001 From: azaozz Date: Wed, 22 Apr 2009 21:01:36 +0000 Subject: [PATCH] Queue all default scripts for the head when a custom script lists them as dependencies, fixes #9620 git-svn-id: http://svn.automattic.com/wordpress/trunk@11058 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class.wp-dependencies.php | 16 ++++++++++------ wp-includes/class.wp-scripts.php | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/wp-includes/class.wp-dependencies.php b/wp-includes/class.wp-dependencies.php index fbec18fcd2..6c03582b8c 100644 --- a/wp-includes/class.wp-dependencies.php +++ b/wp-includes/class.wp-dependencies.php @@ -83,18 +83,16 @@ class WP_Dependencies { foreach ( $handles as $handle ) { $handle_parts = explode('?', $handle); $handle = $handle_parts[0]; + $queued = in_array($handle, $this->to_do, true); if ( in_array($handle, $this->done, true) ) // Already done continue; - $this->set_group( $handle, $recursion, $group ); - - if ( in_array($handle, $this->to_do, true) ) // Already grobbed it and its deps + $moved = $this->set_group( $handle, $recursion, $group ); + + if ( $queued && !$moved ) // already queued and in the right group continue; - if ( isset($handle_parts[1]) ) - $this->args[$handle] = $handle_parts[1]; - $keep_going = true; if ( !isset($this->registered[$handle]) ) $keep_going = false; // Script doesn't exist @@ -110,6 +108,12 @@ class WP_Dependencies { continue; // We're at the top level. Move on to the next one. } + if ( $queued ) // Already grobbed it and its deps + continue; + + if ( isset($handle_parts[1]) ) + $this->args[$handle] = $handle_parts[1]; + $this->to_do[] = $handle; } diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index a26b887899..78b6565f9c 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -146,7 +146,7 @@ class WP_Scripts extends WP_Dependencies { if ( false !== $group && $grp > $group ) $grp = $group; - parent::set_group( $handle, $recursion, $grp ); + return parent::set_group( $handle, $recursion, $grp ); } function all_deps( $handles, $recursion = false, $group = false ) {