Make WordPress Core


Ignore:
Timestamp:
11/18/2013 11:11:01 PM (11 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: updates all PHP files to meet new brace style in WP coding standards. Props rickalee for initial patch, fixes #26093.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/inc/featured-content.php

    r26257 r26260  
    4747
    4848        // Return early if theme does not support Featured Content.
    49         if ( ! $theme_support )
    50             return;
     49        if ( ! $theme_support ) {
     50            return;
     51        }
    5152
    5253        /*
     
    5455         * of add_theme_support().
    5556         */
    56         if ( ! isset( $theme_support[0] ) )
    57             return;
     57        if ( ! isset( $theme_support[0] ) ) {
     58            return;
     59        }
    5860
    5961        // Return early if "featured_content_filter" has not been defined.
    60         if ( ! isset( $theme_support[0]['featured_content_filter'] ) )
    61             return;
     62        if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) {
     63            return;
     64        }
    6265
    6366        $filter = $theme_support[0]['featured_content_filter'];
    6467
    6568        // Theme can override the number of max posts.
    66         if ( isset( $theme_support[0]['max_posts'] ) )
     69        if ( isset( $theme_support[0]['max_posts'] ) ) {
    6770            self::$max_posts = absint( $theme_support[0]['max_posts'] );
     71        }
    6872
    6973        add_filter( $filter,                              array( __CLASS__, 'get_featured_posts' )    );
     
    101105
    102106        // No need to query if there is are no featured posts.
    103         if ( empty( $post_ids ) )
     107        if ( empty( $post_ids ) ) {
    104108            return array();
     109        }
    105110
    106111        $featured_posts = get_posts( array(
     
    125130        // Return array of cached results if they exist.
    126131        $featured_ids = get_transient( 'featured_content_ids' );
    127         if ( ! empty( $featured_ids ) )
     132        if ( ! empty( $featured_ids ) ) {
    128133            return array_map( 'absint', (array) $featured_ids );
     134        }
    129135
    130136        $settings = self::get_setting();
     
    132138        // Return sticky post ids if no tag name is set.
    133139        $term = get_term_by( 'name', $settings['tag-name'], 'post_tag' );
    134         if ( $term )
     140        if ( $term ) {
    135141            $tag = $term->term_id;
    136         else
     142        } else {
    137143            return self::get_sticky_posts();
     144        }
    138145
    139146        // Query for featured posts.
     
    150157
    151158        // Return array with sticky posts if no Featured Content exists.
    152         if ( ! $featured )
     159        if ( ! $featured ) {
    153160            return self::get_sticky_posts();
     161        }
    154162
    155163        // Ensure correct format before save/return.
     
    196204
    197205        // Bail if not home or not main query.
    198         if ( ! $query->is_home() || ! $query->is_main_query() )
    199             return;
     206        if ( ! $query->is_home() || ! $query->is_main_query() ) {
     207            return;
     208        }
    200209
    201210        $page_on_front = get_option( 'page_on_front' );
    202211
    203212        // Bail if the blog page is not the front page.
    204         if ( ! empty( $page_on_front ) )
    205             return;
     213        if ( ! empty( $page_on_front ) ) {
     214            return;
     215        }
    206216
    207217        $featured = self::get_featured_post_ids();
    208218
    209219        // Bail if no featured posts.
    210         if ( ! $featured )
    211             return;
     220        if ( ! $featured ) {
     221            return;
     222        }
    212223
    213224        // We need to respect post ids already in the blacklist.
     
    238249        $settings = self::get_setting();
    239250
    240         if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] )
    241             return;
     251        if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) {
     252            return;
     253        }
    242254
    243255        $settings['tag-id'] = 0;
     
    260272
    261273        // This filter is only appropriate on the front-end.
    262         if ( is_admin() )
    263             return $terms;
     274        if ( is_admin() ) {
     275            return $terms;
     276        }
    264277
    265278        // We only want to hide the featured tag.
    266         if ( ! in_array( 'post_tag', $taxonomies ) )
    267             return $terms;
     279        if ( ! in_array( 'post_tag', $taxonomies ) ) {
     280            return $terms;
     281        }
    268282
    269283        // Bail if no terms were returned.
    270         if ( empty( $terms ) )
    271             return $terms;
     284        if ( empty( $terms ) ) {
     285            return $terms;
     286        }
    272287
    273288        foreach( $terms as $order => $term ) {
    274             if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy )
     289            if ( self::get_setting( 'tag-id' ) == $term->term_id && 'post_tag' == $term->taxonomy ) {
    275290                unset( $terms[ $order ] );
     291            }
    276292        }
    277293
     
    294310
    295311        // This filter is only appropriate on the front-end.
    296         if ( is_admin() )
    297             return $terms;
     312        if ( is_admin() ) {
     313            return $terms;
     314        }
    298315
    299316        // Make sure we are in the correct taxonomy.
    300         if ( 'post_tag' != $taxonomy )
    301             return $terms;
     317        if ( 'post_tag' != $taxonomy ) {
     318            return $terms;
     319        }
    302320
    303321        // No terms? Return early!
    304         if ( empty( $terms ) )
    305             return $terms;
     322        if ( empty( $terms ) ) {
     323            return $terms;
     324        }
    306325
    307326        foreach( $terms as $order => $term ) {
    308             if ( self::get_setting( 'tag-id' ) == $term->term_id )
     327            if ( self::get_setting( 'tag-id' ) == $term->term_id ) {
    309328                unset( $terms[ $term->term_id ] );
     329            }
    310330        }
    311331
     
    402422        $options['quantity'] = self::sanitize_quantity( $options['quantity'] );
    403423
    404         if ( 'all' != $key )
     424        if ( 'all' != $key ) {
    405425            return isset( $options[ $key ] ) ? $options[ $key ] : false;
     426        }
    406427
    407428        return $options;
     
    438459        }
    439460
    440         if ( isset( $input['quantity'] ) )
     461        if ( isset( $input['quantity'] ) ) {
    441462            $output['quantity'] = self::sanitize_quantity( $input['quantity'] );
     463        }
    442464
    443465        $output['hide-tag'] = isset( $input['hide-tag'] ) && $input['hide-tag'] ? 1 : 0;
     
    459481        $quantity = absint( $input );
    460482
    461         if ( $quantity > self::$max_posts )
     483        if ( $quantity > self::$max_posts ) {
    462484            $quantity = self::$max_posts;
    463         else if ( 1 > $quantity )
     485        } else if ( 1 > $quantity ) {
    464486            $quantity = 1;
     487        }
    465488
    466489        return $quantity;
Note: See TracChangeset for help on using the changeset viewer.