Make WordPress Core

Ticket #24089: 24089.diff

File 24089.diff, 2.1 KB (added by wonderboymusic, 12 years ago)
  • wp-includes/post-formats.php

    diff --git wp-includes/post-formats.php wp-includes/post-formats.php
    index f513210..887bb96 100644
    function has_post_format( $format, $post = null ) { 
    5656 * @return mixed WP_Error on error. Array of affected term IDs on success.
    5757 */
    5858function set_post_format( $post, $format ) {
    59         $post = get_post($post);
     59        $post = get_post( $post );
    6060
    61         if ( empty($post) )
    62                 return new WP_Error('invalid_post', __('Invalid post'));
     61        if ( empty( $post ) )
     62                return new WP_Error( 'invalid_post', __( 'Invalid post' ) );
    6363
    64         if ( !empty($format) ) {
    65                 $format = sanitize_key($format);
    66                 if ( 'standard' == $format || !in_array( $format, array_keys( get_post_format_slugs() ) ) )
     64        if ( ! empty( $format ) ) {
     65                $format = sanitize_key( $format );
     66                if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) )
    6767                        $format = '';
    6868                else
    6969                        $format = 'post-format-' . $format;
    7070        }
    7171
    72         return wp_set_post_terms($post->ID, $format, 'post_format');
     72        return wp_set_post_terms( $post->ID, $format, 'post_format' );
    7373}
    7474
    7575/**
  • wp-includes/theme.php

    diff --git wp-includes/theme.php wp-includes/theme.php
    index 2150b46..36f01b3 100644
    function add_theme_support( $feature ) { 
    12611261        switch ( $feature ) {
    12621262                case 'structured-post-formats' :
    12631263                        if ( is_array( $args[0] ) )
    1264                                 $args[0] = array_intersect( $args[0], array_keys( get_post_format_slugs() ) );
     1264                                $args[0] = array_intersect( $args[0], get_post_format_slugs() );
    12651265                        // structured-post-formats support automatically adds support for post-formats.
    12661266                        $_wp_theme_features['post-formats'] = $args;
    12671267                case 'post-formats' :
    function add_theme_support( $feature ) { 
    12691269                        if ( current_theme_supports( 'structured-post-formats' ) )
    12701270                                $args = get_theme_support( 'structured-post-formats' );
    12711271                        elseif ( is_array( $args[0] ) )
    1272                                 $args[0] = array_intersect( $args[0], array_keys( get_post_format_slugs() ) );
     1272                                $args[0] = array_intersect( $args[0], get_post_format_slugs() );
    12731273                        break;
    12741274
    12751275                case 'custom-header-uploads' :