Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues. This change includes three notable additions: - Multiline function calls must now put each parameter on a new line. - Auto-formatting files is now part of the `grunt precommit` script. - Auto-fixable coding standards issues will now cause Travis failures. Fixes #44600. Built from https://develop.svn.wordpress.org/trunk@43571 git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d3dee15477
commit
f7d8a35517
|
@ -35,7 +35,7 @@ get_header(); ?>
|
|||
else :
|
||||
_e( 'Archives', 'twentytwelve' );
|
||||
endif;
|
||||
?>
|
||||
?>
|
||||
</h1>
|
||||
</header><!-- .archive-header -->
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ get_header(); ?>
|
|||
<?php
|
||||
// If a user has filled out their description, show a bio on their entries.
|
||||
if ( get_the_author_meta( 'description' ) ) :
|
||||
?>
|
||||
?>
|
||||
<div class="author-info">
|
||||
<div class="author-avatar">
|
||||
<?php
|
||||
|
@ -71,7 +71,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
<?php get_template_part( 'content', get_post_format() ); ?>
|
||||
<?php endwhile; ?>
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ if ( post_password_required() ) {
|
|||
<?php
|
||||
printf(
|
||||
_n( 'One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'twentytwelve' ),
|
||||
number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>'
|
||||
number_format_i18n( get_comments_number() ),
|
||||
'<span>' . get_the_title() . '</span>'
|
||||
);
|
||||
?>
|
||||
</h2>
|
||||
|
@ -44,7 +45,7 @@ if ( post_password_required() ) {
|
|||
'style' => 'ol',
|
||||
)
|
||||
);
|
||||
?>
|
||||
?>
|
||||
</ol><!-- .commentlist -->
|
||||
|
||||
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
|
||||
|
@ -60,7 +61,7 @@ if ( post_password_required() ) {
|
|||
* But we only want the note on posts and pages that had comments in the first place.
|
||||
*/
|
||||
if ( ! comments_open() && get_comments_number() ) :
|
||||
?>
|
||||
?>
|
||||
<p class="nocomments"><?php _e( 'Comments are closed.', 'twentytwelve' ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<header class="entry-header">
|
||||
<?php if ( ! is_page_template( 'page-templates/front-page.php' ) ) : ?>
|
||||
<?php the_post_thumbnail(); ?>
|
||||
<?php the_post_thumbnail(); ?>
|
||||
<?php endif; ?>
|
||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
||||
</header>
|
||||
|
@ -25,7 +25,7 @@
|
|||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
<footer class="entry-meta">
|
||||
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ function twentytwelve_setup() {
|
|||
* and here we also set up the default background color.
|
||||
*/
|
||||
add_theme_support(
|
||||
'custom-background', array(
|
||||
'custom-background',
|
||||
array(
|
||||
'default-color' => 'e6e6e6',
|
||||
)
|
||||
);
|
||||
|
@ -330,7 +331,7 @@ if ( ! function_exists( 'twentytwelve_content_nav' ) ) :
|
|||
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentytwelve' ) ); ?></div>
|
||||
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?></div>
|
||||
</nav><!-- .navigation -->
|
||||
<?php
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
endif;
|
||||
|
@ -352,15 +353,15 @@ if ( ! function_exists( 'twentytwelve_comment' ) ) :
|
|||
case 'pingback':
|
||||
case 'trackback':
|
||||
// Display trackbacks differently than normal comments.
|
||||
?>
|
||||
?>
|
||||
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
|
||||
<p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p>
|
||||
<?php
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
// Proceed with normal comments.
|
||||
global $post;
|
||||
?>
|
||||
?>
|
||||
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
|
||||
<article id="comment-<?php comment_ID(); ?>" class="comment">
|
||||
<header class="comment-meta comment-author vcard">
|
||||
|
@ -379,7 +380,7 @@ if ( ! function_exists( 'twentytwelve_comment' ) ) :
|
|||
/* translators: 1: date, 2: time */
|
||||
sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
|
||||
);
|
||||
?>
|
||||
?>
|
||||
</header><!-- .comment-meta -->
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
|
@ -395,7 +396,8 @@ if ( ! function_exists( 'twentytwelve_comment' ) ) :
|
|||
<?php
|
||||
comment_reply_link(
|
||||
array_merge(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'reply_text' => __( 'Reply', 'twentytwelve' ),
|
||||
'after' => ' <span>↓</span>',
|
||||
'depth' => $depth,
|
||||
|
@ -403,10 +405,10 @@ if ( ! function_exists( 'twentytwelve_comment' ) ) :
|
|||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
?>
|
||||
</div><!-- .reply -->
|
||||
</article><!-- #comment-## -->
|
||||
<?php
|
||||
<?php
|
||||
break;
|
||||
endswitch; // end comment_type check
|
||||
}
|
||||
|
@ -551,14 +553,16 @@ function twentytwelve_customize_register( $wp_customize ) {
|
|||
|
||||
if ( isset( $wp_customize->selective_refresh ) ) {
|
||||
$wp_customize->selective_refresh->add_partial(
|
||||
'blogname', array(
|
||||
'blogname',
|
||||
array(
|
||||
'selector' => '.site-title > a',
|
||||
'container_inclusive' => false,
|
||||
'render_callback' => 'twentytwelve_customize_partial_blogname',
|
||||
)
|
||||
);
|
||||
$wp_customize->selective_refresh->add_partial(
|
||||
'blogdescription', array(
|
||||
'blogdescription',
|
||||
array(
|
||||
'selector' => '.site-description',
|
||||
'container_inclusive' => false,
|
||||
'render_callback' => 'twentytwelve_customize_partial_blogdescription',
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
'menu_class' => 'nav-menu',
|
||||
)
|
||||
);
|
||||
?>
|
||||
?>
|
||||
</nav><!-- #site-navigation -->
|
||||
|
||||
<?php if ( get_header_image() ) : ?>
|
||||
|
|
68
image.php
68
image.php
|
@ -17,7 +17,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>>
|
||||
<header class="entry-header">
|
||||
|
@ -51,39 +51,39 @@ get_header(); ?>
|
|||
|
||||
<div class="entry-attachment">
|
||||
<div class="attachment">
|
||||
<?php
|
||||
/*
|
||||
* Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
|
||||
* or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
|
||||
*/
|
||||
$attachments = array_values(
|
||||
get_children(
|
||||
array(
|
||||
'post_parent' => $post->post_parent,
|
||||
'post_status' => 'inherit',
|
||||
'post_type' => 'attachment',
|
||||
'post_mime_type' => 'image',
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'menu_order ID',
|
||||
)
|
||||
)
|
||||
);
|
||||
foreach ( $attachments as $k => $attachment ) :
|
||||
if ( $attachment->ID == $post->ID ) {
|
||||
break;
|
||||
}
|
||||
<?php
|
||||
/*
|
||||
* Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
|
||||
* or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
|
||||
*/
|
||||
$attachments = array_values(
|
||||
get_children(
|
||||
array(
|
||||
'post_parent' => $post->post_parent,
|
||||
'post_status' => 'inherit',
|
||||
'post_type' => 'attachment',
|
||||
'post_mime_type' => 'image',
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'menu_order ID',
|
||||
)
|
||||
)
|
||||
);
|
||||
foreach ( $attachments as $k => $attachment ) :
|
||||
if ( $attachment->ID == $post->ID ) {
|
||||
break;
|
||||
}
|
||||
endforeach;
|
||||
|
||||
// If there is more than 1 attachment in a gallery
|
||||
if ( count( $attachments ) > 1 ) :
|
||||
$k++;
|
||||
if ( isset( $attachments[ $k ] ) ) :
|
||||
// get the URL of the next image attachment
|
||||
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
|
||||
else :
|
||||
// or get the URL of the first image attachment
|
||||
$next_attachment_url = get_attachment_link( $attachments[0]->ID );
|
||||
endif;
|
||||
// If there is more than 1 attachment in a gallery
|
||||
if ( count( $attachments ) > 1 ) :
|
||||
$k++;
|
||||
if ( isset( $attachments[ $k ] ) ) :
|
||||
// get the URL of the next image attachment
|
||||
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
|
||||
else :
|
||||
// or get the URL of the first image attachment
|
||||
$next_attachment_url = get_attachment_link( $attachments[0]->ID );
|
||||
endif;
|
||||
else :
|
||||
// or, if there's only 1 image, get the URL of the image
|
||||
$next_attachment_url = wp_get_attachment_url();
|
||||
|
@ -103,7 +103,7 @@ endif;
|
|||
*/
|
||||
$attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) );
|
||||
echo wp_get_attachment_image( $post->ID, $attachment_size );
|
||||
?>
|
||||
?>
|
||||
</a>
|
||||
|
||||
<?php if ( ! empty( $post->post_excerpt ) ) : ?>
|
||||
|
@ -124,7 +124,7 @@ endif;
|
|||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
?>
|
||||
</div><!-- .entry-description -->
|
||||
|
||||
</div><!-- .entry-content -->
|
||||
|
|
|
@ -81,17 +81,17 @@ function twentytwelve_header_style() {
|
|||
<?php
|
||||
// Has the text been hidden?
|
||||
if ( ! display_header_text() ) :
|
||||
?>
|
||||
?>
|
||||
.site-title,
|
||||
.site-description {
|
||||
position: absolute;
|
||||
clip: rect(1px 1px 1px 1px); /* IE7 */
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
}
|
||||
<?php
|
||||
// If the user has set a custom color for the text, use that.
|
||||
<?php
|
||||
// If the user has set a custom color for the text, use that.
|
||||
else :
|
||||
?>
|
||||
?>
|
||||
.site-header h1 a,
|
||||
.site-header h2 {
|
||||
color: #<?php echo $text_color; ?>;
|
||||
|
@ -107,7 +107,7 @@ function twentytwelve_header_style() {
|
|||
* @since Twenty Twelve 1.0
|
||||
*/
|
||||
function twentytwelve_admin_header_style() {
|
||||
?>
|
||||
?>
|
||||
<style type="text/css" id="twentytwelve-admin-header-css">
|
||||
.appearance_page_custom-header #headimg {
|
||||
border: none;
|
||||
|
@ -138,7 +138,7 @@ function twentytwelve_admin_header_style() {
|
|||
max-width: <?php echo get_theme_support( 'custom-header', 'max-width' ); ?>px;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,9 +160,9 @@ function twentytwelve_admin_header_image() {
|
|||
<?php
|
||||
$header_image = get_header_image();
|
||||
if ( ! empty( $header_image ) ) :
|
||||
?>
|
||||
?>
|
||||
<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
<?php get_template_part( 'content', get_post_format() ); ?>
|
||||
<?php endwhile; ?>
|
||||
|
||||
|
@ -37,7 +37,7 @@ get_header(); ?>
|
|||
<?php
|
||||
if ( current_user_can( 'edit_posts' ) ) :
|
||||
// Show a different message to a logged-in user who can add posts.
|
||||
?>
|
||||
?>
|
||||
<header class="entry-header">
|
||||
<h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
|
||||
</header>
|
||||
|
@ -46,10 +46,10 @@ get_header(); ?>
|
|||
<p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
<?php
|
||||
<?php
|
||||
else :
|
||||
// Show the default message to everyone else.
|
||||
?>
|
||||
?>
|
||||
<header class="entry-header">
|
||||
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
|
||||
</header>
|
||||
|
|
|
@ -20,7 +20,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
<?php if ( has_post_thumbnail() ) : ?>
|
||||
<div class="entry-page-image">
|
||||
<?php the_post_thumbnail(); ?>
|
||||
|
|
|
@ -22,7 +22,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
<?php get_template_part( 'content', 'page' ); ?>
|
||||
<?php comments_template( '', true ); ?>
|
||||
<?php endwhile; // end of the loop. ?>
|
||||
|
|
2
page.php
2
page.php
|
@ -20,7 +20,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
<?php get_template_part( 'content', 'page' ); ?>
|
||||
<?php comments_template( '', true ); ?>
|
||||
<?php endwhile; // end of the loop. ?>
|
||||
|
|
|
@ -24,7 +24,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
<?php get_template_part( 'content', get_post_format() ); ?>
|
||||
<?php endwhile; ?>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ get_header(); ?>
|
|||
<?php
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
?>
|
||||
?>
|
||||
|
||||
<?php get_template_part( 'content', get_post_format() ); ?>
|
||||
|
||||
|
|
Loading…
Reference in New Issue