Make WordPress Core

Ticket #14077: 14077.4.diff

File 14077.4.diff, 2.3 KB (added by SergeyBiryukov, 11 years ago)

Brings similar formatting cleanup to add_post_type_support() for consistency

  • wp-includes/post.php

     
    13061306 * and the 'comments' feature dictates whether the comments count will show on the edit screen.
    13071307 *
    13081308 * @since 3.0.0
    1309  * @param string $post_type The post type for which to add the feature
    1310  * @param string|array $feature the feature being added, can be an array of feature strings or a single string
     1309 * @param string $post_type The post type for which to add the feature.
     1310 * @param string|array $features The features being added, can be an array of feature strings or a single string.
    13111311 */
    1312 function add_post_type_support( $post_type, $feature ) {
     1312function add_post_type_support( $post_type, $features ) {
    13131313        global $_wp_post_type_features;
    13141314
    1315         $features = (array) $feature;
    1316         foreach ($features as $feature) {
     1315        foreach ( (array) $features as $feature ) {
    13171316                if ( func_num_args() == 2 )
    1318                         $_wp_post_type_features[$post_type][$feature] = true;
     1317                        $_wp_post_type_features[ $post_type ][ $feature ] = true;
    13191318                else
    1320                         $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
     1319                        $_wp_post_type_features[ $post_type ][ $feature ] = array_slice( func_get_args(), 2 );
    13211320        }
    13221321}
    13231322
     
    13251324 * Remove support for a feature from a post type.
    13261325 *
    13271326 * @since 3.0.0
    1328  * @param string $post_type The post type for which to remove the feature
    1329  * @param string $feature The feature being removed
     1327 * @param string $post_type The post type for which to remove the feature.
     1328 * @param string|array $features The features being removed. Can be an array of feature strings or a single string.
    13301329 */
    1331 function remove_post_type_support( $post_type, $feature ) {
     1330function remove_post_type_support( $post_type, $features ) {
    13321331        global $_wp_post_type_features;
    13331332
    1334         if ( !isset($_wp_post_type_features[$post_type]) )
     1333        if ( ! isset( $_wp_post_type_features[ $post_type ] ) )
    13351334                return;
    13361335
    1337         if ( isset($_wp_post_type_features[$post_type][$feature]) )
    1338                 unset($_wp_post_type_features[$post_type][$feature]);
     1336        foreach ( (array) $features as $feature ) {
     1337                if ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) )
     1338                        unset( $_wp_post_type_features[ $post_type ][ $feature ] );
     1339        }
    13391340}
    13401341
    13411342/**