List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used.

Props wonderboymusic, Viper007Bond.
Fixes #21249.

Built from https://develop.svn.wordpress.org/trunk@34383


git-svn-id: http://core.svn.wordpress.org/trunk@34347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-22 06:06:25 +00:00
parent 3c1e05f7c9
commit f9c2a88a8a
13 changed files with 119 additions and 112 deletions

View File

@ -183,10 +183,11 @@ class WP_Comments_List_Table extends WP_List_Table {
public function no_items() { public function no_items() {
global $comment_status; global $comment_status;
if ( 'moderated' == $comment_status ) if ( 'moderated' === $comment_status ) {
_e( 'No comments awaiting moderation.' ); _e( 'No comments awaiting moderation.' );
else } else {
_e( 'No comments found.' ); _e( 'No comments found.' );
}
} }
/** /**
@ -218,7 +219,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$link = add_query_arg( 'comment_type', $comment_type, $link ); $link = add_query_arg( 'comment_type', $comment_type, $link );
foreach ( $stati as $status => $label ) { foreach ( $stati as $status => $label ) {
$class = ( $status == $comment_status ) ? ' class="current"' : ''; $class = ( $status === $comment_status ) ? ' class="current"' : '';
if ( !isset( $num_comments->$status ) ) if ( !isset( $num_comments->$status ) )
$num_comments->$status = 10; $num_comments->$status = 10;
@ -264,10 +265,11 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) )
$actions['spam'] = _x( 'Mark as Spam', 'comment' ); $actions['spam'] = _x( 'Mark as Spam', 'comment' );
if ( 'trash' == $comment_status ) if ( 'trash' === $comment_status ) {
$actions['untrash'] = __( 'Restore' ); $actions['untrash'] = __( 'Restore' );
elseif ( 'spam' == $comment_status ) } elseif ( 'spam' === $comment_status ) {
$actions['unspam'] = _x( 'Not Spam', 'comment' ); $actions['unspam'] = _x( 'Not Spam', 'comment' );
}
if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS ) if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS )
$actions['delete'] = __( 'Delete Permanently' ); $actions['delete'] = __( 'Delete Permanently' );
@ -289,7 +291,7 @@ class WP_Comments_List_Table extends WP_List_Table {
?> ?>
<div class="alignleft actions"> <div class="alignleft actions">
<?php <?php
if ( 'top' == $which ) { if ( 'top' === $which ) {
?> ?>
<label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label> <label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label>
<select id="filter-by-comment-type" name="comment_type"> <select id="filter-by-comment-type" name="comment_type">
@ -321,9 +323,9 @@ class WP_Comments_List_Table extends WP_List_Table {
submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
} }
if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) { if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) ) {
wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
$title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
submit_button( $title, 'apply', 'delete_all', false ); submit_button( $title, 'apply', 'delete_all', false );
} }
/** /**
@ -511,9 +513,9 @@ class WP_Comments_List_Table extends WP_List_Table {
// Not looking at all comments. // Not looking at all comments.
if ( $comment_status && 'all' != $comment_status ) { if ( $comment_status && 'all' != $comment_status ) {
if ( 'approved' == $the_comment_status ) { if ( 'approved' === $the_comment_status ) {
$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
} elseif ( 'unapproved' == $the_comment_status ) { } elseif ( 'unapproved' === $the_comment_status ) {
$actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
} }
} else { } else {
@ -521,23 +523,23 @@ class WP_Comments_List_Table extends WP_List_Table {
$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
} }
if ( 'spam' != $the_comment_status ) { if ( 'spam' !== $the_comment_status ) {
$actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
} elseif ( 'spam' == $the_comment_status ) { } elseif ( 'spam' === $the_comment_status ) {
$actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>'; $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
} }
if ( 'trash' == $the_comment_status ) { if ( 'trash' === $the_comment_status ) {
$actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
} }
if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || !EMPTY_TRASH_DAYS ) {
$actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>'; $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';
} else { } else {
$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
} }
if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { if ( 'spam' !== $the_comment_status && 'trash' !== $the_comment_status ) {
$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>'; $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
$format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>'; $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
@ -554,12 +556,12 @@ class WP_Comments_List_Table extends WP_List_Table {
$out .= '<div class="row-actions">'; $out .= '<div class="row-actions">';
foreach ( $actions as $action => $link ) { foreach ( $actions as $action => $link ) {
++$i; ++$i;
( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
// Reply and quickedit need a hide-if-no-js span when not added with ajax // Reply and quickedit need a hide-if-no-js span when not added with ajax
if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') ) if ( ( 'reply' === $action || 'quickedit' === $action ) && ! defined('DOING_AJAX') )
$action .= ' hide-if-no-js'; $action .= ' hide-if-no-js';
elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) { elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) {
if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
$action .= ' approve'; $action .= ' approve';
else else
@ -669,7 +671,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$author_ip = get_comment_author_IP( $comment ); $author_ip = get_comment_author_IP( $comment );
if ( $author_ip ) { if ( $author_ip ) {
$author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), 'edit-comments.php' ); $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), 'edit-comments.php' );
if ( 'spam' == $comment_status ) { if ( 'spam' === $comment_status ) {
$author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url );
} }
printf( '<a href="%s">%s</a>', esc_url( $author_ip_url ), $author_ip ); printf( '<a href="%s">%s</a>', esc_url( $author_ip_url ), $author_ip );
@ -710,7 +712,7 @@ class WP_Comments_List_Table extends WP_List_Table {
} }
echo '<div class="response-links">'; echo '<div class="response-links">';
if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) ) { if ( 'attachment' === $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) ) {
echo $thumb; echo $thumb;
} }
echo $post_link; echo $post_link;

View File

@ -283,11 +283,13 @@ class WP_List_Table {
* @return int Number of items that correspond to the given pagination argument. * @return int Number of items that correspond to the given pagination argument.
*/ */
public function get_pagination_arg( $key ) { public function get_pagination_arg( $key ) {
if ( 'page' == $key ) if ( 'page' === $key ) {
return $this->get_pagenum(); return $this->get_pagenum();
}
if ( isset( $this->_pagination_args[$key] ) ) if ( isset( $this->_pagination_args[$key] ) ) {
return $this->_pagination_args[$key]; return $this->_pagination_args[$key];
}
} }
/** /**
@ -440,7 +442,7 @@ class WP_List_Table {
echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n"; echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
foreach ( $this->_actions as $name => $title ) { foreach ( $this->_actions as $name => $title ) {
$class = 'edit' == $name ? ' class="hide-if-no-js"' : ''; $class = 'edit' === $name ? ' class="hide-if-no-js"' : '';
echo "\t<option value='$name'$class>$title</option>\n"; echo "\t<option value='$name'$class>$title</option>\n";
} }
@ -598,7 +600,7 @@ class WP_List_Table {
<?php <?php
foreach ( $this->modes as $mode => $title ) { foreach ( $this->modes as $mode => $title ) {
$classes = array( 'view-' . $mode ); $classes = array( 'view-' . $mode );
if ( $current_mode == $mode ) if ( $current_mode === $mode )
$classes[] = 'current'; $classes[] = 'current';
printf( printf(
"<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n", "<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
@ -782,7 +784,7 @@ class WP_List_Table {
); );
} }
if ( 'bottom' == $which ) { if ( 'bottom' === $which ) {
$html_current_page = $current; $html_current_page = $current;
$total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input">'; $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input">';
} else { } else {
@ -1025,7 +1027,7 @@ class WP_List_Table {
else else
$current_orderby = ''; $current_orderby = '';
if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] ) if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] )
$current_order = 'desc'; $current_order = 'desc';
else else
$current_order = 'asc'; $current_order = 'asc';
@ -1044,7 +1046,7 @@ class WP_List_Table {
$class[] = 'hidden'; $class[] = 'hidden';
} }
if ( 'cb' == $column_key ) if ( 'cb' === $column_key )
$class[] = 'check-column'; $class[] = 'check-column';
elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
$class[] = 'num'; $class[] = 'num';
@ -1056,8 +1058,8 @@ class WP_List_Table {
if ( isset( $sortable[$column_key] ) ) { if ( isset( $sortable[$column_key] ) ) {
list( $orderby, $desc_first ) = $sortable[$column_key]; list( $orderby, $desc_first ) = $sortable[$column_key];
if ( $current_orderby == $orderby ) { if ( $current_orderby === $orderby ) {
$order = 'asc' == $current_order ? 'desc' : 'asc'; $order = 'asc' === $current_order ? 'desc' : 'asc';
$class[] = 'sorted'; $class[] = 'sorted';
$class[] = $current_order; $class[] = $current_order;
} else { } else {
@ -1136,9 +1138,9 @@ class WP_List_Table {
* @param string $which * @param string $which
*/ */
protected function display_tablenav( $which ) { protected function display_tablenav( $which ) {
if ( 'top' == $which ) if ( 'top' === $which ) {
wp_nonce_field( 'bulk-' . $this->_args['plural'] ); wp_nonce_field( 'bulk-' . $this->_args['plural'] );
}
if ( $this->has_items() ) : ?> if ( $this->has_items() ) : ?>
<div class="tablenav <?php echo esc_attr( $which ); ?>"> <div class="tablenav <?php echo esc_attr( $which ); ?>">
@ -1247,7 +1249,7 @@ class WP_List_Table {
$attributes = "class='$classes' $data"; $attributes = "class='$classes' $data";
if ( 'cb' == $column_name ) { if ( 'cb' === $column_name ) {
echo '<th scope="row" class="check-column">'; echo '<th scope="row" class="check-column">';
echo $this->column_cb( $item ); echo $this->column_cb( $item );
echo '</th>'; echo '</th>';
@ -1285,7 +1287,7 @@ class WP_List_Table {
* @return string The row actions HTML, or an empty string if the current column is the primary column. * @return string The row actions HTML, or an empty string if the current column is the primary column.
*/ */
protected function handle_row_actions( $item, $column_name, $primary ) { protected function handle_row_actions( $item, $column_name, $primary ) {
return $column_name == $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : ''; return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
} }
/** /**

View File

@ -65,7 +65,7 @@ class WP_Media_List_Table extends WP_List_Table {
list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST );
$this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' == $_REQUEST['attachment-filter']; $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter'];
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
@ -105,7 +105,7 @@ class WP_Media_List_Table extends WP_List_Table {
$filter && 0 === strpos( $filter, 'post_mime_type:' ) && $filter && 0 === strpos( $filter, 'post_mime_type:' ) &&
wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ), wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ),
true, true,
false false
); );
$type_links[$mime_type] = sprintf( $type_links[$mime_type] = sprintf(
@ -285,13 +285,13 @@ class WP_Media_List_Table extends WP_List_Table {
$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
foreach ( $taxonomies as $taxonomy ) { foreach ( $taxonomies as $taxonomy ) {
if ( 'category' == $taxonomy ) if ( 'category' === $taxonomy ) {
$column_key = 'categories'; $column_key = 'categories';
elseif ( 'post_tag' == $taxonomy ) } elseif ( 'post_tag' === $taxonomy ) {
$column_key = 'tags'; $column_key = 'tags';
else } else {
$column_key = 'taxonomy-' . $taxonomy; $column_key = 'taxonomy-' . $taxonomy;
}
$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
} }
@ -426,7 +426,7 @@ class WP_Media_List_Table extends WP_List_Table {
* @param WP_Post $post The current WP_Post object. * @param WP_Post $post The current WP_Post object.
*/ */
public function column_date( $post ) { public function column_date( $post ) {
if ( '0000-00-00 00:00:00' == $post->post_date ) { if ( '0000-00-00 00:00:00' === $post->post_date ) {
$h_time = __( 'Unpublished' ); $h_time = __( 'Unpublished' );
} else { } else {
$m_time = $post->post_date; $m_time = $post->post_date;
@ -526,9 +526,9 @@ class WP_Media_List_Table extends WP_List_Table {
* @param string $column_name Current column name. * @param string $column_name Current column name.
*/ */
public function column_default( $post, $column_name ) { public function column_default( $post, $column_name ) {
if ( 'categories' == $column_name ) { if ( 'categories' === $column_name ) {
$taxonomy = 'category'; $taxonomy = 'category';
} elseif ( 'tags' == $column_name ) { } elseif ( 'tags' === $column_name ) {
$taxonomy = 'post_tag'; $taxonomy = 'post_tag';
} elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
$taxonomy = substr( $column_name, 9 ); $taxonomy = substr( $column_name, 9 );
@ -589,7 +589,7 @@ class WP_Media_List_Table extends WP_List_Table {
while ( have_posts() ) : the_post(); while ( have_posts() ) : the_post();
if ( if (
( $this->is_trash && $post->post_status != 'trash' ) ( $this->is_trash && $post->post_status != 'trash' )
|| ( ! $this->is_trash && $post->post_status == 'trash' ) || ( ! $this->is_trash && $post->post_status === 'trash' )
) { ) {
continue; continue;
} }

View File

@ -122,24 +122,24 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
} }
$order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : ''; $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : '';
if ( $order_by == 'registered' ) { if ( $order_by === 'registered' ) {
$query .= ' ORDER BY registered '; $query .= ' ORDER BY registered ';
} elseif ( $order_by == 'lastupdated' ) { } elseif ( $order_by === 'lastupdated' ) {
$query .= ' ORDER BY last_updated '; $query .= ' ORDER BY last_updated ';
} elseif ( $order_by == 'blogname' ) { } elseif ( $order_by === 'blogname' ) {
if ( is_subdomain_install() ) { if ( is_subdomain_install() ) {
$query .= ' ORDER BY domain '; $query .= ' ORDER BY domain ';
} else { } else {
$query .= ' ORDER BY path '; $query .= ' ORDER BY path ';
} }
} elseif ( $order_by == 'blog_id' ) { } elseif ( $order_by === 'blog_id' ) {
$query .= ' ORDER BY blog_id '; $query .= ' ORDER BY blog_id ';
} else { } else {
$order_by = null; $order_by = null;
} }
if ( isset( $order_by ) ) { if ( isset( $order_by ) ) {
$order = ( isset( $_REQUEST['order'] ) && 'DESC' == strtoupper( $_REQUEST['order'] ) ) ? "DESC" : "ASC"; $order = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? "DESC" : "ASC";
$query .= $order; $query .= $order;
} }
@ -190,7 +190,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
parent::pagination( $which ); parent::pagination( $which );
if ( 'top' == $which ) if ( 'top' === $which )
$this->view_switcher( $mode ); $this->view_switcher( $mode );
} }
@ -320,13 +320,13 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
public function column_lastupdated( $blog ) { public function column_lastupdated( $blog ) {
global $mode; global $mode;
if ( 'list' == $mode ) { if ( 'list' === $mode ) {
$date = __( 'Y/m/d' ); $date = __( 'Y/m/d' );
} else { } else {
$date = __( 'Y/m/d g:i:s a' ); $date = __( 'Y/m/d g:i:s a' );
} }
echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); echo ( $blog['last_updated'] === '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
} }
/** /**
@ -340,13 +340,13 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
public function column_registered( $blog ) { public function column_registered( $blog ) {
global $mode; global $mode;
if ( 'list' == $mode ) { if ( 'list' === $mode ) {
$date = __( 'Y/m/d' ); $date = __( 'Y/m/d' );
} else { } else {
$date = __( 'Y/m/d g:i:s a' ); $date = __( 'Y/m/d g:i:s a' );
} }
if ( $blog['registered'] == '0000-00-00 00:00:00' ) { if ( $blog['registered'] === '0000-00-00 00:00:00' ) {
echo '&#x2014;'; echo '&#x2014;';
} else { } else {
echo mysql2date( $date, $blog['registered'] ); echo mysql2date( $date, $blog['registered'] );

View File

@ -41,7 +41,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$page = $this->get_pagenum(); $page = $this->get_pagenum();
$this->is_site_themes = ( 'site-themes-network' == $this->screen->id ) ? true : false; $this->is_site_themes = ( 'site-themes-network' === $this->screen->id ) ? true : false;
if ( $this->is_site_themes ) if ( $this->is_site_themes )
$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
@ -145,9 +145,10 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$orderby = ucfirst( $orderby ); $orderby = ucfirst( $orderby );
$order = strtoupper( $order ); $order = strtoupper( $order );
if ( $orderby == 'Name' ) { if ( $orderby === 'Name' ) {
if ( 'ASC' == $order ) if ( 'ASC' === $order ) {
$this->items = array_reverse( $this->items ); $this->items = array_reverse( $this->items );
}
} else { } else {
uasort( $this->items, array( $this, '_order_callback' ) ); uasort( $this->items, array( $this, '_order_callback' ) );
} }
@ -206,7 +207,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
if ( $a == $b ) if ( $a == $b )
return 0; return 0;
if ( 'DESC' == $order ) if ( 'DESC' === $order )
return ( $a < $b ) ? 1 : -1; return ( $a < $b ) ? 1 : -1;
else else
return ( $a < $b ) ? -1 : 1; return ( $a < $b ) ? -1 : 1;
@ -296,7 +297,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
if ( 'search' != $type ) { if ( 'search' != $type ) {
$status_links[$type] = sprintf( "<a href='%s' %s>%s</a>", $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>",
esc_url( add_query_arg('theme_status', $type, $url) ), esc_url( add_query_arg('theme_status', $type, $url) ),
( $type == $status ) ? ' class="current"' : '', ( $type === $status ) ? ' class="current"' : '',
sprintf( $text, number_format_i18n( $count ) ) sprintf( $text, number_format_i18n( $count ) )
); );
} }
@ -459,7 +460,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
public function column_description( $theme ) { public function column_description( $theme ) {
global $status, $totals; global $status, $totals;
if ( $theme->errors() ) { if ( $theme->errors() ) {
$pre = $status == 'broken' ? __( 'Broken Theme:' ) . ' ' : ''; $pre = $status === 'broken' ? __( 'Broken Theme:' ) . ' ' : '';
echo '<p><strong class="error-message">' . $pre . $theme->errors()->get_error_message() . '</strong></p>'; echo '<p><strong class="error-message">' . $pre . $theme->errors()->get_error_message() . '</strong></p>';
} }

View File

@ -49,7 +49,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$args['search'] = '*' . $args['search'] . '*'; $args['search'] = '*' . $args['search'] . '*';
} }
if ( $role == 'super' ) { if ( $role === 'super' ) {
$logins = implode( "', '", get_super_admins() ); $logins = implode( "', '", get_super_admins() );
$args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" ); $args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" );
} }
@ -122,7 +122,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$class = $role != 'super' ? ' class="current"' : ''; $class = $role != 'super' ? ' class="current"' : '';
$role_links = array(); $role_links = array();
$role_links['all'] = "<a href='" . network_admin_url('users.php') . "'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>'; $role_links['all'] = "<a href='" . network_admin_url('users.php') . "'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
$class = $role == 'super' ? ' class="current"' : ''; $class = $role === 'super' ? ' class="current"' : '';
$role_links['super'] = "<a href='" . network_admin_url('users.php?role=super') . "'$class>" . sprintf( _n( 'Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins ), number_format_i18n( $total_admins ) ) . '</a>'; $role_links['super'] = "<a href='" . network_admin_url('users.php?role=super') . "'$class>" . sprintf( _n( 'Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins ), number_format_i18n( $total_admins ) ) . '</a>';
return $role_links; return $role_links;
@ -137,8 +137,9 @@ class WP_MS_Users_List_Table extends WP_List_Table {
parent::pagination ( $which ); parent::pagination ( $which );
if ( 'top' == $which ) if ( 'top' === $which ) {
$this->view_switcher( $mode ); $this->view_switcher( $mode );
}
} }
/** /**
@ -268,7 +269,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
*/ */
public function column_registered( $user ) { public function column_registered( $user ) {
global $mode; global $mode;
if ( 'list' == $mode ) { if ( 'list' === $mode ) {
$date = __( 'Y/m/d' ); $date = __( 'Y/m/d' );
} else { } else {
$date = __( 'Y/m/d g:i:s a' ); $date = __( 'Y/m/d g:i:s a' );
@ -311,7 +312,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
continue; continue;
} }
$path = ( $val->path == '/' ) ? '' : $val->path; $path = ( $val->path === '/' ) ? '' : $val->path;
echo '<span class="site-' . $val->site_id . '" >'; echo '<span class="site-' . $val->site_id . '" >';
echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . get_current_site()->domain, '', $val->domain . $path ) . '</a>'; echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . get_current_site()->domain, '', $val->domain . $path ) . '</a>';
echo ' <small class="row-actions">'; echo ' <small class="row-actions">';

View File

@ -77,8 +77,9 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
// These are the tabs which are shown on the page // These are the tabs which are shown on the page
$tabs = array(); $tabs = array();
if ( 'search' == $tab ) if ( 'search' === $tab ) {
$tabs['search'] = __( 'Search Results' ); $tabs['search'] = __( 'Search Results' );
}
$tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); $tabs['featured'] = _x( 'Featured', 'Plugin Installer' );
$tabs['popular'] = _x( 'Popular', 'Plugin Installer' ); $tabs['popular'] = _x( 'Popular', 'Plugin Installer' );
$tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' ); $tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' );
@ -238,7 +239,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$display_tabs = array(); $display_tabs = array();
foreach ( (array) $tabs as $action => $text ) { foreach ( (array) $tabs as $action => $text ) {
$class = ( $action == $tab ) ? ' current' : ''; $class = ( $action === $tab ) ? ' current' : '';
$href = self_admin_url('plugin-install.php?tab=' . $action); $href = self_admin_url('plugin-install.php?tab=' . $action);
$display_tabs['plugin-install-'.$action] = "<a href='$href' class='$class'>$text</a>"; $display_tabs['plugin-install-'.$action] = "<a href='$href' class='$class'>$text</a>";
} }
@ -310,7 +311,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
return; return;
} }
if ( 'top' == $which ) { if ( 'top' === $which ) {
wp_referer_field(); wp_referer_field();
?> ?>
<div class="tablenav top"> <div class="tablenav top">
@ -367,7 +368,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
return 0; return 0;
} }
if ( 'DESC' == $this->order ) { if ( 'DESC' === $this->order ) {
return ( $a < $b ) ? 1 : -1; return ( $a < $b ) ? 1 : -1;
} else { } else {
return ( $a < $b ) ? -1 : 1; return ( $a < $b ) ? -1 : 1;

View File

@ -257,7 +257,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( $a == $b ) if ( $a == $b )
return 0; return 0;
if ( 'DESC' == $order ) { if ( 'DESC' === $order ) {
return strcasecmp( $b, $a ); return strcasecmp( $b, $a );
} else { } else {
return strcasecmp( $a, $b ); return strcasecmp( $a, $b );
@ -337,10 +337,10 @@ class WP_Plugins_List_Table extends WP_List_Table {
break; break;
} }
if ( 'search' != $type ) { if ( 'search' !== $type ) {
$status_links[$type] = sprintf( "<a href='%s' %s>%s</a>", $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>",
add_query_arg('plugin_status', $type, 'plugins.php'), add_query_arg('plugin_status', $type, 'plugins.php'),
( $type == $status ) ? ' class="current"' : '', ( $type === $status ) ? ' class="current"' : '',
sprintf( $text, number_format_i18n( $count ) ) sprintf( $text, number_format_i18n( $count ) )
); );
} }
@ -400,13 +400,13 @@ class WP_Plugins_List_Table extends WP_List_Table {
echo '<div class="alignleft actions">'; echo '<div class="alignleft actions">';
if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' == $status ) if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' === $status ) {
submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false ); submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false );
elseif ( 'top' == $which && 'mustuse' == $status ) } elseif ( 'top' === $which && 'mustuse' === $status ) {
echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>'; echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>';
elseif ( 'top' == $which && 'dropins' == $status ) } elseif ( 'top' === $which && 'dropins' === $status ) {
echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the <code>%s</code> directory that replace WordPress functionality when present.' ), str_replace( ABSPATH, '', WP_CONTENT_DIR ) ) . '</p>'; echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the <code>%s</code> directory that replace WordPress functionality when present.' ), str_replace( ABSPATH, '', WP_CONTENT_DIR ) ) . '</p>';
}
echo '</div>'; echo '</div>';
} }
@ -458,9 +458,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
'delete' => '', 'delete' => '',
); );
if ( 'mustuse' == $context ) { if ( 'mustuse' === $context ) {
$is_active = true; $is_active = true;
} elseif ( 'dropins' == $context ) { } elseif ( 'dropins' === $context ) {
$dropins = _get_dropins(); $dropins = _get_dropins();
$plugin_name = $plugin_file; $plugin_name = $plugin_file;
if ( $plugin_file != $plugin_data['Name'] ) if ( $plugin_file != $plugin_data['Name'] )

View File

@ -94,7 +94,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$_GET['author'] = get_current_user_id(); $_GET['author'] = get_current_user_id();
} }
if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) { if ( 'post' === $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) ); $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );
} }
@ -131,7 +131,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$avail_post_stati = wp_edit_posts_query(); $avail_post_stati = wp_edit_posts_query();
$this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $wp_query->query['orderby'] ); $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] );
$post_type = $this->screen->post_type; $post_type = $this->screen->post_type;
$per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' ); $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
@ -161,13 +161,13 @@ class WP_Posts_List_Table extends WP_List_Table {
$total_pages = ceil( $total_items / $per_page ); $total_pages = ceil( $total_items / $per_page );
if ( ! empty( $_REQUEST['mode'] ) ) { if ( ! empty( $_REQUEST['mode'] ) ) {
$mode = $_REQUEST['mode'] == 'excerpt' ? 'excerpt' : 'list'; $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
set_user_setting ( 'posts_list_mode', $mode ); set_user_setting ( 'posts_list_mode', $mode );
} else { } else {
$mode = get_user_setting ( 'posts_list_mode', 'list' ); $mode = get_user_setting ( 'posts_list_mode', 'list' );
} }
$this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash'; $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] === 'trash';
$this->set_pagination_args( array( $this->set_pagination_args( array(
'total_items' => $total_items, 'total_items' => $total_items,
@ -188,7 +188,7 @@ class WP_Posts_List_Table extends WP_List_Table {
* @access public * @access public
*/ */
public function no_items() { public function no_items() {
if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] ) if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] )
echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash; echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
else else
echo get_post_type_object( $this->screen->post_type )->labels->not_found; echo get_post_type_object( $this->screen->post_type )->labels->not_found;
@ -204,7 +204,7 @@ class WP_Posts_List_Table extends WP_List_Table {
protected function is_base_request() { protected function is_base_request() {
$vars = $_GET; $vars = $_GET;
unset( $vars['paged'] ); unset( $vars['paged'] );
if ( empty( $vars ) ) { if ( empty( $vars ) ) {
return true; return true;
} elseif ( 1 === count( $vars ) && ! empty( $vars['post_type'] ) ) { } elseif ( 1 === count( $vars ) && ! empty( $vars['post_type'] ) ) {
@ -326,7 +326,7 @@ class WP_Posts_List_Table extends WP_List_Table {
continue; continue;
} }
if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] ) { if ( isset($_REQUEST['post_status']) && $status_name === $_REQUEST['post_status'] ) {
$class = 'current'; $class = 'current';
} }
@ -409,7 +409,7 @@ class WP_Posts_List_Table extends WP_List_Table {
?> ?>
<div class="alignleft actions"> <div class="alignleft actions">
<?php <?php
if ( 'top' == $which && !is_singular() ) { if ( 'top' === $which && !is_singular() ) {
$this->months_dropdown( $this->screen->post_type ); $this->months_dropdown( $this->screen->post_type );
@ -471,7 +471,7 @@ class WP_Posts_List_Table extends WP_List_Table {
parent::pagination( $which ); parent::pagination( $which );
if ( 'top' == $which && ! is_post_type_hierarchical( $this->screen->post_type ) ) if ( 'top' === $which && ! is_post_type_hierarchical( $this->screen->post_type ) )
$this->view_switcher( $mode ); $this->view_switcher( $mode );
} }
@ -519,9 +519,9 @@ class WP_Posts_List_Table extends WP_List_Table {
$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
foreach ( $taxonomies as $taxonomy ) { foreach ( $taxonomies as $taxonomy ) {
if ( 'category' == $taxonomy ) if ( 'category' === $taxonomy )
$column_key = 'categories'; $column_key = 'categories';
elseif ( 'post_tag' == $taxonomy ) elseif ( 'post_tag' === $taxonomy )
$column_key = 'tags'; $column_key = 'tags';
else else
$column_key = 'taxonomy-' . $taxonomy; $column_key = 'taxonomy-' . $taxonomy;
@ -535,7 +535,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$posts_columns['date'] = __( 'Date' ); $posts_columns['date'] = __( 'Date' );
if ( 'page' == $post_type ) { if ( 'page' === $post_type ) {
/** /**
* Filter the columns displayed in the Pages list table. * Filter the columns displayed in the Pages list table.
@ -900,7 +900,7 @@ class WP_Posts_List_Table extends WP_List_Table {
echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n"; echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
} }
if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) { if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {
the_excerpt(); the_excerpt();
} }
@ -920,7 +920,7 @@ class WP_Posts_List_Table extends WP_List_Table {
public function column_date( $post ) { public function column_date( $post ) {
global $mode; global $mode;
if ( '0000-00-00 00:00:00' == $post->post_date ) { if ( '0000-00-00 00:00:00' === $post->post_date ) {
$t_time = $h_time = __( 'Unpublished' ); $t_time = $h_time = __( 'Unpublished' );
$time_diff = 0; $time_diff = 0;
} else { } else {
@ -937,9 +937,9 @@ class WP_Posts_List_Table extends WP_List_Table {
} }
} }
if ( 'publish' == $post->post_status ) { if ( 'publish' === $post->post_status ) {
_e( 'Published' ); _e( 'Published' );
} elseif ( 'future' == $post->post_status ) { } elseif ( 'future' === $post->post_status ) {
if ( $time_diff > 0 ) { if ( $time_diff > 0 ) {
echo '<strong class="error-message">' . __( 'Missed schedule' ) . '</strong>'; echo '<strong class="error-message">' . __( 'Missed schedule' ) . '</strong>';
} else { } else {
@ -949,7 +949,7 @@ class WP_Posts_List_Table extends WP_List_Table {
_e( 'Last Modified' ); _e( 'Last Modified' );
} }
echo '<br />'; echo '<br />';
if ( 'excerpt' == $mode ) { if ( 'excerpt' === $mode ) {
/** /**
* Filter the published time of the post. * Filter the published time of the post.
* *
@ -1018,9 +1018,9 @@ class WP_Posts_List_Table extends WP_List_Table {
* @param string $column_name The current column name. * @param string $column_name The current column name.
*/ */
public function column_default( $post, $column_name ) { public function column_default( $post, $column_name ) {
if ( 'categories' == $column_name ) { if ( 'categories' === $column_name ) {
$taxonomy = 'category'; $taxonomy = 'category';
} elseif ( 'tags' == $column_name ) { } elseif ( 'tags' === $column_name ) {
$taxonomy = 'post_tag'; $taxonomy = 'post_tag';
} elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
$taxonomy = substr( $column_name, 9 ); $taxonomy = substr( $column_name, 9 );
@ -1172,11 +1172,11 @@ class WP_Posts_List_Table extends WP_List_Table {
} }
if ( current_user_can( 'delete_post', $post->ID ) ) { if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( 'trash' == $post->post_status ) if ( 'trash' === $post->post_status )
$actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
elseif ( EMPTY_TRASH_DAYS ) elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) if ( 'trash' === $post->post_status || !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
} }
@ -1271,7 +1271,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$flat_taxonomies[] = $taxonomy; $flat_taxonomies[] = $taxonomy;
} }
$m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list'; $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list';
$can_publish = current_user_can( $post_type_object->cap->publish_posts ); $can_publish = current_user_can( $post_type_object->cap->publish_posts );
$core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true ); $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
@ -1379,7 +1379,7 @@ class WP_Posts_List_Table extends WP_List_Table {
<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
<span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span> <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> <input type="hidden" name="<?php echo ( $taxonomy->name === 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist"> <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?> <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
</ul> </ul>
@ -1442,7 +1442,7 @@ class WP_Posts_List_Table extends WP_List_Table {
<?php endif; // !$bulk <?php endif; // !$bulk
if ( 'page' == $screen->post_type ) : if ( 'page' === $screen->post_type ) :
?> ?>
<label> <label>
@ -1542,7 +1542,7 @@ class WP_Posts_List_Table extends WP_List_Table {
</select> </select>
</label> </label>
<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
<?php if ( $bulk ) : ?> <?php if ( $bulk ) : ?>

View File

@ -69,7 +69,7 @@ class WP_Terms_List_Table extends WP_List_Table {
public function prepare_items() { public function prepare_items() {
$tags_per_page = $this->get_items_per_page( 'edit_' . $this->screen->taxonomy . '_per_page' ); $tags_per_page = $this->get_items_per_page( 'edit_' . $this->screen->taxonomy . '_per_page' );
if ( 'post_tag' == $this->screen->taxonomy ) { if ( 'post_tag' === $this->screen->taxonomy ) {
/** /**
* Filter the number of terms displayed per page for the Tags list table. * Filter the number of terms displayed per page for the Tags list table.
* *
@ -88,7 +88,7 @@ class WP_Terms_List_Table extends WP_List_Table {
* @param int $tags_per_page Number of tags to be displayed. Default 20. * @param int $tags_per_page Number of tags to be displayed. Default 20.
*/ */
$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page );
} elseif ( 'category' == $this->screen->taxonomy ) { } elseif ( 'category' === $this->screen->taxonomy ) {
/** /**
* Filter the number of terms displayed per page for the Categories list table. * Filter the number of terms displayed per page for the Categories list table.
* *
@ -153,7 +153,7 @@ class WP_Terms_List_Table extends WP_List_Table {
* @return string * @return string
*/ */
public function current_action() { public function current_action() {
if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' == $_REQUEST['action'] || 'delete' == $_REQUEST['action2'] ) ) if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' === $_REQUEST['action'] || 'delete' === $_REQUEST['action2'] ) )
return 'bulk-delete'; return 'bulk-delete';
return parent::current_action(); return parent::current_action();
@ -171,7 +171,7 @@ class WP_Terms_List_Table extends WP_List_Table {
'slug' => __( 'Slug' ), 'slug' => __( 'Slug' ),
); );
if ( 'link_category' == $this->screen->taxonomy ) { if ( 'link_category' === $this->screen->taxonomy ) {
$columns['links'] = __( 'Links' ); $columns['links'] = __( 'Links' );
} else { } else {
$columns['posts'] = _x( 'Count', 'Number/count of items' ); $columns['posts'] = _x( 'Count', 'Number/count of items' );
@ -496,7 +496,7 @@ class WP_Terms_List_Table extends WP_List_Table {
if ( 'post' != $this->screen->post_type ) if ( 'post' != $this->screen->post_type )
$args['post_type'] = $this->screen->post_type; $args['post_type'] = $this->screen->post_type;
if ( 'attachment' == $this->screen->post_type ) if ( 'attachment' === $this->screen->post_type )
return "<a href='" . esc_url ( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>"; return "<a href='" . esc_url ( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
return "<a href='" . esc_url ( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>"; return "<a href='" . esc_url ( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";

View File

@ -50,7 +50,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
// These are the tabs which are shown on the page, // These are the tabs which are shown on the page,
$tabs = array(); $tabs = array();
$tabs['dashboard'] = __( 'Search' ); $tabs['dashboard'] = __( 'Search' );
if ( 'search' == $tab ) if ( 'search' === $tab )
$tabs['search'] = __( 'Search Results' ); $tabs['search'] = __( 'Search Results' );
$tabs['upload'] = __( 'Upload' ); $tabs['upload'] = __( 'Upload' );
$tabs['featured'] = _x( 'Featured', 'themes' ); $tabs['featured'] = _x( 'Featured', 'themes' );
@ -163,7 +163,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
$display_tabs = array(); $display_tabs = array();
foreach ( (array) $tabs as $action => $text ) { foreach ( (array) $tabs as $action => $text ) {
$class = ( $action == $tab ) ? ' class="current"' : ''; $class = ( $action === $tab ) ? ' class="current"' : '';
$href = self_admin_url('theme-install.php?tab=' . $action); $href = self_admin_url('theme-install.php?tab=' . $action);
$display_tabs['theme-install-'.$action] = "<a href='$href'$class>$text</a>"; $display_tabs['theme-install-'.$action] = "<a href='$href'$class>$text</a>";
} }

View File

@ -45,7 +45,7 @@ class WP_Users_List_Table extends WP_List_Table {
'screen' => isset( $args['screen'] ) ? $args['screen'] : null, 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
) ); ) );
$this->is_site_users = 'site-users-network' == $this->screen->id; $this->is_site_users = 'site-users-network' === $this->screen->id;
if ( $this->is_site_users ) if ( $this->is_site_users )
$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
@ -169,7 +169,7 @@ class WP_Users_List_Table extends WP_List_Table {
$class = ''; $class = '';
if ( $this_role == $role ) { if ( $this_role === $role ) {
$class = ' class="current"'; $class = ' class="current"';
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34382'; $wp_version = '4.4-alpha-34383';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.