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/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}
Note: See TracChangeset for help on using the changeset viewer.