Ticket #21912: 21912.001.patch
File 21912.001.patch, 3.2 KB (added by , 13 years ago) |
---|
-
wp-includes/theme.php
1485 1485 /** 1486 1486 * Checks a theme's support for a given feature 1487 1487 * 1488 * @global array $_wp_theme_features 1488 1489 * @since 2.9.0 1489 1490 * @param string $feature the feature being checked 1490 1491 * @return boolean … … 1495 1496 if ( 'custom-header-uploads' == $feature ) 1496 1497 return current_theme_supports( 'custom-header', 'uploads' ); 1497 1498 1498 if ( !isset( $_wp_theme_features[$feature] ) )1499 return false;1499 $args = func_get_args(); 1500 $retval = true; 1500 1501 1501 // If no args passed then no extra checks need be performed 1502 if ( func_num_args() <= 1 ) 1503 return true; 1502 if ( ! isset( $_wp_theme_features[$feature] ) ) 1503 $retval = false; 1504 1504 1505 $args = array_slice( func_get_args(), 1 ); 1505 // If args passed, extra checks need to be performed 1506 if ( $retval && func_num_args() > 1 ) { 1507 $args = array_slice( $args, 1 ); 1506 1508 1507 switch ( $feature ) {1508 case 'post-thumbnails':1509 // post-thumbnails can be registered for only certain content/post types by passing1510 // an array of types to add_theme_support(). If no array was passed, then1511 // any type is accepted1512 if ( true === $_wp_theme_features[$feature] ) // Registered for all types1513 return true;1514 $content_type = $args[0];1515 return in_array( $content_type, $_wp_theme_features[$feature][0] );1516 break;1509 switch ( $feature ) { 1510 case 'post-thumbnails': 1511 // post-thumbnails can be registered for only certain content/post types by passing 1512 // an array of types to add_theme_support(). If no array was passed, then 1513 // any type is accepted 1514 if ( true === $_wp_theme_features[$feature] ) { 1515 // Registered for all types 1516 $retval = true; 1517 break; 1518 } 1517 1519 1518 case 'post-formats': 1519 // specific post formats can be registered by passing an array of types to 1520 // add_theme_support() 1521 $post_format = $args[0]; 1522 return in_array( $post_format, $_wp_theme_features[$feature][0] ); 1523 break; 1520 $retval = in_array( $args[0], $_wp_theme_features[$feature][0] ); 1521 break; 1524 1522 1525 case 'custom-header': 1526 case 'custom-background' : 1527 // specific custom header and background capabilities can be registered by passing 1528 // an array to add_theme_support() 1529 $header_support = $args[0]; 1530 return ( isset( $_wp_theme_features[$feature][0][$header_support] ) && $_wp_theme_features[$feature][0][$header_support] ); 1531 break; 1523 case 'post-formats': 1524 // specific post formats can be registered by passing an array of types to 1525 // add_theme_support() 1526 $retval = in_array( $args[0], $_wp_theme_features[$feature][0] ); 1527 break; 1528 1529 case 'custom-header': 1530 case 'custom-background' : 1531 // specific custom header and background capabilities can be registered by passing 1532 // an array to add_theme_support() 1533 $retval = ! empty( $_wp_theme_features[$feature][0][$args[0]] ); 1534 break; 1535 } 1532 1536 } 1533 1537 1534 return apply_filters( 'current_theme_supports-' . $feature, true, $args, $_wp_theme_features[$feature]);1538 return apply_filters( "current_theme_supports-{$feature}", $retval, $args, $_wp_theme_features[$feature] ); 1535 1539 } 1536 1540 1537 1541 /**