WordPress.org

Make WordPress Core

Ticket #11520: 11520.wrapper.patch

File 11520.wrapper.patch, 1.6 KB (added by ocean90, 2 years ago)
  • wp-includes/functions.wp-scripts.php

     
    6464} 
    6565 
    6666/** 
     67 * Wrapper for wp_add_script_data() 
     68 * 
     69 * @since r16 
     70 * @see wp_add_script_data() 
     71 */ 
     72function wp_localize_script( $handle, $name, $data ) { 
     73        return wp_add_script_data( $handle, $name, $data ); 
     74} 
     75 
     76/** 
    6777 * Adds extra Javascript data. 
    6878 * 
    6979 * Works only if the script has already been added. 
     
    7888 * the object would contain all values. In that case if two or more keys are the same, 
    7989 * the last value overwrites the previous. The function is named "localize_script" because of historical reasons. 
    8090 * 
    81  * @since r16 
     91 * @since 3.3 
    8292 * @see WP_Scripts::add_script_data() 
    8393 */ 
    84 function wp_localize_script( $handle, $name, $data ) { 
     94function wp_add_script_data( $handle, $name, $data ) { 
    8595        global $wp_scripts; 
    8696        if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) { 
    8797                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.')