Make WordPress Core

Ticket #18753: 18753.diff

File 18753.diff, 1.5 KB (added by obenland, 12 years ago)
  • wp-includes/functions.wp-styles.php

     
    190190
    191191        return (bool) $wp_styles->query( $handle, $list );
    192192}
     193
     194/**
     195 * Adds data to CSS style files.
     196 *
     197 * Works only if the stylesheet has already been added.
     198 * Possible values for $data_name, $data:
     199 *
     200 * alt         bool        is alternate stylesheet
     201 * title       string      title attribute
     202 * conditional string      IE 6, lte IE 7 etc.
     203 * rtl         bool|string is rtl|css href
     204 * suffix      string      optional suffix
     205 *
     206 * @since 3.6
     207 * @see WP_Dependencies::add_data()
     208 *
     209 * @param string $handle Script name.
     210 * @param string $data_name Name of object in which to store extra data.
     211 *  Values are 'alt', 'title', 'conditional', 'rtl', and 'suffix'.
     212 * @param mixed $data
     213 * @return bool True on success, false on failure.
     214 */
     215function wp_style_add_data( $handle, $data_name, $data ) {
     216        global $wp_styles;
     217
     218        if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
     219                if ( ! did_action( 'init' ) )
     220                        _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
     221                                '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' );
     222                $wp_styles = new WP_Styles();
     223        }
     224
     225        return $wp_styles->add_data( $handle, $data_name, $data );
     226}