Changeset 18464 for trunk/wp-includes/functions.wp-scripts.php
- Timestamp:
- 07/25/2011 12:36:06 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.wp-scripts.php
r15601 r18464 27 27 if ( !is_a($wp_scripts, 'WP_Scripts') ) { 28 28 if ( !$handles ) 29 return array(); // No need to instantiate if nothing 's there.29 return array(); // No need to instantiate if nothing is there. 30 30 else 31 31 $wp_scripts = new WP_Scripts(); … … 36 36 37 37 /** 38 * Register new Java Script file.38 * Register new Javascript file. 39 39 * 40 40 * @since r16 … … 57 57 58 58 /** 59 * Localizes ascript.59 * Adds extra Javascript. 60 60 * 61 * Localizes only if script has already been added. 62 * 63 * @since r16 64 * @see WP_Scripts::localize() 61 * Works only if the script has already been added. 62 * Accepts an associative array $data and creates JS object: 63 * "$name" = { 64 * key: value, 65 * key: value, 66 * ... 67 * } 68 * The $name is passed directly so it should be qualified JS variable /[a-zA-Z0-9_]+/ 69 * The $data array is JSON encoded. If called more than once for the same $handle, with the same $name, 70 * the object would contain all values. In that case if two or more keys are the same, 71 * the first value is kept and subsequent values are ignored. 72 * 73 * @since 3.3 74 * @see WP_Scripts::add_script_data() 65 75 */ 66 function wp_ localize_script( $handle, $object_name, $l10n) {76 function wp_add_script_data( $handle, $name, $data ) { 67 77 global $wp_scripts; 68 78 if ( !is_a($wp_scripts, 'WP_Scripts') ) 69 79 return false; 70 80 71 return $wp_scripts-> localize( $handle, $object_name, $l10n);81 return $wp_scripts->add_script_data( $handle, $name, $data ); 72 82 } 73 83
Note: See TracChangeset
for help on using the changeset viewer.