WordPress.org

Make WordPress Core

Ticket #18753: functions.wp-styles.php.patch

File functions.wp-styles.php.patch, 1.8 KB (added by kobenland, 3 years ago)

Patch

  • Applications/MAMP/htdocs/wordpress-trunk/wp-includes/functions.wp-styles.php

     
    4444 * Accepts a string $data containing the CSS. If two or more CSS code blocks are 
    4545 * added to the same stylesheet $handle, they will be printed in the order 
    4646 * they were added, i.e. the latter added styles can redeclare the previous. 
    47  *  
     47 * 
    4848 * @since 3.3 
    4949 * @see WP_Scripts::add_inline_style() 
    5050 */ 
     
    6161} 
    6262 
    6363/** 
     64 * Adds data to CSS style files. 
     65 * 
     66 * Works only if the stylesheet has already been added. 
     67 * Possible values for $data_name, $data: 
     68 * 
     69 * alt                  bool                    is alternate stylesheet 
     70 * title                string                  title attribute 
     71 * conditional  string                  IE 6, lte IE 7 etc. 
     72 * rtl                  bool|string             is rtl|css href 
     73 * suffix               string                  optional suffix 
     74 * 
     75 * @see WP_Dependencies::add_data() 
     76 * 
     77 * @param string $handle Script name 
     78 * @param string $data_name Name of object in which to store extra data 
     79 * @param mixed $data 
     80 * @return bool success 
     81 */ 
     82function wp_add_style_data( $handle, $data_name, $data ) { 
     83        global $wp_styles; 
     84         
     85        if ( ! is_a( $wp_styles, 'WP_Styles' ) ) { 
     86                if ( ! did_action( 'init' ) ) 
     87                        _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ), 
     88                                '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' ); 
     89                $wp_styles = new WP_Styles(); 
     90        } 
     91 
     92        return $wp_styles->add_data( $handle, $data_name, $data ); 
     93} 
     94 
     95/** 
    6496 * Register CSS style file. 
    6597 * 
    6698 * @since r79