From 60dc347247b6b6113f34937d49a44539d7514fdd Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 8 Dec 2011 20:46:58 +0000 Subject: [PATCH] Remove wp_add_script_before() from 3.3. Continue to use wp_localize_script() for your data-passing needs. fixes #11520. git-svn-id: http://svn.automattic.com/wordpress/trunk@19573 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class.wp-scripts.php | 16 ---------------- wp-includes/functions.wp-scripts.php | 21 --------------------- 2 files changed, 37 deletions(-) diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index 7ed5f2fee..41f6019ec 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -145,22 +145,6 @@ class WP_Scripts extends WP_Dependencies { if ( !empty($after) ) $script .= "\n$after"; - return $this->add_script_data( $handle, $script ); - } - - /** - * Add extra Javascript - * - * Only if script has already been added. - * - * @param string $handle Script name - * @param string $script Extra JS to add before the script - * @return bool Successful or not - */ - function add_script_data( $handle, $script ) { - if ( !is_string( $script ) ) - return false; - $data = $this->get_data( $handle, 'data' ); if ( !empty( $data ) ) diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index eb306c621..228a3bfe1 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -96,27 +96,6 @@ function wp_localize_script( $handle, $object_name, $l10n ) { return $wp_scripts->localize( $handle, $object_name, $l10n ); } -/** - * Adds extra Javascript. - * - * Works only if the script referenced by $handle has already been added. - * Accepts string $script that will be printed before the main script tag. - * - * @since 3.3 - * @see WP_Scripts::add_script_data() - */ -function wp_add_script_before( $handle, $script ) { - 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.3' ); - return false; - } - - return $wp_scripts->add_script_data( $handle, $script ); -} - /** * Remove a registered script. *