Bring back wp_localize_script(), see #11520

git-svn-id: http://svn.automattic.com/wordpress/trunk@18490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-07-31 09:11:24 +00:00
parent 07bf8b352e
commit b3204a0b60
2 changed files with 4 additions and 18 deletions

View File

@ -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 );
}

View File

@ -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;