mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -137,7 +137,8 @@ class WP_List_Table {
|
||||
*/
|
||||
public function __construct( $args = array() ) {
|
||||
$args = wp_parse_args(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'plural' => '',
|
||||
'singular' => '',
|
||||
'ajax' => false,
|
||||
@@ -274,7 +275,8 @@ class WP_List_Table {
|
||||
*/
|
||||
protected function set_pagination_args( $args ) {
|
||||
$args = wp_parse_args(
|
||||
$args, array(
|
||||
$args,
|
||||
array(
|
||||
'total_items' => 0,
|
||||
'total_pages' => 0,
|
||||
'per_page' => 0,
|
||||
@@ -360,13 +362,13 @@ class WP_List_Table {
|
||||
if ( ! empty( $_REQUEST['detached'] ) ) {
|
||||
echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<p class="search-box">
|
||||
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
|
||||
<input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
|
||||
<?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
|
||||
<?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
|
||||
</p>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -568,7 +570,8 @@ class WP_List_Table {
|
||||
WHERE post_type = %s
|
||||
$extra_checks
|
||||
ORDER BY post_date DESC
|
||||
", $post_type
|
||||
",
|
||||
$post_type
|
||||
)
|
||||
);
|
||||
|
||||
@@ -589,30 +592,30 @@ class WP_List_Table {
|
||||
}
|
||||
|
||||
$m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
|
||||
?>
|
||||
?>
|
||||
<label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
|
||||
<select name="m" id="filter-by-date">
|
||||
<option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
|
||||
<?php
|
||||
foreach ( $months as $arc_row ) {
|
||||
if ( 0 == $arc_row->year ) {
|
||||
continue;
|
||||
}
|
||||
<?php
|
||||
foreach ( $months as $arc_row ) {
|
||||
if ( 0 == $arc_row->year ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$month = zeroise( $arc_row->month, 2 );
|
||||
$year = $arc_row->year;
|
||||
$month = zeroise( $arc_row->month, 2 );
|
||||
$year = $arc_row->year;
|
||||
|
||||
printf(
|
||||
"<option %s value='%s'>%s</option>\n",
|
||||
selected( $m, $year . $month, false ),
|
||||
esc_attr( $arc_row->year . $month ),
|
||||
/* translators: 1: month name, 2: 4-digit year */
|
||||
sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
|
||||
);
|
||||
}
|
||||
?>
|
||||
printf(
|
||||
"<option %s value='%s'>%s</option>\n",
|
||||
selected( $m, $year . $month, false ),
|
||||
esc_attr( $arc_row->year . $month ),
|
||||
/* translators: 1: month name, 2: 4-digit year */
|
||||
sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -623,25 +626,25 @@ foreach ( $months as $arc_row ) {
|
||||
* @param string $current_mode
|
||||
*/
|
||||
protected function view_switcher( $current_mode ) {
|
||||
?>
|
||||
?>
|
||||
<input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
|
||||
<div class="view-switch">
|
||||
<?php
|
||||
foreach ( $this->modes as $mode => $title ) {
|
||||
$classes = array( 'view-' . $mode );
|
||||
if ( $current_mode === $mode ) {
|
||||
$classes[] = 'current';
|
||||
}
|
||||
printf(
|
||||
"<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
|
||||
esc_url( add_query_arg( 'mode', $mode ) ),
|
||||
implode( ' ', $classes ),
|
||||
$title
|
||||
);
|
||||
}
|
||||
<?php
|
||||
foreach ( $this->modes as $mode => $title ) {
|
||||
$classes = array( 'view-' . $mode );
|
||||
if ( $current_mode === $mode ) {
|
||||
$classes[] = 'current';
|
||||
}
|
||||
printf(
|
||||
"<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
|
||||
esc_url( add_query_arg( 'mode', $mode ) ),
|
||||
implode( ' ', $classes ),
|
||||
$title
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -677,7 +680,8 @@ foreach ( $this->modes as $mode => $title ) {
|
||||
array(
|
||||
'p' => $post_id,
|
||||
'comment_status' => 'approved',
|
||||
), admin_url( 'edit-comments.php' )
|
||||
),
|
||||
admin_url( 'edit-comments.php' )
|
||||
)
|
||||
),
|
||||
$approved_comments_number,
|
||||
@@ -699,7 +703,8 @@ foreach ( $this->modes as $mode => $title ) {
|
||||
array(
|
||||
'p' => $post_id,
|
||||
'comment_status' => 'moderated',
|
||||
), admin_url( 'edit-comments.php' )
|
||||
),
|
||||
admin_url( 'edit-comments.php' )
|
||||
)
|
||||
),
|
||||
$pending_comments_number,
|
||||
@@ -1152,7 +1157,7 @@ foreach ( $this->modes as $mode => $title ) {
|
||||
$this->display_tablenav( 'top' );
|
||||
|
||||
$this->screen->render_screen_reader_content( 'heading_list' );
|
||||
?>
|
||||
?>
|
||||
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -1161,10 +1166,10 @@ foreach ( $this->modes as $mode => $title ) {
|
||||
</thead>
|
||||
|
||||
<tbody id="the-list"
|
||||
<?php
|
||||
if ( $singular ) {
|
||||
echo " data-wp-lists='list:$singular'";
|
||||
}
|
||||
<?php
|
||||
if ( $singular ) {
|
||||
echo " data-wp-lists='list:$singular'";
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?php $this->display_rows_or_placeholder(); ?>
|
||||
@@ -1177,7 +1182,7 @@ foreach ( $this->modes as $mode => $title ) {
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
<?php
|
||||
<?php
|
||||
$this->display_tablenav( 'bottom' );
|
||||
}
|
||||
|
||||
@@ -1209,7 +1214,7 @@ foreach ( $this->modes as $mode => $title ) {
|
||||
<div class="alignleft actions bulkactions">
|
||||
<?php $this->bulk_actions( $which ); ?>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
endif;
|
||||
$this->extra_tablenav( $which );
|
||||
$this->pagination( $which );
|
||||
@@ -1217,7 +1222,7 @@ foreach ( $this->modes as $mode => $title ) {
|
||||
|
||||
<br class="clear" />
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user