<!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>[32644] trunk/src/wp-admin/includes: List tables: introduce the concept of a "primary" column.</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 { 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/32644">32644</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/32644","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>helen</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-05-29 02:40:52 +0000 (Fri, 29 May 2015)</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'>List tables: introduce the concept of a "primary" column.
This becomes the column that contains the row actions, and allows for a more flexibility, particularly with custom post types and list tables. To (re)define the primary column, use the `list_table_primary_column` filter, which receives the column name and the screen ID as arguments.
props stephdau, DaveAl, jesin.
see <a href="https://core.trac.wordpress.org/ticket/25408">#25408</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="#trunksrcwpadminincludesclasswplinkslisttablephp">trunk/src/wp-admin/includes/class-wp-links-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswplisttablephp">trunk/src/wp-admin/includes/class-wp-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="#trunksrcwpadminincludesclasswpmssiteslisttablephp">trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpmsthemeslisttablephp">trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpmsuserslisttablephp">trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswppluginslisttablephp">trunk/src/wp-admin/includes/class-wp-plugins-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswppostslisttablephp">trunk/src/wp-admin/includes/class-wp-posts-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswptermslisttablephp">trunk/src/wp-admin/includes/class-wp-terms-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpuserslisttablephp">trunk/src/wp-admin/includes/class-wp-users-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 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-comments-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -357,6 +357,18 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'comment';
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function display() {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -415,62 +427,33 @@
</span><span class="cx" style="display: block; padding: 0 10px"> echo "</tr>\n";
</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">- public function column_cb( $comment ) {
- if ( $this->user_can ) { ?>
- <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
- <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
- <?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Generate and display row actions links
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @param object $comment Comment being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $comment, $column_name, $primary ) {
+ global $comment_status;
+
+ if ( ! $this->user_can ) {
+ return;
+
</ins><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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- *
- * @global string $comment_status
- * @param object $comment
- */
- public function column_comment( $comment ) {
- global $comment_status;
</del><span class="cx" style="display: block; padding: 0 10px"> $post = get_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">- $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
</del><span class="cx" style="display: block; padding: 0 10px"> $the_comment_status = wp_get_comment_status( $comment->comment_ID );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<div class="comment-author">';
- $this->column_author( $comment );
- echo '</div>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $out = '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<div class="submitted-on">';
- /* translators: 2: comment date, 3: comment time */
- printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
- /* translators: comment date format. See http://php.net/date */
- get_comment_date( __( 'Y/m/d' ) ),
- get_comment_date( get_option( 'time_format' ) )
- );
-
- if ( $comment->comment_parent ) {
- $parent = get_comment( $comment->comment_parent );
- $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
- $name = get_comment_author( $parent->comment_ID );
- printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
- }
-
- echo '</div>';
- comment_text();
- if ( $this->user_can ) { ?>
- <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
- <textarea class="comment" rows="1" cols="1"><?php
- /** This filter is documented in wp-admin/includes/comment.php */
- echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
- ?></textarea>
- <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
- <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
- <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
- <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
- </div>
- <?php
- }
-
- if ( $this->user_can ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if( $primary === $column_name ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -536,7 +519,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $i = 0;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<div class="row-actions">';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $out .= '<div class="row-actions">';
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $actions as $action => $link ) {
</span><span class="cx" style="display: block; padding: 0 10px"> ++$i;
</span><span class="cx" style="display: block; padding: 0 10px"> ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -551,17 +534,75 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $action .= ' unapprove';
</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">- echo "<span class='$action'>$sep$link</span>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $out .= "<span class='$action'>$sep$link</span>";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '</div>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $out .= '</div>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ return $out;
</ins><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">+ public function column_cb( $comment ) {
+ if ( $this->user_can ) { ?>
+ <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
+ <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
+ <?php
+ }
+ }
+
</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"> * @global string $comment_status
</span><span class="cx" style="display: block; padding: 0 10px"> * @param object $comment
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function column_comment( $comment ) {
+ global $comment_status;
+ $post = get_post();
+
+ $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
+ $the_comment_status = wp_get_comment_status( $comment->comment_ID );
+
+ echo '<div class="comment-author">';
+ $this->column_author( $comment );
+ echo '</div>';
+
+ echo '<div class="submitted-on">';
+ /* translators: 2: comment date, 3: comment time */
+ printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
+ /* translators: comment date format. See http://php.net/date */
+ get_comment_date( __( 'Y/m/d' ) ),
+ get_comment_date( get_option( 'time_format' ) )
+ );
+
+ if ( $comment->comment_parent ) {
+ $parent = get_comment( $comment->comment_parent );
+ $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
+ $name = get_comment_author( $parent->comment_ID );
+ printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
+ }
+
+ echo '</div>';
+ comment_text();
+ if ( $this->user_can ) { ?>
+ <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
+ <textarea class="comment" rows="1" cols="1"><?php
+ /** This filter is documented in wp-admin/includes/comment.php */
+ echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
+ ?></textarea>
+ <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
+ <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
+ <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
+ <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
+ </div>
+ <?php
+ }
+ }
+
+ /**
+ *
+ * @global string $comment_status
+ * @param object $comment
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> public function column_author( $comment ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $comment_status;
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswplinkslisttablephp"></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-links-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-links-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-links-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -121,7 +121,19 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get name of default primary column
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'name';
+ }
+
+ /**
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @global int $cat_id
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function display_rows() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,66 +154,61 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <tr id="link-<?php echo $link->link_id; ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class = "class='column-$column_name'";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attributes = $class . $style;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch ( $column_name ) {
- case 'cb': ?>
- <th scope="row" class="check-column">
- <label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label>
- <input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" />
- </th>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'cb' === $column_name ) {
+ ?>
+ <th scope="row" class="check-column">
+ <label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label>
+ <input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" />
+ </th>
+ <?php
+ } else {
+ echo "<td $attributes>";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'name':
- echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />";
-
- $actions = array();
- $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
- $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ) . "' ) ) { return true;}return false;\">" . __( 'Delete' ) . "</a>";
- echo $this->row_actions( $actions );
-
- echo '</td>';
- break;
- case 'url':
- echo "<td $attributes><a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a></td>";
- break;
- case 'categories':
- ?><td <?php echo $attributes ?>><?php
- $cat_names = array();
- foreach ( $link->link_category as $category ) {
- $cat = get_term( $category, 'link_category', OBJECT, 'display' );
- if ( is_wp_error( $cat ) )
- echo $cat->get_error_message();
- $cat_name = $cat->name;
- if ( $cat_id != $category )
- $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
- $cat_names[] = $cat_name;
- }
- echo implode( ', ', $cat_names );
- ?></td><?php
- break;
- case 'rel':
- ?><td <?php echo $attributes ?>><?php echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; ?></td><?php
- break;
- case 'visible':
- ?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
- break;
- case 'rating':
- ?><td <?php echo $attributes ?>><?php echo $rating; ?></td><?php
- break;
- default:
- ?>
- <td <?php echo $attributes ?>><?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch ( $column_name ) {
+ case 'name':
+ echo "<strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />";
+ break;
+ case 'url':
+ echo "<a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a>";
+ break;
+ case 'categories':
+ $cat_names = array();
+ foreach ( $link->link_category as $category ) {
+ $cat = get_term( $category, 'link_category', OBJECT, 'display' );
+ if ( is_wp_error( $cat ) )
+ echo $cat->get_error_message();
+ $cat_name = $cat->name;
+ if ( $cat_id != $category )
+ $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
+ $cat_names[] = $cat_name;
+ }
+ echo implode( ', ', $cat_names );
+ break;
+ case 'rel':
+ echo empty( $link->link_rel ) ? '<br />' : $link->link_rel;
+ break;
+ case 'visible':
+ echo $visible;
+ break;
+ case 'rating':
+ echo $rating;
+ break;
+ default:
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires for each registered custom link column.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -211,9 +218,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $link_id Link ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'manage_link_custom_column', $column_name, $link->link_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ?></td>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
+ }
+
+ echo $this->handle_row_actions( $link, $column_name, $primary );
+ echo '</td>';
</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">@@ -221,4 +230,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</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">+
+ /**
+ * Generate and display row actions links
+ *
+ * @since 4.3
+ * @access protected
+ *
+ * @param object $link Link being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $link, $column_name, $primary ) {
+ if( $primary === $column_name ) {
+ $edit_link = get_edit_bookmark_link( $link );
+
+ $actions = array();
+ $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
+ $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>";
+ return $this->row_actions($actions);
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswplisttablephp"></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-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-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -795,6 +795,46 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return '';
+ }
+
+ /**
+ * Get name of primary column.
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string Filtered name of primary column
+ */
+ protected function get_primary_column_name() {
+ $columns = $this->get_columns();
+ $default = $this->get_default_primary_column_name();
+ /**
+ * Filter the name of the primary column for the current list table, with context as argument (eg: 'plugins').
+ *
+ * @since 4.3.0
+ *
+ * @param string $default Column name default for the specific list table (eg: 'name')
+ * @param string $context Screen ID for specific list table (eg: 'plugins')
+ */
+ $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
+
+ if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
+ $column = $default;
+ }
+
+ return $column;
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Get a list of all, hidden and sortable columns, with filter applied
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -834,7 +874,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $sortable[$id] = $data;
</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">- $this->_column_headers = array( $columns, $hidden, $sortable );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $primary = $this->get_primary_column_name();
+ $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->_column_headers;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1062,16 +1103,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param object $item The current item
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function single_row_columns( $item ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class = "class='$column_name column-$column_name'";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attributes = "$class$style";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'cb' == $column_name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> echo '<th scope="row" class="check-column">';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1081,17 +1126,35 @@
</span><span class="cx" style="display: block; padding: 0 10px"> elseif ( method_exists( $this, 'column_' . $column_name ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> echo "<td $attributes>";
</span><span class="cx" style="display: block; padding: 0 10px"> echo call_user_func( array( $this, 'column_' . $column_name ), $item );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $this->handle_row_actions( $item, $column_name, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</td>";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> else {
</span><span class="cx" style="display: block; padding: 0 10px"> echo "<td $attributes>";
</span><span class="cx" style="display: block; padding: 0 10px"> echo $this->column_default( $item, $column_name );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $this->handle_row_actions( $item, $column_name, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</td>";
</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><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">+ * Generate and display row actions links
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @param object $item Item being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $item, $column_name, $primary ) {
+ return '';
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Handle an incoming ajax request (called from admin-ajax.php)
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</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 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-media-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -308,19 +308,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class = "class='$column_name column-$column_name'";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attributes = $class . $style;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch ( $column_name ) {
-
- case 'cb':
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'cb' === $column_name ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <th scope="row" class="check-column">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( $user_can_edit ) { ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -329,190 +332,171 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php } ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </th>
</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">- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ echo "<td $attributes>";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'icon':
- list( $mime ) = explode( '/', $post->post_mime_type );
- $attributes = 'class="column-icon media-icon ' . $mime . '-icon"' . $style;
-?>
- <td <?php echo $attributes ?>><?php
- if ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) {
- if ( $this->is_trash || ! $user_can_edit ) {
- echo $thumb;
- } else {
-?>
- <a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
- <?php echo $thumb; ?>
- </a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch ( $column_name ) {
+ case 'icon':
+ list( $mime ) = explode( '/', $post->post_mime_type );
+ $attributes = 'class="column-icon media-icon ' . $mime . '-icon"' . $style;
</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 }
- }
-?>
- </td>
-<?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) {
+ if ( $this->is_trash || ! $user_can_edit ) {
+ echo $thumb;
+ } else { ?>
+ <a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
+ <?php echo $thumb; ?>
+ </a><?php
+ }
+ }
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'title':
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'title':
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <td <?php echo $attributes ?>><strong>
- <?php if ( $this->is_trash || ! $user_can_edit ) {
- echo $att_title;
- } else { ?>
- <a href="<?php echo get_edit_post_link( $post->ID ); ?>"
- title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
- <?php echo $att_title; ?></a>
- <?php };
- _media_states( $post ); ?></strong>
- <p class="filename"><?php echo wp_basename( $post->guid ); ?></p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <strong>
+ <?php if ( $this->is_trash || ! $user_can_edit ) {
+ echo $att_title;
+ } else { ?>
+ <a href="<?php echo get_edit_post_link( $post->ID ); ?>"
+ title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ); ?>">
+ <?php echo $att_title; ?></a>
+ <?php }
+ _media_states( $post ); ?></strong>
+ <p class="filename"><?php echo wp_basename( $post->guid ); ?></p>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
-?>
- </td>
-<?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'author':
-?>
- <td <?php echo $attributes ?>><?php
- printf( '<a href="%s">%s</a>',
- esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
- get_the_author()
- );
- ?></td>
-<?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'author':
+ printf( '<a href="%s">%s</a>',
+ esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
+ get_the_author()
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'desc':
-?>
- <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
-<?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'date':
- if ( '0000-00-00 00:00:00' == $post->post_date ) {
- $h_time = __( 'Unpublished' );
- } else {
- $m_time = $post->post_date;
- $time = get_post_time( 'G', true, $post, false );
- if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
- if ( $t_diff < 0 )
- $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'desc':
+ echo has_excerpt() ? $post->post_excerpt : '';
+ break;
+
+ case 'date':
+ if ( '0000-00-00 00:00:00' == $post->post_date ) {
+ $h_time = __( 'Unpublished' );
+ } else {
+ $m_time = $post->post_date;
+ $time = get_post_time( 'G', true, $post, false );
+ if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
+ if ( $t_diff < 0 )
+ $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
+ else
+ $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
+ } else {
+ $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
+ }
+ }
+
+ echo $h_time;
+ break;
+
+ case 'parent':
+ if ( $post->post_parent > 0 )
+ $parent = get_post( $post->post_parent );
</ins><span class="cx" style="display: block; padding: 0 10px"> else
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
- } else {
- $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
- }
- }
-?>
- <td <?php echo $attributes ?>><?php echo $h_time ?></td>
-<?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $parent = false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'parent':
- if ( $post->post_parent > 0 )
- $parent = get_post( $post->post_parent );
- else
- $parent = false;
-
- if ( $parent ) {
- $title = _draft_or_post_title( $post->post_parent );
- $parent_type = get_post_type_object( $parent->post_type );
-?>
- <td <?php echo $attributes ?>><strong>
- <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
- <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
- <?php echo $title ?></a><?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $parent ) {
+ $title = _draft_or_post_title( $post->post_parent );
+ $parent_type = get_post_type_object( $parent->post_type );
+ ?>
+ <strong>
+ <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
+ <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
+ <?php echo $title ?></a><?php
+ } else {
+ echo $title;
+ } ?></strong>,
+ <?php echo get_the_time( __( 'Y/m/d' ) ); ?><br />
+ <?php
+ if ( $user_can_edit ):
+ $detach_url = add_query_arg( array(
+ 'parent_post_id' => $post->post_parent,
+ 'media[]' => $post->ID,
+ '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
+ ), 'upload.php' ); ?>
+ <a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
+ <?php endif;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $title;
- } ?></strong>,
- <?php echo get_the_time( __( 'Y/m/d' ) ); ?><br />
- <?php
- if ( $user_can_edit ):
- $detach_url = add_query_arg( array(
- 'parent_post_id' => $post->post_parent,
- 'media[]' => $post->ID,
- '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
- ), 'upload.php' ); ?>
- <a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
- <?php endif; ?>
- </td>
-<?php
- } else {
-?>
- <td <?php echo $attributes ?>><?php _e( '(Unattached)' ); ?><br />
- <?php if ( $user_can_edit ) { ?>
- <a class="hide-if-no-js"
- onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
- href="#the-list">
- <?php _e( 'Attach' ); ?></a>
- <?php } ?></td>
-<?php
- }
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _e( '(Unattached)' ); ?><br />
+ <?php if ( $user_can_edit ) { ?>
+ <a class="hide-if-no-js"
+ onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
+ href="#the-list">
+ <?php _e( 'Attach' ); ?></a>
+ <?php }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'comments':
- $attributes = 'class="comments column-comments num"' . $style;
-?>
- <td <?php echo $attributes ?>>
- <div class="post-com-count-wrapper">
-<?php
- $pending_comments = get_pending_comments_num( $post->ID );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->comments_bubble( $post->ID, $pending_comments );
-?>
- </div>
- </td>
-<?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'comments':
+ echo '<div class="post-com-count-wrapper">';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- default:
- if ( 'categories' == $column_name )
- $taxonomy = 'category';
- elseif ( 'tags' == $column_name )
- $taxonomy = 'post_tag';
- elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
- $taxonomy = substr( $column_name, 9 );
- else
- $taxonomy = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $pending_comments = get_pending_comments_num( $post->ID );
+ $this->comments_bubble( $post->ID, $pending_comments );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $taxonomy ) {
- echo '<td ' . $attributes . '>';
- if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
- $out = array();
- foreach ( $terms as $t ) {
- $posts_in_term_qv = array();
- $posts_in_term_qv['taxonomy'] = $taxonomy;
- $posts_in_term_qv['term'] = $t->slug;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '</div>';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $out[] = sprintf( '<a href="%s">%s</a>',
- esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ),
- esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
+
+ default:
+ if ( 'categories' == $column_name )
+ $taxonomy = 'category';
+ elseif ( 'tags' == $column_name )
+ $taxonomy = 'post_tag';
+ elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
+ $taxonomy = substr( $column_name, 9 );
+ else
+ $taxonomy = false;
+
+ if ( $taxonomy ) {
+ if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
+ $out = array();
+ foreach ( $terms as $t ) {
+ $posts_in_term_qv = array();
+ $posts_in_term_qv['taxonomy'] = $taxonomy;
+ $posts_in_term_qv['term'] = $t->slug;
+
+ $out[] = sprintf( '<a href="%s">%s</a>',
+ esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ),
+ esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
+ );
+ }
+ /* translators: used between list items, there is a space after the comma */
+ echo join( __( ', ' ), $out );
+ } else {
+ echo '—';
+ }
+
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: used between list items, there is a space after the comma */
- echo join( __( ', ' ), $out );
- } else {
- echo '—';
- }
- echo '</td>';
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Fires for each custom column in the Media list table.
+ *
+ * Custom columns are registered using the 'manage_media_columns' filter.
+ *
+ * @since 2.5.0
+ *
+ * @param string $column_name Name of the custom column.
+ * @param int $post_id Attachment ID.
+ */
+ do_action( 'manage_media_custom_column', $column_name, $post->ID );
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-?>
- <td <?php echo $attributes ?>><?php
- /**
- * Fires for each custom column in the Media list table.
- *
- * Custom columns are registered using the 'manage_media_columns' filter.
- *
- * @since 2.5.0
- *
- * @param string $column_name Name of the custom column.
- * @param int $post_id Attachment ID.
- */
- do_action( 'manage_media_custom_column', $column_name, $post->ID );
- ?></td>
-<?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if( $primary === $column_name ) {
+ echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
+ }
+
+ echo '</td>';
</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">@@ -521,6 +505,18 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'title';
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Post $post
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $att_title
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpmssiteslisttablephp"></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-ms-sites-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-ms-sites-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -246,33 +246,42 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_current_site()->domain, '', $blog['domain'] ) : $blog['path'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch ( $column_name ) {
- case 'cb': ?>
- <th scope="row" class="check-column">
- <?php if ( ! is_main_site( $blog['blog_id'] ) ) : ?>
- <label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php printf( __( 'Select %s' ), $blogname ); ?></label>
- <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
- <?php endif; ?>
- </th>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'id':?>
- <th scope="row">
- <?php echo $blog['blog_id'] ?>
- </th>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'cb' === $column_name ) {
+?>
+ <th scope="row" class="check-column">
+ <?php if ( ! is_main_site( $blog['blog_id'] ) ) : ?>
+ <label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php printf( __( 'Select %s' ), $blogname ); ?></label>
+ <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
+ <?php endif; ?>
+ </th>
+<?php
+ } elseif ( 'id' === $column_name ) {
+?>
+ <th scope="row">
+ <?php echo $blog['blog_id'] ?>
+ </th>
+<?php
+ } else {
+ echo "<td $attributes>";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'blogname':
- echo "<td class='column-$column_name $column_name'$style>"; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch ( $column_name ) {
+ case 'blogname':
+ ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'list' != $mode ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -281,85 +290,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> echo '<p>' . sprintf( __( '%1$s – <em>%2$s</em>' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>';
</span><span class="cx" style="display: block; padding: 0 10px"> restore_current_blog();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Preordered.
- $actions = array(
- 'edit' => '', 'backend' => '',
- 'activate' => '', 'deactivate' => '',
- 'archive' => '', 'unarchive' => '',
- 'spam' => '', 'unspam' => '',
- 'delete' => '',
- 'visit' => '',
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'lastupdated':
+ echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
- $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
- if ( get_current_site()->blog_id != $blog['blog_id'] ) {
- if ( $blog['deleted'] == '1' ) {
- $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
- } else {
- $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
- }
-
- if ( $blog['archived'] == '1' ) {
- $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
- } else {
- $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
- }
-
- if ( $blog['spam'] == '1' ) {
- $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
- } else {
- $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
- }
-
- if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
- $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Delete' ) . '</a></span>';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'registered':
+ if ( $blog['registered'] == '0000-00-00 00:00:00' ) {
+ echo '—';
+ } else {
+ echo mysql2date( $date, $blog['registered'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
-
- /**
- * Filter the action links displayed for each site in the Sites list table.
- *
- * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
- * default for each site. The site's status determines whether to show the
- * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
- * 'Not Spam' or 'Spam' link for each site.
- *
- * @since 3.1.0
- *
- * @param array $actions An array of action links to be displayed.
- * @param int $blog_id The site ID.
- * @param string $blogname Site path, formatted depending on whether it is a sub-domain
- * or subdirectory multisite install.
- */
- $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
- echo $this->row_actions( $actions );
- ?>
- </td>
- <?php
- break;
-
- case 'lastupdated':
- echo "<td class='$column_name column-$column_name'$style>";
- echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?>
- </td>
- <?php
- break;
- case 'registered':
- echo "<td class='$column_name column-$column_name'$style>";
- if ( $blog['registered'] == '0000-00-00 00:00:00' )
- echo '—';
- else
- echo mysql2date( $date, $blog['registered'] );
- ?>
- </td>
- <?php
- break;
- case 'users':
- echo "<td class='$column_name column-$column_name'$style>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'users':
</ins><span class="cx" style="display: block; padding: 0 10px"> $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $blogusers ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $blogusers_warning = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -376,41 +321,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $blogusers_warning != '' )
</span><span class="cx" style="display: block; padding: 0 10px"> echo '<strong>' . $blogusers_warning . '</strong><br />';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ?>
- </td>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'plugins': ?>
- <?php if ( has_filter( 'wpmublogsaction' ) ) {
- echo "<td class='$column_name column-$column_name'$style>";
- /**
- * Fires inside the auxiliary 'Actions' column of the Sites list table.
- *
- * By default this column is hidden unless something is hooked to the action.
- *
- * @since MU
- *
- * @param int $blog_id The site ID.
- */
- do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
- </td>
- <?php }
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'plugins':
+ if ( has_filter( 'wpmublogsaction' ) ) {
+ /**
+ * Fires inside the auxiliary 'Actions' column of the Sites list table.
+ *
+ * By default this column is hidden unless something is hooked to the action.
+ *
+ * @since MU
+ *
+ * @param int $blog_id The site ID.
+ */
+ do_action( 'wpmublogsaction', $blog['blog_id'] );
+ }
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- default:
- echo "<td class='$column_name column-$column_name'$style>";
- /**
- * Fires for each registered custom column in the Sites list table.
- *
- * @since 3.1.0
- *
- * @param string $column_name The name of the column to display.
- * @param int $blog_id The site ID.
- */
- do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
- echo "</td>";
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ default:
+ /**
+ * Fires for each registered custom column in the Sites list table.
+ *
+ * @since 3.1.0
+ *
+ * @param string $column_name The name of the column to display.
+ * @param int $blog_id The site ID.
+ */
+ do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
+ break;
+ }
+
+ echo $this->handle_row_actions( $blog, $column_name, $primary );
+ echo '</td>';
</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">@@ -418,4 +360,92 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</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">+
+ /**
+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'blogname';
+ }
+
+ /**
+ * Generate and display row actions links
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @param object $blog Blog being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $blog, $column_name, $primary ) {
+ global $current_site;
+
+ if ( $primary === $column_name ) {
+ $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
+
+ // Preordered.
+ $actions = array(
+ 'edit' => '', 'backend' => '',
+ 'activate' => '', 'deactivate' => '',
+ 'archive' => '', 'unarchive' => '',
+ 'spam' => '', 'unspam' => '',
+ 'delete' => '',
+ 'visit' => '',
+ );
+
+ $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
+ $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
+ if ( get_current_site()->blog_id != $blog['blog_id'] ) {
+ if ( $blog['deleted'] == '1' ) {
+ $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
+ } else {
+ $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Deactivate' ) . '</a></span>';
+ }
+
+ if ( $blog['archived'] == '1' ) {
+ $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Unarchive' ) . '</a></span>';
+ } else {
+ $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
+ }
+
+ if ( $blog['spam'] == '1' ) {
+ $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
+ } else {
+ $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm' ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
+ }
+
+ if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) {
+ $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Delete' ) . '</a></span>';
+ }
+ }
+
+ $actions['visit'] = "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
+
+ /**
+ * Filter the action links displayed for each site in the Sites list table.
+ *
+ * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
+ * default for each site. The site's status determines whether to show the
+ * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
+ * 'Not Spam' or 'Spam' link for each site.
+ *
+ * @since 3.1.0
+ *
+ * @param array $actions An array of action links to be displayed.
+ * @param int $blog_id The site ID.
+ * @param string $blogname Site path, formatted depending on whether it is a sub-domain
+ * or subdirectory multisite install.
+ */
+ $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
+ return $this->row_actions( $actions );
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpmsthemeslisttablephp"></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-ms-themes-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-ms-themes-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,7 +230,19 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get name of default primary column
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'name';
+ }
+
+ /**
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @global array $totals
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string $status
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -400,7 +412,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> echo "<tr id='$id' class='$class'>";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -413,7 +425,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> case 'name':
</span><span class="cx" style="display: block; padding: 0 10px"> echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo $this->row_actions( $actions, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $primary === $column_name ) {
+ echo $this->row_actions($actions, true);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</td>";
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> case 'description':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -451,7 +465,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status );
</span><span class="cx" style="display: block; padding: 0 10px"> echo implode( ' | ', $theme_meta );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo "</div></td>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '</div>';
+ if ( $primary === $column_name ) {
+ echo $this->row_actions($actions, true);
+ }
+ echo '</td>';
</ins><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> default:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -467,6 +485,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Theme $theme Current WP_Theme object.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( $primary === $column_name ) {
+ echo $this->row_actions($actions, true);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</td>";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpmsuserslisttablephp"></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-ms-users-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-ms-users-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -180,81 +180,66 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <tr class="<?php echo trim( $class ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) :
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class = "class='$column_name column-$column_name'";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name || 'blogs' === $column_name ) {
+ $classes .= ' has-row-actions';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $primary === $column_name ) {
+ $classes .= ' column-primary';
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attributes = "$class$style";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch ( $column_name ) {
- case 'cb': ?>
- <th scope="row" class="check-column">
- <label class="screen-reader-text" for="blog_<?php echo $user->ID; ?>"><?php echo sprintf( __( 'Select %s' ), $user->user_login ); ?></label>
- <input type="checkbox" id="blog_<?php echo $user->ID ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ) ?>" />
- </th>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'cb' === $column_name ){
+ ?>
+ <th scope="row" class="check-column">
+ <label class="screen-reader-text" for="blog_<?php echo $user->ID; ?>"><?php echo sprintf( __( 'Select %s' ), $user->user_login ); ?></label>
+ <input type="checkbox" id="blog_<?php echo $user->ID ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ) ?>" />
+ </th>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ echo "<td $attributes>";
+
+ switch ( $column_name ) {
+ case 'username':
+ $avatar = get_avatar( $user->user_email, 32 );
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'username':
- $avatar = get_avatar( $user->user_email, 32 );
- $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
-
- echo "<td $attributes>"; ?>
- <?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $user->user_login, $super_admins ) )
</span><span class="cx" style="display: block; padding: 0 10px"> echo ' - ' . __( 'Super Admin' );
</span><span class="cx" style="display: block; padding: 0 10px"> ?></strong>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <br/>
- <?php
- $actions = array();
- $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php
+ break;
</ins><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( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
- $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'name':
+ echo "$user->first_name $user->last_name";
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Filter the action links displayed under each user
- * in the Network Admin Users list table.
- *
- * @since 3.2.0
- *
- * @param array $actions An array of action links to be displayed.
- * Default 'Edit', 'Delete'.
- * @param WP_User $user WP_User object.
- */
- $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
- echo $this->row_actions( $actions );
- ?>
- </td>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'email':
+ echo "<a href='mailto:$user->user_email'>$user->user_email</a>";
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'name':
- echo "<td $attributes>$user->first_name $user->last_name</td>";
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'registered':
+ if ( 'list' == $mode )
+ $date = __( 'Y/m/d' );
+ else
+ $date = __( 'Y/m/d g:i:s a' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'email':
- echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo mysql2date( $date, $user->user_registered );
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- case 'registered':
- if ( 'list' == $mode )
- $date = __( 'Y/m/d' );
- else
- $date = __( 'Y/m/d g:i:s a' );
-
- echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>";
- break;
-
- case 'blogs':
- $blogs = get_blogs_of_user( $user->ID, true );
- echo "<td $attributes>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'blogs':
+ $blogs = get_blogs_of_user( $user->ID, true );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $blogs ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $blogs as $key => $val ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !can_edit_network( $val->site_id ) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -305,17 +290,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> echo '</small></span><br/>';
</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">- ?>
- </td>
- <?php
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- default:
- echo "<td $attributes>";
- /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
- echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
- echo "</td>";
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ default:
+ /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
+ echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
+ break;
+ }
+
+ echo $this->handle_row_actions( $user, $column_name, $primary );
+ echo '</td>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> endforeach
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -323,4 +307,55 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</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">+
+ /**
+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'username';
+ }
+
+ /**
+ * Generate and display row actions links
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @param object $user User being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $user, $column_name, $primary ) {
+ $super_admins = get_super_admins();
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
+
+ if ( $primary === $column_name ) {
+ $actions = array();
+ $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
+
+ if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
+ $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
+ }
+
+ /**
+ * Filter the action links displayed under each user
+ * in the Network Admin Users list table.
+ *
+ * @since 3.2.0
+ *
+ * @param array $actions An array of action links to be displayed.
+ * Default 'Edit', 'Delete'.
+ * @param WP_User $user WP_User object.
+ */
+ $actions = apply_filters( 'ms_user_row_actions', $actions, $user );
+ return $this->row_actions( $actions );
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswppluginslisttablephp"></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-plugins-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-plugins-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-plugins-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -568,24 +568,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_slug
</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">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $extra_class = ' has-row-actions column-primary';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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"> switch ( $column_name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> case 'cb':
</span><span class="cx" style="display: block; padding: 0 10px"> echo "<th scope='row' class='check-column'>$checkbox</th>";
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> case 'name':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
- echo $this->row_actions( $actions, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $primary === $column_name || ! isset( $columns[ $primary ] ) ) {
+ echo "<td class='plugin-title $extra_class'$style><strong>$plugin_name</strong>";
+ echo $this->row_actions( $actions, true );
+ } else {
+ echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</td>";
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> case 'description':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo "<td class='column-description desc'$style>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = 'column-description desc';
+ if ( $primary === $column_name ) {
+ $classes .= " $extra_class";
+ }
+
+ echo "<td class='$classes'$style>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div class='plugin-description'>$description</div>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class='$class second plugin-version-author-uri'>";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -632,11 +644,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
</span><span class="cx" style="display: block; padding: 0 10px"> echo implode( ' | ', $plugin_meta );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $primary === $column_name ) {
+ echo $this->row_actions( $actions, true );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</div></td>";
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> default:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo "<td class='$column_name column-$column_name'$style>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name$class";
+ if ( $primary === $column_name ) {
+ $classes .= " $extra_class";
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo "<td class='$classes'$style>";
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires inside each custom column of the Plugins list table.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -647,6 +667,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $plugin_data An array of plugin data.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( $primary === $column_name ) {
+ echo $this->row_actions( $actions, true );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "</td>";
</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">@@ -682,4 +706,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Get name of default primary column for this specific list table.
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'plugin';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</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 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-posts-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -684,16 +684,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class = "class=\"$column_name column-$column_name\"";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attributes = "$class$style";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch ( $column_name ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -715,7 +719,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> case 'title':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attributes = 'class="post-title page-title column-title"' . $style;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes .= ' page-title'; // Special addition for title column
+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->hierarchical_display ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 0 == $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="lines" style="display: block; padding: 0 10px; color: #888">@@ -772,66 +777,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
</span><span class="cx" style="display: block; padding: 0 10px"> the_excerpt();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions = array();
- if ( $can_edit_post && 'trash' != $post->post_status ) {
- $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
- $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>';
- }
- if ( current_user_can( 'delete_post', $post->ID ) ) {
- 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 . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
- 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>";
- 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>";
- }
- if ( $post_type_object->public ) {
- if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
- if ( $can_edit_post ) {
- $preview_link = set_url_scheme( get_permalink( $post->ID ) );
- /** This filter is documented in wp-admin/includes/meta-boxes.php */
- $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
- $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
- }
- } elseif ( 'trash' != $post->post_status ) {
- $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $this->handle_row_actions( $post, $column_name, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_post_type_hierarchical( $post->post_type ) ) {
-
- /**
- * Filter the array of row action links on the Pages list table.
- *
- * The filter is evaluated only for hierarchical post types.
- *
- * @since 2.8.0
- *
- * @param array $actions An array of row action links. Defaults are
- * 'Edit', 'Quick Edit', 'Restore, 'Trash',
- * 'Delete Permanently', 'Preview', and 'View'.
- * @param WP_Post $post The post object.
- */
- $actions = apply_filters( 'page_row_actions', $actions, $post );
- } else {
-
- /**
- * Filter the array of row action links on the Posts list table.
- *
- * The filter is evaluated only for non-hierarchical post types.
- *
- * @since 2.8.0
- *
- * @param array $actions An array of row action links. Defaults are
- * 'Edit', 'Quick Edit', 'Restore, 'Trash',
- * 'Delete Permanently', 'Preview', and 'View'.
- * @param WP_Post $post The post object.
- */
- $actions = apply_filters( 'post_row_actions', $actions, $post );
- }
-
- echo $this->row_actions( $actions );
-
</del><span class="cx" style="display: block; padding: 0 10px"> get_inline_data( $post );
</span><span class="cx" style="display: block; padding: 0 10px"> echo '</td>';
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -887,6 +834,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> _e( 'Last Modified' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $this->handle_row_actions( $post, $column_name, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px"> echo '</td>';
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -898,7 +846,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->comments_bubble( $post->ID, $pending_comments );
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- </div></td>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ </div><?php echo $this->handle_row_actions( $post, $column_name, $primary ); ?></td>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -909,6 +857,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
</span><span class="cx" style="display: block; padding: 0 10px"> get_the_author()
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $this->handle_row_actions( $post, $column_name, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px"> ?></td>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -949,6 +898,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> echo '—';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $this->handle_row_actions( $post, $column_name, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px"> echo '</td>';
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -995,6 +945,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $post_id The current post ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo $this->handle_row_actions( $post, $column_name, $primary );
</ins><span class="cx" style="display: block; padding: 0 10px"> ?></td>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1007,6 +958,101 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return( 'title' );
+ }
+
+ /**
+ * Generate and display row actions links
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @param object $post Post being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $post, $column_name, $primary ) {
+ $title = _draft_or_post_title();
+
+ if ( $primary === $column_name ) {
+ $post_type_object = get_post_type_object( $post->post_type );
+ $can_edit_post = current_user_can( 'edit_post', $post->ID );
+ $actions = array();
+
+ if ( $can_edit_post && 'trash' != $post->post_status ) {
+ $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
+ $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick Edit' ) . '</a>';
+ }
+
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
+ 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 . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
+ 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>";
+ 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>";
+ }
+
+ if ( $post_type_object->public ) {
+ if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
+ if ( $can_edit_post ) {
+ $preview_link = set_url_scheme( get_permalink( $post->ID ) );
+ /** This filter is documented in wp-admin/includes/meta-boxes.php */
+ $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
+ $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
+ }
+ } elseif ( 'trash' != $post->post_status ) {
+ $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
+ }
+ }
+
+ if ( is_post_type_hierarchical( $post->post_type ) ) {
+
+ /**
+ * Filter the array of row action links on the Pages list table.
+ *
+ * The filter is evaluated only for hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters( 'page_row_actions', $actions, $post );
+ } else {
+
+ /**
+ * Filter the array of row action links on the Posts list table.
+ *
+ * The filter is evaluated only for non-hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters( 'post_row_actions', $actions, $post );
+ }
+
+ return $this->row_actions( $actions );
+ }
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Outputs the hidden row displayed when inline editing
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.1.0
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswptermslisttablephp"></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-terms-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-terms-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-terms-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -307,10 +307,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function column_name( $tag ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $taxonomy = $this->screen->taxonomy;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $tax = get_taxonomy( $taxonomy );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $default_term = get_option( 'default_' . $taxonomy );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $pad = str_repeat( '— ', max( 0, $this->level ) );
</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">@@ -333,42 +330,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $actions = array();
- if ( current_user_can( $tax->cap->edit_terms ) ) {
- $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
- $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';
- }
- if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
- $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
- if ( $tax->public )
- $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
-
- /**
- * Filter the action links displayed for each term in the Tags list table.
- *
- * @since 2.8.0
- * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
- *
- * @param array $actions An array of action links to be displayed. Default
- * 'Edit', 'Quick Edit', 'Delete', and 'View'.
- * @param object $tag Term object.
- */
- $actions = apply_filters( 'tag_row_actions', $actions, $tag );
-
- /**
- * Filter the action links displayed for each term in the terms list table.
- *
- * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
- *
- * @since 3.0.0
- *
- * @param array $actions An array of action links to be displayed. Default
- * 'Edit', 'Quick Edit', 'Delete', and 'View'.
- * @param object $tag Term object.
- */
- $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
-
- $out .= $this->row_actions( $actions );
</del><span class="cx" style="display: block; padding: 0 10px"> $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
</span><span class="cx" style="display: block; padding: 0 10px"> $out .= '<div class="name">' . $qe_data->name . '</div>';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -380,6 +341,77 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'name';
+ }
+
+ /**
+ * Generate and display row actions links
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @param object $tag Tag being acted upon
+ * @param string $column_name Current column name
+ * @param string $primary Primary column name
+ *
+ * @return string
+ */
+ protected function handle_row_actions( $tag, $column_name, $primary ) {
+ $taxonomy = $this->screen->taxonomy;
+ $tax = get_taxonomy( $taxonomy );
+ $default_term = get_option( 'default_' . $taxonomy );
+
+ $edit_link = esc_url( get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type ) );
+
+ if ( $primary === $column_name ) {
+ $actions = array();
+ if ( current_user_can( $tax->cap->edit_terms ) ) {
+ $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
+ $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>';
+ }
+ if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
+ $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
+ if ( $tax->public )
+ $actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
+
+ /**
+ * Filter the action links displayed for each term in the Tags list table.
+ *
+ * @since 2.8.0
+ * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
+ *
+ * @param array $actions An array of action links to be displayed. Default
+ * 'Edit', 'Quick Edit', 'Delete', and 'View'.
+ * @param object $tag Term object.
+ */
+ $actions = apply_filters( 'tag_row_actions', $actions, $tag );
+
+ /**
+ * Filter the action links displayed for each term in the terms list table.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+ *
+ * @since 3.0.0
+ *
+ * @param array $actions An array of action links to be displayed. Default
+ * 'Edit', 'Quick Edit', 'Delete', and 'View'.
+ * @param object $tag Term object.
+ */
+ $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
+
+ return $this->row_actions( $actions );
+ }
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param object $tag
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpuserslisttablephp"></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-users-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-users-list-table.php 2015-05-29 02:05:26 UTC (rev 32643)
+++ trunk/src/wp-admin/includes/class-wp-users-list-table.php 2015-05-29 02:40:52 UTC (rev 32644)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -389,7 +389,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_User $user_object WP_User object for the currently-listed user.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $actions = apply_filters( 'user_row_actions', $actions, $user_object );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $edit .= $this->row_actions( $actions );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up the checkbox ( because the user is editable, otherwise it's empty )
</span><span class="cx" style="display: block; padding: 0 10px"> $checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -403,63 +402,82 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $r = "<tr id='user-$user_object->ID'>";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $columns, $hidden ) = $this->get_column_info();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $columns as $column_name => $column_display_name ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class = "class=\"$column_name column-$column_name\"";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $classes = "$column_name column-$column_name";
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $style = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $column_name, $hidden ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $column_name, $hidden ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $style = ' style="display:none;"';
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attributes = "$class$style";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = "class='$classes'$style";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch ( $column_name ) {
- case 'cb':
- $r .= "<th scope='row' class='check-column'>$checkbox</th>";
- break;
- case 'username':
- $r .= "<td $attributes>$avatar $edit</td>";
- break;
- case 'name':
- $r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
- break;
- case 'email':
- $r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
- break;
- case 'role':
- $r .= "<td $attributes>$role_name</td>";
- break;
- case 'posts':
- $attributes = 'class="posts column-posts num"' . $style;
- $r .= "<td $attributes>";
- if ( $numposts > 0 ) {
- $r .= "<a href='edit.php?author=$user_object->ID' title='" . esc_attr__( 'View posts by this author' ) . "' class='edit'>";
- $r .= $numposts;
- $r .= '</a>';
- } else {
- $r .= 0;
- }
- $r .= "</td>";
- break;
- default:
- $r .= "<td $attributes>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'cb' === $column_name ) {
+ $r .= "<th scope='row' class='check-column'>$checkbox</th>";
+ } else {
+ $r .= "<td $attributes>";
+ switch ( $column_name ) {
+ case 'username':
+ $r .= "$avatar $edit";
+ break;
+ case 'name':
+ $r .= "$user_object->first_name $user_object->last_name";
+ break;
+ case 'email':
+ $r .= "<a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a>";
+ break;
+ case 'role':
+ $r .= $role_name;
+ break;
+ case 'posts':
+ $attributes = 'class="posts column-posts num"' . $style;
+ $r .= "";
+ if ( $numposts > 0 ) {
+ $r .= "<a href='edit.php?author=$user_object->ID' title='" . esc_attr__( 'View posts by this author' ) . "' class='edit'>";
+ $r .= $numposts;
+ $r .= '</a>';
+ } else {
+ $r .= 0;
+ }
+ break;
+ default:
+ /**
+ * Filter the display output of custom columns in the Users list table.
+ *
+ * @since 2.8.0
+ *
+ * @param string $output Custom column output. Default empty.
+ * @param string $column_name Column name.
+ * @param int $user_id ID of the currently-listed user.
+ */
+ $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Filter the display output of custom columns in the Users list table.
- *
- * @since 2.8.0
- *
- * @param string $output Custom column output. Default empty.
- * @param string $column_name Column name.
- * @param int $user_id ID of the currently-listed user.
- */
- $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
- $r .= "</td>";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $primary === $column_name ) {
+ $r .= $this->row_actions( $actions );
+ }
+ $r .= "</td>";
</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"> $r .= '</tr>';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $r;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Get name of default primary column
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string
+ */
+ protected function get_default_primary_column_name() {
+ return 'username';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>