diff --git a/wp-includes/class.wp-dependencies.php b/wp-includes/class.wp-dependencies.php
index 0e3f51ede3..6cba02d4a3 100644
--- a/wp-includes/class.wp-dependencies.php
+++ b/wp-includes/class.wp-dependencies.php
@@ -39,7 +39,7 @@ class WP_Dependencies {
$this->all_deps( $handles );
foreach( $this->to_do as $key => $handle ) {
- if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) {
+ if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
if ( ! $this->registered[$handle]->src ) { // Defines a group.
$this->done[] = $handle;
diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php
index 681a824699..1cd4150da1 100644
--- a/wp-includes/class.wp-scripts.php
+++ b/wp-includes/class.wp-scripts.php
@@ -167,15 +167,7 @@ class WP_Scripts extends WP_Dependencies {
}
function do_footer_items() {
- if ( !empty($this->in_footer) ) {
- foreach( $this->in_footer as $key => $handle ) {
- if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
- $this->do_item($handle);
- $this->done[] = $handle;
- unset( $this->in_footer[$key] );
- }
- }
- }
+ $this->do_items(false, 1);
return $this->done;
}
diff --git a/wp-includes/class.wp-styles.php b/wp-includes/class.wp-styles.php
index ecc0bb9e22..db53fd6e3e 100644
--- a/wp-includes/class.wp-styles.php
+++ b/wp-includes/class.wp-styles.php
@@ -122,5 +122,17 @@ class WP_Styles extends WP_Dependencies {
}
return false;
}
+
+ function do_footer_items() { // HTML 5 allows styles in the body, grab late enqueued items and output them in the footer.
+ $this->do_items(false, 1);
+ return $this->done;
+ }
+ function reset() {
+ $this->do_concat = false;
+ $this->concat = '';
+ $this->concat_version = '';
+ $this->print_html = '';
+ }
}
+
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index a5b6150a51..e8b65d9797 100644
--- a/wp-includes/default-filters.php
+++ b/wp-includes/default-filters.php
@@ -242,7 +242,7 @@ add_action( 'do_pings', 'do_all_pings', 10, 1 );
add_action( 'do_robots', 'do_robots' );
add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' );
add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
-add_action( 'admin_print_footer_scripts', 'print_footer_scripts', 20 );
+add_action( 'admin_print_footer_scripts', 'wp_print_footer_scripts', 20 );
add_action( 'admin_print_styles', 'print_admin_styles', 20 );
add_action( 'init', 'smilies_init', 5 );
add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index 0ac901a2e8..6b1850eb1e 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -474,7 +474,7 @@ function wp_default_styles( &$styles ) {
$styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
$styles->default_version = get_bloginfo( 'version' );
$styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
- $styles->default_dirs = array('/wp-admin/');
+ $styles->default_dirs = array('/wp-admin/', '/wp-includes/');
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
@@ -723,7 +723,9 @@ function wp_print_head_scripts() {
* @since 2.8
*/
function wp_print_footer_scripts() {
- return print_footer_scripts();
+ print_late_styles();
+ print_footer_scripts();
+ return true;
}
/**
@@ -752,21 +754,45 @@ function print_admin_styles() {
$wp_styles->do_items(false);
- if ( apply_filters('print_admin_styles', true) ) {
- if ( !empty($wp_styles->concat) ) {
- $dir = $wp_styles->text_direction;
- $ver = md5("$wp_styles->concat_version{$dir}");
- $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . "&ver=$ver";
- echo "\n";
- }
+ if ( apply_filters('print_admin_styles', true) )
+ _print_styles();
- if ( !empty($wp_styles->print_html) )
- echo $wp_styles->print_html;
+ $wp_styles->reset();
+ return $wp_styles->done;
+}
+
+function print_late_styles() {
+ global $wp_styles, $concatenate_scripts;
+
+ if ( !is_a($wp_styles, 'WP_Styles') )
+ return;
+
+ $wp_styles->do_concat = $concatenate_scripts;
+ $wp_styles->do_footer_items();
+
+ if ( apply_filters('print_late_styles', true) )
+ _print_styles();
+
+ $wp_styles->reset();
+ return $wp_styles->done;
+}
+
+function _print_styles() {
+ global $wp_styles, $compress_css;
+
+ $zip = $compress_css ? 1 : 0;
+ if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
+ $zip = 'gzip';
+
+ if ( !empty($wp_styles->concat) ) {
+ $dir = $wp_styles->text_direction;
+ $ver = md5("$wp_styles->concat_version{$dir}");
+ $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . "&ver=$ver";
+ echo "\n";
}
- $wp_styles->do_concat = false;
- $wp_styles->concat = $wp_styles->concat_version = $wp_styles->print_html = '';
- return $wp_styles->done;
+ if ( !empty($wp_styles->print_html) )
+ echo $wp_styles->print_html;
}
function script_concat_settings() {