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:
parent
07bf8b352e
commit
b3204a0b60
wp-includes
|
@ -2616,17 +2616,3 @@ function wp_timezone_supported() {
|
||||||
return true;
|
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -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.
|
* Works only if the script has already been added.
|
||||||
* Accepts an associative array $data and creates JS object:
|
* 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 $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 $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 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()
|
* @see WP_Scripts::add_script_data()
|
||||||
*/
|
*/
|
||||||
function wp_add_script_data( $handle, $name, $data ) {
|
function wp_localize_script( $handle, $name, $data ) {
|
||||||
global $wp_scripts;
|
global $wp_scripts;
|
||||||
if ( !is_a($wp_scripts, 'WP_Scripts') )
|
if ( !is_a($wp_scripts, 'WP_Scripts') )
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue