<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[50804] trunk/src/wp-admin/includes: Coding Standards: Use strict comparison in `wp-admin/includes/class-wp-posts-list-table.php`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/50804">50804</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/50804","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-05-03 13:55:08 +0000 (Mon, 03 May 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Coding Standards: Use strict comparison in `wp-admin/includes/class-wp-posts-list-table.php`.
Includes minor code layout fixes for better readability.
See <a href="https://core.trac.wordpress.org/ticket/52627">#52627</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesclasswpcommentslisttablephp">trunk/src/wp-admin/includes/class-wp-comments-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpmedialisttablephp">trunk/src/wp-admin/includes/class-wp-media-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswppostslisttablephp">trunk/src/wp-admin/includes/class-wp-posts-list-table.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesclasswpcommentslisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-comments-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-comments-list-table.php 2021-05-02 16:52:46 UTC (rev 50803)
+++ trunk/src/wp-admin/includes/class-wp-comments-list-table.php 2021-05-03 13:55:08 UTC (rev 50804)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -413,7 +413,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $has_items ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && $has_items
+ && current_user_can( 'moderate_comments' )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
</span><span class="cx" style="display: block; padding: 0 10px"> $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
</span><span class="cx" style="display: block; padding: 0 10px"> submit_button( $title, 'apply', 'delete_all', false );
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpmedialisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-media-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-media-list-table.php 2021-05-02 16:52:46 UTC (rev 50803)
+++ trunk/src/wp-admin/includes/class-wp-media-list-table.php 2021-05-03 13:55:08 UTC (rev 50804)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -171,6 +171,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function get_bulk_actions() {
</span><span class="cx" style="display: block; padding: 0 10px"> $actions = array();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( MEDIA_TRASH ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->is_trash ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $actions['untrash'] = __( 'Restore' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -208,7 +209,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $this->is_trash && $this->has_items()
+ && current_user_can( 'edit_others_posts' )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -336,6 +339,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $column_key = 'taxonomy-' . $taxonomy;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -346,8 +350,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* translators: Column name. */
</span><span class="cx" style="display: block; padding: 0 10px"> $posts_columns['date'] = _x( 'Date', 'column name' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the Media list table columns.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -424,12 +430,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <strong<?php echo $class; ?>>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> echo $link_start;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $thumb ) :
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> endif;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> echo $title . $link_end;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> _media_states( $post );
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </strong>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -598,6 +607,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $taxonomy ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $terms = get_the_terms( $post->ID, $taxonomy );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $terms ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $out = array();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $terms as $t ) {
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswppostslisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/class-wp-posts-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/class-wp-posts-list-table.php 2021-05-02 16:52:46 UTC (rev 50803)
+++ trunk/src/wp-admin/includes/class-wp-posts-list-table.php 2021-05-03 13:55:08 UTC (rev 50804)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,33 +84,47 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $post_type = $this->screen->post_type;
</span><span class="cx" style="display: block; padding: 0 10px"> $post_type_object = get_post_type_object( $post_type );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $exclude_states = get_post_stati(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $exclude_states = get_post_stati(
</ins><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_in_admin_all_list' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->user_posts_count = (int) $wpdb->get_var(
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->prepare(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "
- SELECT COUNT( 1 )
- FROM $wpdb->posts
- WHERE post_type = %s
- AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
- AND post_author = %d
- ",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "SELECT COUNT( 1 )
+ FROM $wpdb->posts
+ WHERE post_type = %s
+ AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
+ AND post_author = %d",
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_type,
</span><span class="cx" style="display: block; padding: 0 10px"> get_current_user_id()
</span><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $this->user_posts_count && ! current_user_can( $post_type_object->cap->edit_others_posts ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $this->user_posts_count
+ && ! current_user_can( $post_type_object->cap->edit_others_posts )
+ && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] )
+ && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $_GET['author'] = get_current_user_id();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $sticky_posts = get_option( 'sticky_posts' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'post' === $post_type && $sticky_posts ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $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 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
+
+ $this->sticky_posts_count = (int) $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
+ )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,7 +165,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Is going to call wp().
</span><span class="cx" style="display: block; padding: 0 10px"> $avail_post_stati = wp_edit_posts_query();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->set_hierarchical_display(
+ is_post_type_hierarchical( $this->screen->post_type )
+ && 'menu_order title' === $wp_query->query['orderby']
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $post_type = $this->screen->post_type;
</span><span class="cx" style="display: block; padding: 0 10px"> $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -170,7 +187,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $total_items = $post_counts[ $_REQUEST['post_status'] ];
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $total_items = $this->sticky_posts_count;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( isset( $_GET['author'] ) && get_current_user_id() == $_GET['author'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( isset( $_GET['author'] ) && get_current_user_id() === (int) $_GET['author'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $total_items = $this->user_posts_count;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $total_items = array_sum( $post_counts );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -244,6 +261,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $class_html = '';
</span><span class="cx" style="display: block; padding: 0 10px"> $aria_current = '';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $class ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $class_html = sprintf(
</span><span class="cx" style="display: block; padding: 0 10px"> ' class="%s"',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -293,7 +311,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->user_posts_count && $this->user_posts_count !== $total_posts ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $_GET['author'] ) && ( $current_user_id === (int) $_GET['author'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $class = 'current';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -335,6 +353,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $status_links['all'] = $this->get_edit_link( $all_args, $all_inner_html, $class );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $mine ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $status_links['mine'] = $mine;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -513,6 +532,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $slug = str_replace( 'post-format-', '', $used_post_format->slug );
</span><span class="cx" style="display: block; padding: 0 10px"> // Pretty, translated version of the post format slug.
</span><span class="cx" style="display: block; padding: 0 10px"> $pretty_name = get_post_format_string( $slug );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Skip the standard post format.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'standard' === $slug ) {
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -565,7 +585,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $this->is_trash && $this->has_items()
+ && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -603,7 +625,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $mode_class = esc_attr( 'table-view-' . $mode );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return array( 'widefat', 'fixed', 'striped', $mode_class, is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array(
+ 'widefat',
+ 'fixed',
+ 'striped',
+ $mode_class,
+ is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts',
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -658,8 +686,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) ) {
- $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( post_type_supports( $post_type, 'comments' )
+ && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true )
+ ) {
+ $posts_columns['comments'] = sprintf(
+ '<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%2$s</span></span>',
+ esc_attr__( 'Comments' ),
+ __( 'Comments' )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $posts_columns['date'] = __( 'Date' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -789,23 +824,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * If searching, ignore hierarchy and treat everything as top level
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $_REQUEST['s'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> $top_level_pages = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $children_pages = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $pages as $page ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> // Catch and repair bad pages.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $page->post_parent == $page->ID ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $page->post_parent === $page->ID ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $page->post_parent = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
</span><span class="cx" style="display: block; padding: 0 10px"> clean_post_cache( $page );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 0 == $page->post_parent ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $page->post_parent > 0 ) {
+ $children_pages[ $page->post_parent ][] = $page;
+ } else {
</ins><span class="cx" style="display: block; padding: 0 10px"> $top_level_pages[] = $page;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- $children_pages[ $page->post_parent ][] = $page;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -892,12 +925,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If the page starts in a subtree, print the parents.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $count == $start && $page->post_parent > 0 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $count === $start && $page->post_parent > 0 ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $my_parents = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $my_parent = $page->post_parent;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> while ( $my_parent ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Get the ID from the list or the attribute if my_parent is an object.
</span><span class="cx" style="display: block; padding: 0 10px"> $parent_id = $my_parent;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_object( $my_parent ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $parent_id = $my_parent->ID;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -904,12 +939,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $my_parent = get_post( $parent_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $my_parents[] = $my_parent;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $my_parent->post_parent ) {
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $my_parent = $my_parent->post_parent;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $num_parents = count( $my_parents );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> while ( $my_parent = array_pop( $my_parents ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $to_display[ $my_parent->ID ] = $level - $num_parents;
</span><span class="cx" style="display: block; padding: 0 10px"> $num_parents--;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1004,6 +1043,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 0 === $this->current_level && (int) $post->post_parent > 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Sent level 0 by accident, by default, or because we don't know the actual level.
</span><span class="cx" style="display: block; padding: 0 10px"> $find_main_page = (int) $post->post_parent;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> while ( $find_main_page > 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $parent = get_post( $find_main_page );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1067,6 +1107,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $post_type_object = get_post_type_object( $post->post_type );
</span><span class="cx" style="display: block; padding: 0 10px"> echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</strong>\n";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'excerpt' === $mode
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1208,16 +1249,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $taxonomy = false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $taxonomy ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $taxonomy_object = get_taxonomy( $taxonomy );
</span><span class="cx" style="display: block; padding: 0 10px"> $terms = get_the_terms( $post->ID, $taxonomy );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $terms ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $term_links = array();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $terms as $t ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $posts_in_term_qv = array();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'post' !== $post->post_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $posts_in_term_qv['post_type'] = $post->post_type;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $taxonomy_object->query_var ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1312,9 +1358,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['post'] = $post;
</span><span class="cx" style="display: block; padding: 0 10px"> setup_postdata( $post );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $classes = 'iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = 'iedit author-' . ( get_current_user_id() === (int) $post->post_author ? 'self' : 'other' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $lock_holder = wp_check_post_lock( $post->ID );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $lock_holder ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $classes .= ' wp-locked';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1402,6 +1449,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> _x( 'Trash', 'verb' )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $actions['delete'] = sprintf(
</span><span class="cx" style="display: block; padding: 0 10px"> '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1501,7 +1549,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $flat_taxonomies = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $taxonomy_names as $taxonomy_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> $taxonomy = get_taxonomy( $taxonomy_name );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $show_in_quick_edit = $taxonomy->show_in_quick_edit;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1537,7 +1584,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'comments' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'author' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <form method="get">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1549,6 +1595,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $quick_edit_classes = "quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $bulk = 0;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> while ( $bulk < 2 ) :
</span><span class="cx" style="display: block; padding: 0 10px"> $classes = $inline_edit_classes . ' ';
</span><span class="cx" style="display: block; padding: 0 10px"> $classes .= $bulk ? $bulk_edit_classes : $quick_edit_classes;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1597,10 +1644,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; // $bulk ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( post_type_supports( $screen->post_type, 'author' ) ) :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( post_type_supports( $screen->post_type, 'author' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $authors_dropdown = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( current_user_can( $post_type_object->cap->edit_others_posts ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $users_opt = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'hide_if_only_one_author' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> 'who' => 'authors',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1628,20 +1675,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $users_opt = apply_filters( 'quick_edit_dropdown_authors_args', $users_opt, $bulk );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $authors = wp_dropdown_users( $users_opt );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $authors ) :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( $authors ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $authors_dropdown = '<label class="inline-edit-author">';
</span><span class="cx" style="display: block; padding: 0 10px"> $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
</span><span class="cx" style="display: block; padding: 0 10px"> $authors_dropdown .= $authors;
</span><span class="cx" style="display: block; padding: 0 10px"> $authors_dropdown .= '</label>';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- endif;
- endif; // current_user_can( 'edit_others_posts' )
- ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ } // current_user_can( 'edit_others_posts' )
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php
</del><span class="cx" style="display: block; padding: 0 10px"> if ( ! $bulk ) {
</span><span class="cx" style="display: block; padding: 0 10px"> echo $authors_dropdown;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- endif; // post_type_supports( ... 'author' )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } // post_type_supports( ... 'author' )
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( ! $bulk && $can_publish ) : ?>
</span></span></pre>
</div>
</div>
</body>
</html>