WordPress.org

Make WordPress Core

Changeset 19573


Ignore:
Timestamp:
12/08/11 20:46:58 (2 years ago)
Author:
nacin
Message:

Remove wp_add_script_before() from 3.3. Continue to use wp_localize_script() for your data-passing needs. fixes #11520.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class.wp-scripts.php

    r19217 r19573  
    146146            $script .= "\n$after"; 
    147147 
    148         return $this->add_script_data( $handle, $script ); 
    149     } 
    150  
    151     /** 
    152      * Add extra Javascript 
    153      * 
    154      * Only if script has already been added. 
    155      * 
    156      * @param string $handle Script name 
    157      * @param string $script Extra JS to add before the script 
    158      * @return bool Successful or not 
    159      */ 
    160     function add_script_data( $handle, $script ) { 
    161         if ( !is_string( $script ) ) 
    162             return false; 
    163  
    164148        $data = $this->get_data( $handle, 'data' ); 
    165149 
  • trunk/wp-includes/functions.wp-scripts.php

    r19528 r19573  
    9898 
    9999/** 
    100  * Adds extra Javascript. 
    101  * 
    102  * Works only if the script referenced by $handle has already been added. 
    103  * Accepts string $script that will be printed before the main script tag. 
    104  * 
    105  * @since 3.3 
    106  * @see WP_Scripts::add_script_data() 
    107  */ 
    108 function wp_add_script_before( $handle, $script ) { 
    109     global $wp_scripts; 
    110     if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) { 
    111         if ( ! did_action( 'init' ) ) 
    112             _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ), 
    113                 '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' ); 
    114         return false; 
    115     } 
    116  
    117     return $wp_scripts->add_script_data( $handle, $script ); 
    118 } 
    119  
    120 /** 
    121100 * Remove a registered script. 
    122101 * 
Note: See TracChangeset for help on using the changeset viewer.