Changeset 21672
- Timestamp:
- 08/30/2012 06:57:57 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class.wp-dependencies.php
r21481 r21672 197 197 } 198 198 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 } 217 220 return false; 218 221 } -
trunk/wp-includes/functions.wp-scripts.php
r19687 r21672 162 162 * Check whether script has been added to WordPress Scripts. 163 163 * 164 * The values for list defaults to 'queue', which is the same as enqueue for 165 * scripts. 164 * By default, checks if the script has been enqueued. You can also 165 * pass 'registered' to $list, to see if the script is registered, 166 * and you can check processing statuses with 'to_do' and 'done'. 166 167 * 167 168 * @since WP unknown; BP unknown 168 169 * 169 * @param string $handle Handle used to add script. 170 * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do' 171 * @return bool 170 * @param string $handle Name of the script. 171 * @param string $list Optional. Defaults to 'enqueued'. Values are 172 * 'registered', 'enqueued' (or 'queue'), 'to_do', and 'done'. 173 * @return bool Whether script is in the list. 172 174 */ 173 function wp_script_is( $handle, $list = ' queue' ) {175 function wp_script_is( $handle, $list = 'enqueued' ) { 174 176 global $wp_scripts; 175 177 if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) { … … 180 182 } 181 183 182 $query = $wp_scripts->query( $handle, $list ); 183 184 if ( is_object( $query ) ) 185 return true; 186 187 return $query; 184 return (bool) $wp_scripts->query( $handle, $list ); 188 185 } -
trunk/wp-includes/functions.wp-styles.php
r19687 r21672 168 168 * Check whether style has been added to WordPress Styles. 169 169 * 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'. 171 173 * 172 174 * @since WP unknown; BP unknown … … 174 176 * 175 177 * @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. 178 181 */ 179 function wp_style_is( $handle, $list = ' queue' ) {182 function wp_style_is( $handle, $list = 'enqueued' ) { 180 183 global $wp_styles; 181 184 if ( ! is_a( $wp_styles, 'WP_Styles' ) ) { … … 186 189 } 187 190 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 ); 194 192 }
Note: See TracChangeset
for help on using the changeset viewer.