Index: wp-includes/functions.wp-scripts.php
===================================================================
--- wp-includes/functions.wp-scripts.php (revision 22265)
+++ wp-includes/functions.wp-scripts.php (working copy)
@@ -183,3 +183,15 @@
return (bool) $wp_scripts->query( $handle, $list );
}
+
+function wp_script_add_data( $handle, $key, $value ){
+ global $wp_scripts;
+ if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+ if ( ! did_action( 'init' ) )
+ _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.5' );
+ $wp_scripts = new WP_Scripts();
+ }
+
+ return (bool) $wp_scripts->add_data( $handle, $key, $value );
+}
Index: wp-includes/functions.wp-styles.php
===================================================================
--- wp-includes/functions.wp-styles.php (revision 22265)
+++ wp-includes/functions.wp-styles.php (working copy)
@@ -190,3 +190,15 @@
return (bool) $wp_styles->query( $handle, $list );
}
+
+function wp_style_add_data( $handle, $key, $value ){
+ global $wp_styles;
+ if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+ if ( ! did_action( 'init' ) )
+ _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.5' );
+ $wp_styles = new WP_Styles();
+ }
+
+ return (bool) $wp_styles->add_data( $handle, $key, $value );
+}
Index: wp-includes/class.wp-scripts.php
===================================================================
--- wp-includes/class.wp-scripts.php (revision 22265)
+++ wp-includes/class.wp-scripts.php (working copy)
@@ -83,22 +83,24 @@
return false;
}
+ $obj = $this->registered[$handle];
+
if ( false === $group && in_array($handle, $this->in_footer, true) )
$this->in_footer = array_diff( $this->in_footer, (array) $handle );
- if ( null === $this->registered[$handle]->ver )
+ if ( null === $obj->ver )
$ver = '';
else
- $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+ $ver = $obj->ver ? $obj->ver : $this->default_version;
if ( isset($this->args[$handle]) )
$ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle];
- $src = $this->registered[$handle]->src;
+ $src = $obj->src;
if ( $this->do_concat ) {
$srce = apply_filters( 'script_loader_src', $src, $handle );
- if ( $this->in_default_dir($srce) ) {
+ if ( $this->in_default_dir($srce) && ! isset( $obj->extra['conditional'] ) ) {
$this->print_code .= $this->print_extra_script( $handle, false );
$this->concat .= "$handle,";
$this->concat_version .= "$handle$ver";
@@ -119,10 +121,16 @@
$src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
+ $cond_before = $cond_after = null;
+ if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) {
+ $cond_before = "\n";
+ }
+
if ( $this->do_concat )
- $this->print_html .= "\n";
+ $this->print_html .= "$cond_before\n$cond_after";
else
- echo "\n";
+ echo "$cond_before\n$cond_after";
return true;
}