Make WordPress Core


Ignore:
Timestamp:
08/30/2012 06:57:57 PM (14 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/class.wp-dependencies.php

    r21481 r21672  
    197197        }
    198198
    199         function query( $handle, $list = 'registered' ) { // registered, queue, done, to_do
    200                 switch ( $list ) :
    201                 case 'registered':
    202                 case 'scripts': // back compat
    203                         if ( isset($this->registered[$handle]) )
    204                                 return $this->registered[$handle];
    205                         break;
    206                 case 'to_print': // back compat
    207                 case 'printed': // back compat
    208                         if ( 'to_print' == $list )
    209                                 $list = 'to_do';
    210                         else
    211                                 $list = 'printed';
    212                 default:
    213                         if ( in_array($handle, $this->$list) )
    214                                 return true;
    215                         break;
    216                 endswitch;
     199
     200        function query( $handle, $list = 'registered' ) {
     201                switch ( $list ) {
     202                        case 'registered' :
     203                        case 'scripts': // back compat
     204                                if ( isset( $this->registered[ $handle ] ) )
     205                                        return $this->registered[ $handle ];
     206                                return false;
     207
     208                        case 'enqueued' :
     209                        case 'queue' :
     210                                return in_array( $handle, $this->queue );
     211
     212                        case 'to_do' :
     213                        case 'to_print': // back compat
     214                                return in_array( $handle, $this->to_do );
     215
     216                        case 'done' :
     217                        case 'printed': // back compat
     218                                return in_array( $handle, $this->done );
     219                }
    217220                return false;
    218221        }
Note: See TracChangeset for help on using the changeset viewer.