<!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>[2752] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: Plugin Directory: Allow plugin committers to be added and removed.</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="http://meta.trac.wordpress.org/changeset/2752">2752</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/2752","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-03-15 20:02:51 +0000 (Tue, 15 Mar 2016)</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'>Plugin Directory: Allow plugin committers to be added and removed.
Still needs cap checks.
Uses `wpList` to seemlessly add/remove committers. Works similar to the
category meta box.
See <a href="http://meta.trac.wordpress.org/ticket/1571">#1571</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscustomizationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscommittersphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassinternalnotesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-internal-notes.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectorycsseditformcss">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/css/edit-form.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryjseditformjs">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/js/edit-form.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscommitterslisttablephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-committers-list-table.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscommitterslisttablephp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-committers-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-committers-list-table.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-committers-list-table.php 2016-03-15 20:02:51 UTC (rev 2752)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,217 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\Admin;
+use WordPressdotorg\Plugin_Directory\Tools;
+
+_get_list_table( 'WP_List_Table' );
+
+/**
+ * Comments list table for comments meta box.
+ *
+ * @package WordPressdotorg\Plugin_Directory\Admin
+ */
+class Committers_List_Table extends \WP_List_Table {
+
+ /**
+ * Constructor.
+ *
+ * @see WP_List_Table::__construct() for more information on default arguments.
+ *
+ * @param array $args An associative array of arguments.
+ */
+ public function __construct( $args = array() ) {
+ parent::__construct( array(
+ 'singular' => 'committer',
+ 'plural' => 'committers',
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+ ) );
+ }
+
+ /**
+ * Check the current user's permissions.
+ *
+ * @return bool
+ */
+ public function ajax_user_can() {
+ return current_user_can( 'manage_committers' );
+ }
+
+ /**
+ * Prepare the users list for display.
+ *
+ * @access public
+ *
+ * @global string $role
+ * @global string $usersearch
+ */
+ public function prepare_items() {
+ $plugin_slug = get_post()->post_name;
+ $existing_committers = Tools::get_plugin_committers( $plugin_slug );
+ $this->items = array_map( function ( $user ) {
+ return new \WP_User( $user );
+ }, $existing_committers );
+ }
+
+ /**
+ * Output 'no users' message.
+ *
+ * @access public
+ */
+ public function no_items() {
+ _e( 'No committers found.', 'wporg-plugins' );
+ }
+
+ /**
+ *
+ * @return array
+ */
+ protected function get_table_classes() {
+ $classes = parent::get_table_classes();
+ $classes[] = 'wp-list-table';
+
+ unset( $classes[ array_search( 'striped', $classes ) ] );
+
+ return $classes;
+ }
+
+ /**
+ *
+ * @return array
+ */
+ protected function get_column_info() {
+ return array(
+ array(
+ 'avatar' => __( 'Avatar', 'wporg-plugins' ),
+ 'username' => __( 'Username', 'wporg-plugins' ),
+ ),
+ array(),
+ array(),
+ 'username',
+ );
+ }
+
+ /**
+ *
+ */
+ public function display() {
+ ?>
+ <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>">
+ <colgroup>
+ <col width="40px" />
+ <col />
+ </colgroup>
+ <tbody id="the-committer-list" data-wp-lists="list:committer">
+ <?php $this->display_rows_or_placeholder(); ?>
+ </tbody>
+ </table>
+ <?php
+ }
+
+ /**
+ * Generate the list table rows.
+ *
+ * @access public
+ */
+ public function display_rows() {
+ foreach ( $this->items as $user_object ) {
+ echo "\n\t" . $this->single_row( $user_object );
+ }
+ ?>
+ <tr id="add-committer" class="add-committer wp-hidden-children">
+ <td colspan="2">
+ <button type="button" id="add-committer-toggle" class="button-link"><?php _e( '+ Add New Committer', 'wporg-plugins' ); ?></button>
+ <p class="wp-hidden-child">
+ <?php wp_nonce_field( 'add-committer', '_ajax_nonce', false ); ?>
+ <input type="text" name="add_committer" class="form-required" value="" aria-required="true">
+ <input type="button" id="add-committer-submit" class="button" data-wp-lists="add:the-committer-list:add-committer::post_id=<?php echo get_post()->ID; ?>" value="<?php _e( 'Add Committer', 'wporg-plugins' ); ?>">
+ </p>
+ </td>
+ </tr>
+ <?php
+ }
+
+ /**
+ * Generate HTML for a single row on the users.php admin panel.
+ *
+ * @access public
+ *
+ * @param object $user_object The current user object.
+ * @return string Output for a single row.
+ */
+ public function single_row( $user_object ) {
+ if ( ! ( $user_object instanceof \WP_User ) ) {
+ $user_object = get_userdata( (int) $user_object );
+ }
+ $user_object->filter = 'display';
+ list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
+
+ // Set up the hover actions for this committer.
+ $actions = array();
+
+ // Check if the committer for this row is removable.
+ if ( current_user_can( 'list_users' ) ) {
+ $post_id = get_post()->ID;
+ $actions['delete'] = "<a class='submitremove' data-wp-lists='delete:the-committer-list:committer-{$user_object->ID}:faafaa:post_id={$post_id}' href='" . wp_nonce_url( 'users.php?action=remove&committer=' . $user_object->ID, "remove-committer-{$user_object->ID}" ) . "'>" . __( 'Remove', 'wporg-plugins' ) . "</a>";
+ }
+
+ /**
+ * Filter the action links displayed under each committer in the Committers list table.
+ *
+ * @param array $actions An array of action links to be displayed.
+ * @param \WP_User $user_object WP_User object for the currently-listed committer.
+ */
+ $actions = apply_filters( 'committer_row_actions', $actions, $user_object );
+
+ $row = "<tr id='committer-$user_object->ID'>";
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
+ $classes = "$column_name column-$column_name";
+
+ if ( $primary === $column_name ) {
+ $classes .= ' has-row-actions column-primary';
+ }
+ if ( in_array( $column_name, $hidden ) ) {
+ $classes .= ' hidden';
+ }
+
+ $row .= "<td class='$classes' $data>";
+ switch ( $column_name ) {
+ case 'avatar':
+ $row .= get_avatar( $user_object->ID, 32 );
+ break;
+
+ case 'username':
+ $row .= "<strong>$user_object->user_login</strong><br />";
+ break;
+
+ default:
+ /**
+ * Filter the display output of custom columns in the Users list table.
+ *
+ * @param string $output Custom column output. Default empty.
+ * @param string $column_name Column name.
+ * @param int $user_id ID of the currently-listed user.
+ */
+ $row .= apply_filters( 'manage_committers_custom_column', '', $column_name, $user_object->ID );
+ }
+ if ( $primary === $column_name ) {
+ $row .= $this->row_actions( $actions );
+ }
+ $row .= '</td>';
+ }
+ $row .= '</tr>';
+
+ return $row;
+ }
+
+ /**
+ * Gets the name of the default primary column.
+ *
+ * @access protected
+ *
+ * @return string Name of the default primary column, in this case, 'username'.
+ */
+ protected function get_default_primary_column_name() {
+ return 'username';
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-committers-list-table.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscustomizationsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php 2016-03-15 16:07:52 UTC (rev 2751)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php 2016-03-15 20:02:51 UTC (rev 2752)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,10 +29,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'save_post_plugin', array( $this, 'save_plugin_post' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'comment_row_actions', array( $this, 'custom_comment_row_actions' ), 10, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'postbox_classes_plugin_internal-notes', array( $this, 'postbox_classes' ) );
- add_filter( 'comment_row_actions', array( $this, 'custom_comment_row_actions' ), 10, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'postbox_classes_plugin_internal-notes', array( __NAMESPACE__ . '\Metabox\Internal_Notes', 'postbox_classes' ) );
+ add_filter( 'postbox_classes_plugin_plugin-committers', array( __NAMESPACE__ . '\Metabox\Committers', 'postbox_classes' ) );
+ add_filter( 'wp_ajax_add-committer', array( __NAMESPACE__ . '\Metabox\Committers', 'add_committer' ) );
+ add_filter( 'wp_ajax_delete-committer', array( __NAMESPACE__ . '\Metabox\Committers', 'remove_committer' ) );
</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">@@ -60,9 +64,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function enqueue_assets( $hook_suffix ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $post_type;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'post.php' == $hook_suffix && 'plugin' == $post_type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'post.php' === $hook_suffix && 'plugin' === $post_type ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_enqueue_style( 'plugin-admin-edit-css', plugins_url( 'css/edit-form.css', Plugin_Directory\PLUGIN_FILE ), array( 'edit' ), 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_enqueue_script( 'plugin-admin-edit-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util' ), 1 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_enqueue_script( 'plugin-admin-edit-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util', 'wp-lists' ), 1 );
+ wp_localize_script( 'plugin-admin-edit-js', 'pluginDirectory', array(
+ 'removeCommitterAYS' => __( 'Are you sure you want to remove this committer?', 'wporg-plugins' ),
+ ) );
</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">@@ -135,18 +142,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Filters the postbox classes for custom comment meta boxes.
- *
- * @param array $classes An array of postbox classes.
- * @return array
- */
- public function postbox_classes( $classes ) {
- $classes[] = 'comments-meta-box';
-
- return array_filter( $classes );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Filter the action links displayed for each comment.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Actions for internal notes can be limited to replying for plugin reviewers.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -159,7 +154,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array Array of comment actions.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function custom_comment_row_actions( $actions, $comment ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'internal-note' === $comment->comment_type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'internal-note' === $comment->comment_type && isset( $_REQUEST['mode'] ) && 'single' === $_REQUEST['mode'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $allowed_actions = array( 'reply' => true );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( current_user_can( 'manage_comments' ) ) {
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscommittersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php 2016-03-15 16:07:52 UTC (rev 2751)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php 2016-03-15 20:02:51 UTC (rev 2752)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,6 +1,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Plugin_Directory\Admin\Metabox;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-use WordPressdotorg\Plugin_Directory\Tools;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use WordPressdotorg\Plugin_Directory\Admin\Committers_List_Table;
</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"> * The Plugin Committers admin metabox.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,22 +8,94 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @package WordPressdotorg\Plugin_Directory\Admin\Metabox
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Committers {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- static function display() {
- $plugin_slug = get_post()->post_name;
- $existing_committers = Tools::get_plugin_committers( $plugin_slug );
- $existing_committers = array_map( function ( $user ) {
- return new \WP_User( $user );
- }, $existing_committers );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $output = '';
- foreach ( $existing_committers as $committer ) {
- $output .= sprintf(
- '<li title="%s"><span class="avatar">%s</span> %s</li>',
- esc_attr( $committer->user_login ),
- get_avatar( $committer, '24' ),
- esc_html( $committer->display_name )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filters the postbox classes for custom comment meta boxes.
+ *
+ * @param array $classes An array of postbox classes.
+ * @return array
+ */
+ public static function postbox_classes( $classes ) {
+ $classes[] = 'committers-meta-box';
+
+ return array_filter( $classes );
+ }
+
+ public static function display() {
+ $list = new Committers_List_Table();
+ $list->prepare_items();
+ $list->display();
+ }
+
+ public static function add_committer() {
+ check_ajax_referer( 'add-committer' );
+
+ $login = isset( $_POST['add_committer'] ) ? sanitize_user( $_POST['add_committer'] ) : '';
+ $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
+
+ if ( ! $committer = get_user_by( 'login', $login ) ) {
+ wp_die( time() );
</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 '<ul class="committers">' . $output . '</ul>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( ! current_user_can( 'manage_committers', $post_id ) ) {
+ // wp_die( -1 );
+ }
+ global $post, $wpdb;
+
+ $response = new \WP_Ajax_Response();
+ $post = get_post( $post_id );
+
+ $result = $wpdb->insert( PLUGINS_TABLE_PREFIX . 'svn_access', array(
+ 'path' => "/{$post->post_name}",
+ 'user' => $login,
+ 'access' => 'rw',
+ ) );
+
+ if ( ! $result ) {
+ $message = __( 'An error has occurred. Please reload the page and try again.' );
+ if ( is_wp_error( $result ) && $result->get_error_message() ) {
+ $message = $result->get_error_message();
+ }
+
+ $response->add( array(
+ 'what' => 'committer',
+ 'data' => new \WP_Error( 'error', $message ),
+ ) );
+ $response->send();
+ }
+
+ $wp_list_table = new Committers_List_Table();
+
+ $response->add( array(
+ 'what' => 'committer',
+ 'id' => $committer->ID,
+ 'data' => $wp_list_table->single_row( $committer ),
+ 'position' => -1,
+ ) );
+ $response->send();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ public static function remove_committer() {
+ $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+ $post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
+
+ check_ajax_referer( "remove-committer-$id" );
+
+ if ( ! $committer = get_user_by( 'id', $id ) ) {
+ wp_die( time() );
+ }
+
+ if ( ! current_user_can( 'manage_committers', $post_id ) ) {
+ // wp_die( -1 );
+ }
+
+ $plugin_slug = get_post( $post_id )->post_name;
+
+ $result = $GLOBALS['wpdb']->delete( PLUGINS_TABLE_PREFIX . 'svn_access', array(
+ 'path' => "/{$plugin_slug}",
+ 'user' => $committer->user_login,
+ ) );
+
+ wp_die( $result );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassinternalnotesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-internal-notes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-internal-notes.php 2016-03-15 16:07:52 UTC (rev 2751)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-internal-notes.php 2016-03-15 20:02:51 UTC (rev 2752)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,9 +10,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Internal_Notes {
</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">+ * Filters the postbox classes for custom comment meta boxes.
+ *
+ * @param array $classes An array of postbox classes.
+ * @return array
+ */
+ public static function postbox_classes( $classes ) {
+ $classes[] = 'comments-meta-box';
+
+ return array_filter( $classes );
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Displays comment box for internal notes.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- static function display() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function display() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $wp_list_table = new Plugin_Comments_List_Table( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'comment_type' => 'internal-note',
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectorycsseditformcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/css/edit-form.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/css/edit-form.css 2016-03-15 16:07:52 UTC (rev 2751)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/css/edit-form.css 2016-03-15 20:02:51 UTC (rev 2752)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,6 +19,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> .misc-pub-section label[for="post_status"]::before {
</span><span class="cx" style="display: block; padding: 0 10px"> content: "\f173";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> .misc-pub-section label[for="tested_with"]::before {
</span><span class="cx" style="display: block; padding: 0 10px"> content: "\f177";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,7 +33,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> display: none;
</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">-.misc-pub-section .button-link {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.button-link:not(.handlediv) {
</ins><span class="cx" style="display: block; padding: 0 10px"> color: #0073aa;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-transition-property: border, background, color;
</span><span class="cx" style="display: block; padding: 0 10px"> transition-property: border, background, color;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,11 +41,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> transition-duration: .05s;
</span><span class="cx" style="display: block; padding: 0 10px"> -webkit-transition-timing-function: ease-in-out;
</span><span class="cx" style="display: block; padding: 0 10px"> transition-timing-function: ease-in-out;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- text-decoration: underline;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ text-decoration: underline;
</ins><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">-.misc-pub-section .button-link:hover,
-.misc-pub-section .button-link:active {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.button-link:not(.handlediv):hover,
+.button-link:not(.handlediv):active {
</ins><span class="cx" style="display: block; padding: 0 10px"> color: #00a0d2;
</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">@@ -66,16 +67,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> text-align: center;
</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">-.comments-meta-box.postbox .inside,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#poststuff .comments-meta-box.postbox .inside,
+#poststuff .committers-meta-box.postbox .inside,
</ins><span class="cx" style="display: block; padding: 0 10px"> .comments-meta-box .column-comment p {
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0;
</span><span class="cx" style="display: block; padding: 0 10px"> padding: 0;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ border: 0;
</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"> .comments-meta-box .inside .row-actions {
</span><span class="cx" style="display: block; padding: 0 10px"> line-height:18px;
</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">+.comments-meta-box .inside .column-author {
+ width: 20%;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .comments-meta-box .inside .column-author *:not(strong) {
</span><span class="cx" style="display: block; padding: 0 10px"> display: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -89,7 +96,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 0;
</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">-.comments-meta-box .comments-box {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.comments-meta-box .comments-box,
+.committers-meta-box .wp-list-table {
</ins><span class="cx" style="display: block; padding: 0 10px"> border: 0 none;
</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">@@ -123,3 +131,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</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">+
+/* Committers meta box */
+.add-committer {
+ padding: 0 12px 12px;
+}
+
+.add-committer .button-link {
+ font-weight: 600;
+ margin: 10px 0;
+}
+
+.add-committer input[type="text"] {
+ margin: 0 0 1em;
+ max-width: 260px;
+ vertical-align: baseline;
+ width: 100%;
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryjseditformjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/js/edit-form.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/js/edit-form.js 2016-03-15 16:07:52 UTC (rev 2751)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/js/edit-form.js 2016-03-15 20:02:51 UTC (rev 2752)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,7 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * JS for the Plugin Admin screens.
</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">-( function( $, wp ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+( function( $, wp, pluginDirectory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> var PluginEdit = {
</span><span class="cx" style="display: block; padding: 0 10px"> $testedWith: {},
</span><span class="cx" style="display: block; padding: 0 10px"> $pluginStatus: {},
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,16 +21,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> _.each( $( '#post-body' ).find( '.comments-box' ), PluginEdit.loadComments );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#add-new-comment' ).on( 'click', 'a.button', function( event ) {
- event.preventDefault();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '#add-new-comment' ).on( 'click', 'a.button', PluginEdit.prepareCommentForm );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- window.commentReply && commentReply.addcomment( $( '#post_ID' ).val() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '#add-committer-toggle' ).on( 'click', PluginEdit.toggleCommitterForm );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#replyrow' ).find( '.comment-reply' ).append( $( '<input/>' ).attr({
- type: 'hidden',
- name: 'comment_type',
- value: $( '.comments-box' ).data( 'comment-type' )
- }) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '#the-committer-list' ).wpList({
+ alt: false,
+ confirm: function( element, settings, action ) {
+ if ( 'committer' === settings.what && 'delete' === action ) {
+ return confirm( pluginDirectory.removeCommitterAYS );
+ }
+ return true;
+ }
+ }).on( 'wpListAddEnd', function() {
+ $( 'input[name="add_committer"]', '#add-committer' ).val( '' ).focus();
</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">@@ -92,8 +96,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $( 'a[className*=\':\']' ).unbind();
</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">+ },
+
+ prepareCommentForm: function( event ) {
+ event.preventDefault();
+
+ window.commentReply && commentReply.addcomment( $( '#post_ID' ).val() );
+
+ // Add a field with the custom comment type.
+ $( '#replyrow' ).find( '.comment-reply' ).append( $( '<input/>' ).attr({
+ type: 'hidden',
+ name: 'comment_type',
+ value: $( '.comments-box' ).data( 'comment-type' )
+ }) );
+ },
+
+ toggleCommitterForm: function( event ) {
+ var $form = $( '#add-committer' );
+
+ // Show/hide form.
+ $form.toggleClass( 'wp-hidden-children' );
+
+ // Focus on the input field, and on enter add the committer, don't save post.
+ $( 'input[name="add_committer"]', $form ).focus().on( 'keydown', function( event ) {
+ if ( 13 === event.which ) {
+ event.preventDefault();
+ $( '#add-committer-submit', $form ).click();
+ }
+ } );
</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="cx" style="display: block; padding: 0 10px"> $( PluginEdit.ready );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-} )( window.jQuery, window.wp );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+} )( window.jQuery, window.wp, window.pluginDirectory );
</ins></span></pre>
</div>
</div>
</body>
</html>