Merge pull request #343 from Automattic/add-braces

_s: Add braces around single-line conditionals.
This commit is contained in:
Konstantin Obenland 2013-11-24 08:23:15 -08:00
commit 6084274628
7 changed files with 27 additions and 14 deletions

View File

@ -15,8 +15,9 @@
* the visitor has not yet entered the password we will * the visitor has not yet entered the password we will
* return early without loading the comments. * return early without loading the comments.
*/ */
if ( post_password_required() ) if ( post_password_required() ) {
return; return;
}
?> ?>
<div id="comments" class="comments-area"> <div id="comments" class="comments-area">

View File

@ -8,8 +8,9 @@
/** /**
* Set the content width based on the theme's design and stylesheet. * Set the content width based on the theme's design and stylesheet.
*/ */
if ( ! isset( $content_width ) ) if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */ $content_width = 640; /* pixels */
}
if ( ! function_exists( '_s_setup' ) ) : if ( ! function_exists( '_s_setup' ) ) :
/** /**
@ -81,8 +82,9 @@ function _s_scripts() {
wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' ); wp_enqueue_script( 'comment-reply' );
}
} }
add_action( 'wp_enqueue_scripts', '_s_scripts' ); add_action( 'wp_enqueue_scripts', '_s_scripts' );

View File

@ -49,8 +49,9 @@ function _s_header_style() {
// If no custom options for text are set, let's bail // If no custom options for text are set, let's bail
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
if ( HEADER_TEXTCOLOR == $header_text_color ) if ( HEADER_TEXTCOLOR == $header_text_color ) {
return; return;
}
// If we get this far, we have custom styles. Let's do this. // If we get this far, we have custom styles. Let's do this.
?> ?>

View File

@ -27,8 +27,9 @@ add_filter( 'wp_page_menu_args', '_s_page_menu_args' );
*/ */
function _s_body_classes( $classes ) { function _s_body_classes( $classes ) {
// Adds a class of group-blog to blogs with more than 1 published author. // Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) if ( is_multi_author() ) {
$classes[] = 'group-blog'; $classes[] = 'group-blog';
}
return $classes; return $classes;
} }
@ -44,20 +45,23 @@ add_filter( 'body_class', '_s_body_classes' );
function _s_wp_title( $title, $sep ) { function _s_wp_title( $title, $sep ) {
global $page, $paged; global $page, $paged;
if ( is_feed() ) if ( is_feed() ) {
return $title; return $title;
}
// Add the blog name // Add the blog name
$title .= get_bloginfo( 'name' ); $title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page. // Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' ); $site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) if ( $site_description && ( is_home() || is_front_page() ) ) {
$title .= " $sep $site_description"; $title .= " $sep $site_description";
}
// Add a page number if necessary: // Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 ) if ( $paged >= 2 || $page >= 2 ) {
$title .= " $sep " . sprintf( __( 'Page %s', '_s' ), max( $paged, $page ) ); $title .= " $sep " . sprintf( __( 'Page %s', '_s' ), max( $paged, $page ) );
}
return $title; return $title;
} }

View File

@ -19,13 +19,15 @@ function _s_content_nav( $nav_id ) {
$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false ); $next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) if ( ! $next && ! $previous ) {
return; return;
}
} }
// Don't print empty markup in archives if there's only one page. // Don't print empty markup in archives if there's only one page.
if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) {
return; return;
}
$nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation'; $nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation';
@ -77,7 +79,7 @@ function _s_comment( $comment, $args, $depth ) {
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body"> <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
<footer class="comment-meta"> <footer class="comment-meta">
<div class="comment-author vcard"> <div class="comment-author vcard">
<?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?> <?php if ( 0 != $args['avatar_size'] ) { echo get_avatar( $comment, $args['avatar_size'] ); } ?>
<?php printf( __( '%s <span class="says">says:</span>', '_s' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?> <?php printf( __( '%s <span class="says">says:</span>', '_s' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
</div><!-- .comment-author --> </div><!-- .comment-author -->
@ -121,8 +123,9 @@ if ( ! function_exists( '_s_posted_on' ) ) :
*/ */
function _s_posted_on() { function _s_posted_on() {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>'; $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>'; $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string, $time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ), esc_attr( get_the_date( 'c' ) ),

View File

@ -21,8 +21,9 @@ get_header(); ?>
<?php <?php
// If comments are open or we have at least one comment, load up the comment template // If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) if ( comments_open() || '0' != get_comments_number() ) :
comments_template(); comments_template();
endif;
?> ?>
<?php endwhile; // end of the loop. ?> <?php endwhile; // end of the loop. ?>

View File

@ -18,8 +18,9 @@ get_header(); ?>
<?php <?php
// If comments are open or we have at least one comment, load up the comment template // If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) if ( comments_open() || '0' != get_comments_number() ) :
comments_template(); comments_template();
endif;
?> ?>
<?php endwhile; // end of the loop. ?> <?php endwhile; // end of the loop. ?>