diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php
index 33cb169b62..2f6977676a 100644
--- a/wp-includes/class.wp-scripts.php
+++ b/wp-includes/class.wp-scripts.php
@@ -26,6 +26,7 @@ class WP_Scripts extends WP_Dependencies {
var $do_concat = false;
var $print_html = '';
var $print_code = '';
+ var $src = '';
var $default_dirs;
function __construct() {
@@ -109,6 +110,7 @@ class WP_Scripts extends WP_Dependencies {
$src = $this->base_url . $src;
}
+ $this->src .= "$src,";
$src = add_query_arg('ver', $ver, $src);
$src = clean_url(apply_filters( 'script_loader_src', $src, $handle ));
diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php
index 1f7e6aca71..5fa5e5bd06 100644
--- a/wp-includes/functions.wp-scripts.php
+++ b/wp-includes/functions.wp-scripts.php
@@ -40,12 +40,14 @@ function wp_print_scripts( $handles = false ) {
* @since r16
* @see WP_Scripts::add() For parameter information.
*/
-function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
+function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
global $wp_scripts;
if ( !is_a($wp_scripts, 'WP_Scripts') )
$wp_scripts = new WP_Scripts();
$wp_scripts->add( $handle, $src, $deps, $ver );
+ if ( $in_footer )
+ $wp_scripts->add_data( $handle, 'group', 1 );
}
/**
@@ -86,7 +88,7 @@ function wp_deregister_script( $handle ) {
* @since r16
* @see WP_Script::add(), WP_Script::enqueue()
*/
-function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
+function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
global $wp_scripts;
if ( !is_a($wp_scripts, 'WP_Scripts') )
$wp_scripts = new WP_Scripts();
@@ -94,6 +96,8 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false
if ( $src ) {
$_handle = explode('?', $handle);
$wp_scripts->add( $_handle[0], $src, $deps, $ver );
+ if ( $in_footer )
+ $wp_scripts->add_data( $_handle[0], 'group', 1 );
}
$wp_scripts->enqueue( $handle );
}
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index c0fc531fe0..65a649a109 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -536,7 +536,7 @@ function wp_style_loader_src( $src, $handle ) {
*/
function wp_print_head_scripts() {
do_action( 'wp_print_scripts' );
- global $wp_scripts, $concatenate_scripts, $compress_scripts;
+ global $wp_scripts, $concatenate_scripts;
if ( !is_a($wp_scripts, 'WP_Scripts') )
$wp_scripts = new WP_Scripts();
@@ -547,9 +547,11 @@ function wp_print_head_scripts() {
$wp_scripts->do_concat = $concatenate_scripts;
$wp_scripts->do_head_items();
- _pring_scripts();
+ if ( apply_filters('print_head_scripts', true) )
+ _pring_scripts();
$wp_scripts->do_concat = false;
+ $wp_scripts->print_code = $wp_scripts->concat = $wp_scripts->concat_version = $wp_scripts->print_html = $wp_scripts->src = '';
return $wp_scripts->done;
}
@@ -570,9 +572,11 @@ function wp_print_footer_scripts() {
$wp_scripts->do_concat = $concatenate_scripts;
$wp_scripts->do_footer_items();
- _pring_scripts();
+ if ( apply_filters('print_footer_scripts', true) )
+ _pring_scripts();
$wp_scripts->do_concat = false;
+ $wp_scripts->concat = $wp_scripts->concat_version = $wp_scripts->print_code = $wp_scripts->print_html = $wp_scripts->src = '';
return $wp_scripts->done;
}
@@ -589,19 +593,16 @@ function _pring_scripts() {
echo $wp_scripts->print_code;
echo "/* ]]> */\n";
echo "\n";
- $wp_scripts->print_code = '';
}
- $ver = md5($wp_scripts->concat_version);
- $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . rtrim($wp_scripts->concat, ',') . "&ver=$ver";
+ $ver = md5("$wp_scripts->concat" . "$wp_scripts->concat_version");
+ $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . rtrim($wp_scripts->concat, ',') . "&ver=$ver";
echo "\n";
- $wp_scripts->concat = $wp_scripts->concat_version = '';
}
- if ( !empty($wp_scripts->print_html) ) {
+ if ( !empty($wp_scripts->print_html) )
echo $wp_scripts->print_html;
- $wp_scripts->print_html = '';
- }
+
}
function wp_print_admin_styles() {
@@ -618,20 +619,20 @@ function wp_print_admin_styles() {
$wp_styles->do_items(false);
- if ( !empty($wp_styles->concat) ) {
- $ver = md5($wp_styles->concat_version);
- $rtl = 'rtl' === $wp_styles->text_direction ? 1 : 0;
- $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&rtl={$rtl}&load=" . rtrim($wp_styles->concat, ',') . "&ver=$ver";
- echo "\n";
- $wp_styles->concat = $wp_styles->concat_version = '';
- }
+ if ( apply_filters('print_admin_styles', true) ) {
+ if ( !empty($wp_styles->concat) ) {
+ $ver = md5("$wp_styles->concat" . "$wp_styles->concat_version");
+ $rtl = 'rtl' === $wp_styles->text_direction ? 1 : 0;
+ $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&rtl={$rtl}&load=" . rtrim($wp_styles->concat, ',') . "&ver=$ver";
+ echo "\n";
+ }
- if ( !empty($wp_styles->print_html) ) {
- echo $wp_styles->print_html;
- $wp_styles->print_html = '';
+ if ( !empty($wp_styles->print_html) )
+ echo $wp_styles->print_html;
}
$wp_styles->do_concat = false;
+ $wp_styles->concat = $wp_styles->concat_version = $wp_styles->print_html = '';
return $wp_styles->done;
}