WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/30/2012 06:57:57 PM (9 years ago)
Author:
nacin
Message:

Have wp_script_is() and wp_style_is() accept 'enqueued', as it reads better than 'queue' and is consistent with 'registered'. fixes #21741.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.wp-styles.php

    r19687 r21672  
    168168 * Check whether style has been added to WordPress Styles.
    169169 *
    170  * The values for list defaults to 'queue', which is the same as wp_enqueue_style().
     170 * By default, checks if the style has been enqueued. You can also
     171 * pass 'registered' to $list, to see if the style is registered,
     172 * and you can check processing statuses with 'to_do' and 'done'.
    171173 *
    172174 * @since WP unknown; BP unknown
     
    174176 *
    175177 * @param string $handle Name of the stylesheet.
    176  * @param string $list Values are 'registered', 'done', 'queue' and 'to_do'.
    177  * @return bool True on success, false on failure.
     178 * @param string $list Optional. Defaults to 'enqueued'. Values are
     179 *  'registered', 'enqueued' (or 'queue'), 'to_do', and 'done'.
     180 * @return bool Whether style is in the list.
    178181 */
    179 function wp_style_is( $handle, $list = 'queue' ) {
     182function wp_style_is( $handle, $list = 'enqueued' ) {
    180183    global $wp_styles;
    181184    if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
     
    186189    }
    187190
    188     $query = $wp_styles->query( $handle, $list );
    189 
    190     if ( is_object( $query ) )
    191         return true;
    192 
    193     return $query;
     191    return (bool) $wp_styles->query( $handle, $list );
    194192}
Note: See TracChangeset for help on using the changeset viewer.