Make WordPress Core

Changeset 26260


Ignore:
Timestamp:
11/18/2013 11:11:01 PM (13 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.

Location:
trunk/src/wp-content/themes/twentyfourteen
Files:
14 edited

Legend:

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

    r25769 r26260  
    1414 * entered the password we will return early without loading the comments.
    1515 */
    16 if ( post_password_required() )
     16if ( post_password_required() ) {
    1717        return;
     18}
    1819?>
    1920
  • trunk/src/wp-content/themes/twentyfourteen/content-featured-post.php

    r26152 r26260  
    1313        <?php
    1414                if ( has_post_thumbnail() ) :
    15                         if ( 'grid' == get_theme_mod( 'featured_content_layout' ) )
     15                        if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) {
    1616                                the_post_thumbnail();
    17                         else
     17                        } else {
    1818                                the_post_thumbnail( 'twentyfourteen-full-width' );
     19                        }
    1920                endif;
    2021        ?>
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r26249 r26260  
    3232 * @since Twenty Fourteen 1.0
    3333 */
    34 if ( ! isset( $content_width ) )
     34if ( ! isset( $content_width ) ) {
    3535        $content_width = 474;
     36}
    3637
    3738/**
    3839 * Twenty Fourteen only works in WordPress 3.6 or later.
    3940 */
    40 if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) )
     41if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
    4142        require get_template_directory() . '/inc/back-compat.php';
     43}
    4244
    4345if ( ! function_exists( 'twentyfourteen_setup' ) ) :
    … …  
    123125 */
    124126function twentyfourteen_content_width() {
    125         if ( is_attachment() && wp_attachment_is_image() )
     127        if ( is_attachment() && wp_attachment_is_image() ) {
    126128                $GLOBALS['content_width'] = 810;
     129        }
    127130}
    128131add_action( 'template_redirect', 'twentyfourteen_content_width' );
    … …  
    204207         * by Lato, translate this to 'off'. Do not translate into your own language.
    205208         */
    206         if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) )
     209        if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
    207210                $font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" );
     211        }
    208212
    209213        return $font_url;
    … …  
    231235        wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' );
    232236
    233         if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
     237        if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    234238                wp_enqueue_script( 'comment-reply' );
    235 
    236         if ( is_singular() && wp_attachment_is_image() )
     239        }
     240
     241        if ( is_singular() && wp_attachment_is_image() ) {
    237242                wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' );
    238 
    239         if ( is_active_sidebar( 'sidebar-3' ) )
     243        }
     244
     245        if ( is_active_sidebar( 'sidebar-3' ) ) {
    240246                wp_enqueue_script( 'jquery-masonry' );
     247        }
    241248
    242249        if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
    … …  
    304311
    305312                // get the URL of the next image attachment...
    306                 if ( $next_id )
     313                if ( $next_id ) {
    307314                        $next_attachment_url = get_attachment_link( $next_id );
     315                }
    308316
    309317                // or get the URL of the first image attachment.
    310                 else
     318                else {
    311319                        $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
     320                }
    312321        }
    313322
    … …  
    338347
    339348                // Move on if user has not published a post (yet).
    340                 if ( ! $post_count )
     349                if ( ! $post_count ) {
    341350                        continue;
     351                }
    342352        ?>
    343353
    … …  
    380390 */
    381391function twentyfourteen_body_classes( $classes ) {
    382         if ( is_multi_author() )
     392        if ( is_multi_author() ) {
    383393                $classes[] = 'group-blog';
    384 
    385         if ( get_header_image() )
     394        }
     395
     396        if ( get_header_image() ) {
    386397                $classes[] = 'header-image';
    387         else
     398        } else {
    388399                $classes[] = 'masthead-fixed';
    389 
    390         if ( is_archive() || is_search() || is_home() )
     400        }
     401
     402        if ( is_archive() || is_search() || is_home() ) {
    391403                $classes[] = 'list-view';
     404        }
    392405
    393406        if ( ( ! is_active_sidebar( 'sidebar-2' ) )
    394407                || is_page_template( 'page-templates/full-width.php' )
    395408                || is_page_template( 'page-templates/contributors.php' )
    396                 || is_attachment() )
     409                || is_attachment() ) {
    397410                $classes[] = 'full-width';
    398 
    399         if ( is_active_sidebar( 'sidebar-3' ) )
     411        }
     412
     413        if ( is_active_sidebar( 'sidebar-3' ) ) {
    400414                $classes[] = 'footer-widgets';
    401 
    402         if ( is_singular() && ! is_front_page() )
     415        }
     416
     417        if ( is_singular() && ! is_front_page() ) {
    403418                $classes[] = 'singular';
    404 
    405         if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) )
     419        }
     420
     421        if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
    406422                $classes[] = 'slider';
    407         elseif ( is_front_page() )
     423        } elseif ( is_front_page() ) {
    408424                $classes[] = 'grid';
     425        }
    409426
    410427        return $classes;
    … …  
    424441 */
    425442function twentyfourteen_post_classes( $classes ) {
    426         if ( ! post_password_required() && has_post_thumbnail() )
     443        if ( ! post_password_required() && has_post_thumbnail() ) {
    427444                $classes[] = 'has-post-thumbnail';
     445        }
    428446
    429447        return $classes;
    … …  
    444462        global $paged, $page;
    445463
    446         if ( is_feed() )
     464        if ( is_feed() ) {
    447465                return $title;
     466        }
    448467
    449468        // Add the site name.
    … …  
    452471        // Add the site description for the home/front page.
    453472        $site_description = get_bloginfo( 'description', 'display' );
    454         if ( $site_description && ( is_home() || is_front_page() ) )
     473        if ( $site_description && ( is_home() || is_front_page() ) ) {
    455474                $title = "$title $sep $site_description";
     475        }
    456476
    457477        // Add a page number if necessary.
    458         if ( $paged >= 2 || $page >= 2 )
     478        if ( $paged >= 2 || $page >= 2 ) {
    459479                $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) );
     480        }
    460481
    461482        return $title;
    … …  
    478499 * before the 'setup_theme' hook.
    479500 */
    480 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] )
     501if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
    481502        require get_template_directory() . '/inc/featured-content.php';
     503}
  • trunk/src/wp-content/themes/twentyfourteen/inc/customizer.php

    r26227 r26260  
    9898        foreach ( $rgb as $value ) {
    9999                $value += $steps;
    100                 if ( $value > 255 )
     100                if ( $value > 255 ) {
    101101                        $value = 255;
    102                 elseif ( $value < 0 )
     102                } elseif ( $value < 0 ) {
    103103                        $value = 0;
     104                }
    104105                $hex .= str_pad( dechex( $value ), 2, '0', STR_PAD_LEFT);
    105106        }
    … …  
    155156
    156157        // Don't do anything if the current color is the default.
    157         if ( '#24890d' === $accent_color )
     158        if ( '#24890d' === $accent_color ) {
    158159                return;
     160        }
    159161
    160162        $accent_mid   = get_theme_mod( 'accent_mid'   );
  • 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;
  • trunk/src/wp-content/themes/twentyfourteen/inc/template-tags.php

    r26227 r26260  
    1818function twentyfourteen_paging_nav() {
    1919        // Don't print empty markup if there's only one page.
    20         if ( $GLOBALS['wp_query']->max_num_pages < 2 )
     20        if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
    2121                return;
     22        }
    2223
    2324        $paged        = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
    … …  
    2627        $url_parts    = explode( '?', $pagenum_link );
    2728
    28         if ( isset( $url_parts[1] ) )
     29        if ( isset( $url_parts[1] ) ) {
    2930                wp_parse_str( $url_parts[1], $query_args );
     31        }
    3032
    3133        $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
    … …  
    7375        $next     = get_adjacent_post( false, '', false );
    7476
    75         if ( ! $next && ! $previous )
     77        if ( ! $next && ! $previous ) {
    7678                return;
     79        }
    7780
    7881        ?>
    … …  
    103106 */
    104107function twentyfourteen_posted_on() {
    105         if ( is_sticky() && is_home() && ! is_paged() )
     108        if ( is_sticky() && is_home() && ! is_paged() ) {
    106109                echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
     110        }
    107111
    108112        printf( __( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', 'twentyfourteen' ),
    … …  
    168172*/
    169173function twentyfourteen_post_thumbnail() {
    170         if ( post_password_required() || ! has_post_thumbnail() )
     174        if ( post_password_required() || ! has_post_thumbnail() ) {
    171175                return;
     176        }
    172177
    173178        if ( is_singular() ) :
    … …  
    176181        <div class="post-thumbnail">
    177182        <?php
    178                 if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() )
     183                if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) {
    179184                        the_post_thumbnail( 'twentyfourteen-full-width' );
    180                 else
     185                } else {
    181186                        the_post_thumbnail();
     187                }
    182188        ?>
    183189        </div>
    … …  
    187193        <a class="post-thumbnail" href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>">
    188194        <?php
    189                 if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() )
     195                if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) && ! wp_is_mobile() ) {
    190196                        the_post_thumbnail( 'twentyfourteen-full-width' );
    191                 else
     197                } else {
    192198                        the_post_thumbnail();
     199                }
    193200        ?>
    194201        </a>
  • trunk/src/wp-content/themes/twentyfourteen/inc/widgets.php

    r26225 r26260  
    232232                $instance['title']  = strip_tags( $new_instance['title'] );
    233233                $instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] );
    234                 if ( in_array( $new_instance['format'], $this->formats ) )
     234                if ( in_array( $new_instance['format'], $this->formats ) ) {
    235235                        $instance['format'] = $new_instance['format'];
     236                }
    236237
    237238                $this->flush_widget_cache();
  • trunk/src/wp-content/themes/twentyfourteen/index.php

    r25985 r26260  
    1919
    2020<?php
    21         if ( is_front_page() && twentyfourteen_has_featured_posts() )
     21        if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
    2222                get_template_part( 'featured-content' );
     23        }
    2324?>
    2425
  • trunk/src/wp-content/themes/twentyfourteen/page-templates/contributors.php

    r26105 r26260  
    1313
    1414<?php
    15         if ( is_front_page() && twentyfourteen_has_featured_posts() )
     15        if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
    1616                get_template_part( 'featured-content' );
     17        }
    1718?>
    1819
    … …  
    3637                        <?php
    3738                                        // If comments are open or we have at least one comment, load up the comment template.
    38                                         if ( comments_open() || get_comments_number() )
     39                                        if ( comments_open() || get_comments_number() ) {
    3940                                                comments_template();
     41                                        }
    4042                                endwhile;
    4143                        ?>
  • trunk/src/wp-content/themes/twentyfourteen/page-templates/full-width.php

    r26105 r26260  
    1313
    1414<?php
    15         if ( is_front_page() && twentyfourteen_has_featured_posts() )
     15        if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
    1616                get_template_part( 'featured-content' );
     17        }
    1718?>
    1819
    … …  
    2627
    2728                                        // If comments are open or we have at least one comment, load up the comment template.
    28                                         if ( comments_open() || get_comments_number() )
     29                                        if ( comments_open() || get_comments_number() ) {
    2930                                                comments_template();
     31                                        }
    3032                                endwhile;
    3133                        ?>
  • trunk/src/wp-content/themes/twentyfourteen/page.php

    r25985 r26260  
    1717
    1818<?php
    19         if ( is_front_page() && twentyfourteen_has_featured_posts() )
     19        if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
    2020                get_template_part( 'featured-content' );
     21        }
    2122?>
    2223        <div id="primary" class="content-area">
    … …  
    3031
    3132                                        // If comments are open or we have at least one comment, load up the comment template.
    32                                         if ( comments_open() || get_comments_number() )
     33                                        if ( comments_open() || get_comments_number() ) {
    3334                                                comments_template();
     35                                        }
    3436                                endwhile;
    3537                        ?>
  • trunk/src/wp-content/themes/twentyfourteen/sidebar-content.php

    r26227 r26260  
    88 */
    99
    10 if ( ! is_active_sidebar( 'sidebar-2' ) )
     10if ( ! is_active_sidebar( 'sidebar-2' ) ) {
    1111        return;
     12}
    1213?>
    1314<div id="content-sidebar" class="content-sidebar widget-area" role="complementary">
  • trunk/src/wp-content/themes/twentyfourteen/sidebar-footer.php

    r25769 r26260  
    88 */
    99
    10 if ( ! is_active_sidebar( 'sidebar-3' ) )
     10if ( ! is_active_sidebar( 'sidebar-3' ) ) {
    1111        return;
     12}
    1213?>
    1314
  • trunk/src/wp-content/themes/twentyfourteen/single.php

    r26217 r26260  
    2121
    2222                                        // If comments are open or we have at least one comment, load up the comment template.
    23                                         if ( comments_open() || get_comments_number() )
     23                                        if ( comments_open() || get_comments_number() ) {
    2424                                                comments_template();
     25                                        }
    2526                                endwhile;
    2627                        ?>
Note: See TracChangeset for help on using the changeset viewer.