WordPress.org

Make WordPress Core

Ticket #11520: 11520.wrapper.2.patch

File 11520.wrapper.2.patch, 1.7 KB (added by ocean90, 7 years ago)

Some more inline doc

  • wp-includes/functions.wp-scripts.php

     
    6464}
    6565
    6666/**
     67 * Wrapper for wp_add_script_data().
     68 *
     69 * Originally used to localizes a script.
     70 * See http://core.trac.wordpress.org/ticket/11520 for more information.
     71 *
     72 * @since r16
     73 * @see wp_add_script_data()
     74 */
     75function wp_localize_script( $handle, $object_name, $l10n ) {
     76        return wp_add_script_data( $handle, $object_name, $l10n );
     77}
     78
     79/**
    6780 * Adds extra Javascript data.
    6881 *
    6982 * Works only if the script has already been added.
     
    7891 * the object would contain all values. In that case if two or more keys are the same,
    7992 * the last value overwrites the previous. The function is named "localize_script" because of historical reasons.
    8093 *
    81  * @since r16
     94 * @since 3.3
    8295 * @see WP_Scripts::add_script_data()
    8396 */
    84 function wp_localize_script( $handle, $name, $data ) {
     97function wp_add_script_data( $handle, $name, $data ) {
    8598        global $wp_scripts;
    8699        if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
    87100                if ( ! did_action( 'init' ) )
  • wp-includes/script-loader.php

     
    498498 */
    499499function wp_just_in_time_script_localization() {
    500500
    501         wp_localize_script( 'autosave', 'autosaveL10n', array(
     501        wp_add_script_data( 'autosave', 'autosaveL10n', array(
    502502                'autosaveInterval' => AUTOSAVE_INTERVAL,
    503503                'savingText' => __('Saving Draft…'),
    504504                'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')