From c641a1d27a6e4b0b6ed6cbce0c0a82d5810c73e7 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sun, 31 Jul 2011 09:11:24 +0000 Subject: [PATCH] Bring back wp_localize_script(), see #11520 git-svn-id: https://develop.svn.wordpress.org/trunk@18490 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/deprecated.php | 14 -------------- wp-includes/functions.wp-scripts.php | 8 ++++---- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 9c59dd8b7c..6be5dfb2da 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2616,17 +2616,3 @@ function wp_timezone_supported() { return true; } -/** - * Localizes a script. - * - * Localizes only if script has already been added. - * - * @since r16 - * @deprecated WP 3.3 - * @see wp_add_script_data() - */ -function wp_localize_script( $handle, $object_name, $l10n ) { - _deprecated_function( __FUNCTION__, '3.3', 'wp_add_script_data()' ); - return wp_add_script_data( $handle, $object_name, $l10n ); -} - diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index d20d63745a..558bd19ac7 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -56,7 +56,7 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_f } /** - * Adds extra Javascript. + * Adds extra Javascript data. * * Works only if the script has already been added. * Accepts an associative array $data and creates JS object: @@ -68,12 +68,12 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_f * The $name is passed directly so it should be qualified JS variable /[a-zA-Z0-9_]+/ * The $data array is JSON encoded. If called more than once for the same $handle with the same $name, * the object would contain all values. In that case if two or more keys are the same, - * the last value overwrites the previous. + * the last value overwrites the previous. The function is named "localize_script" because of historical reasons. * - * @since 3.3 + * @since r16 * @see WP_Scripts::add_script_data() */ -function wp_add_script_data( $handle, $name, $data ) { +function wp_localize_script( $handle, $name, $data ) { global $wp_scripts; if ( !is_a($wp_scripts, 'WP_Scripts') ) return false;