<!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>[2735] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: Plugin Directory: Use a custom comment type for internal notes.</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/2735">2735</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/2735","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-11 18:04:19 +0000 (Fri, 11 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: Use a custom comment type for internal notes.
See <a href="http://meta.trac.wordpress.org/ticket/1570">#1570</a>, <a href="http://meta.trac.wordpress.org/ticket/1603">#1603</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_htmlwpcontentpluginsplugindirectoryclassplugindirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.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_htmlwpcontentpluginsplugindirectoryadminclassplugincommentslisttablephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-plugin-comments-list-table.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>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassnotesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-notes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<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-10 23:14:57 UTC (rev 2734)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php 2016-03-11 18:04:19 UTC (rev 2735)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,7 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Customizations {
</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">- * Fetch the instance of the Admin Customizations class.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fetch the instance of the Customizations class.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function instance() {
</span><span class="cx" style="display: block; padding: 0 10px"> static $instance = null;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +18,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return ! is_null( $instance ) ? $instance : $instance = new Customizations();
</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">+ /**
+ * Constructor.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> private function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px"> // Admin Metaboxes
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'add_meta_boxes', array( $this, 'register_admin_metaboxes' ), 10, 1 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,19 +29,22 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'wp_ajax_save-note', array( $this, 'save_note' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 );
+
+ add_filter( 'postbox_classes_plugin_internal-notes', array( $this, 'postbox_classes' ) );
</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"> * Adds the plugin name into the post editing title.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @global $title The wp-admin title variable.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global string $title The wp-admin title variable.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $post_type The post type of the current page
</span><span class="cx" style="display: block; padding: 0 10px"> * @return void.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function replace_title_global( $post_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $title;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'plugin' === $post_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $title = sprintf( $title, get_the_title() ); // esc_html() on output
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,9 +84,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_meta_box(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'plugin-notes',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'internal-notes',
</ins><span class="cx" style="display: block; padding: 0 10px"> __( 'Internal Notes', 'wporg-plugins' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( __NAMESPACE__ . '\Metabox\Notes', 'display' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( __NAMESPACE__ . '\Metabox\Internal_Notes', 'display' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'plugin', 'normal', 'high'
</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">@@ -126,25 +132,148 @@
</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">- * Saves a plugin note.
</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
</ins><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 save_note() {
- check_admin_referer( 'save-note', 'notce' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function postbox_classes( $classes ) {
+ $classes[] = 'comments-meta-box';
</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 ( empty( $_POST['id'] ) ) {
- wp_send_json_error( array( 'errorCode' => 'no_post_specified' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array_filter( $classes );
+ }
+
+ /**
+ * Saves a comment that is not built-in.
+ *
+ * We pretty much have to replicate all of `wp_ajax_replyto_comment()` to be able to comment on draft posts.
+ */
+ public function save_custom_comment() {
+ $comment_post_ID = (int) $_POST['comment_post_ID'];
+ $post = get_post( $comment_post_ID );
+
+ if ( 'plugin' !== $post->post_type ) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ remove_action( 'wp_ajax_replyto-comment', 'wp_ajax_replyto_comment', 1 );
</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( 'review_plugin', absint( $_POST['id'] ) ) ) {
- wp_send_json_error( array(
- 'error' => __( 'You do not have sufficient permissions to edit notes on this site.' ),
- ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_list_table;
+ if ( empty( $action ) ) {
+ $action = 'replyto-comment';
</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">- update_post_meta( absint( $_POST['id'] ), 'note', wp_kses_post( $_POST['note'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_send_json_success( array(
- 'note' => wpautop( wp_kses_post( $_POST['note'] ) ),
- ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $post ) {
+ wp_die( - 1 );
+ }
+
+ if ( ! current_user_can( 'edit_post', $comment_post_ID ) ) {
+ wp_die( - 1 );
+ }
+
+ if ( empty( $post->post_status ) ) {
+ wp_die( 1 );
+ }
+
+ $user = wp_get_current_user();
+ if ( ! $user->exists() ) {
+ wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
+ }
+
+ $user_ID = $user->ID;
+ $comment_author = wp_slash( $user->display_name );
+ $comment_author_email = wp_slash( $user->user_email );
+ $comment_author_url = wp_slash( $user->user_url );
+ $comment_content = trim( $_POST['content'] );
+ $comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : '';
+
+ if ( current_user_can( 'unfiltered_html' ) ) {
+ if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) {
+ $_POST['_wp_unfiltered_html_comment'] = '';
+ }
+
+ if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
+ kses_remove_filters(); // start with a clean slate
+ kses_init_filters(); // set up the filters
+ }
+ }
+
+ if ( '' == $comment_content ) {
+ wp_die( __( 'ERROR: please type a comment.' ) );
+ }
+
+ $comment_parent = 0;
+ if ( isset( $_POST['comment_ID'] ) ) {
+ $comment_parent = absint( $_POST['comment_ID'] );
+ }
+ $comment_auto_approved = false;
+ $comment_data = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' );
+
+ // Automatically approve parent comment.
+ if ( ! empty( $_POST['approve_parent'] ) ) {
+ $parent = get_comment( $comment_parent );
+
+ if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) {
+ if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) {
+ wp_die( - 1 );
+ }
+
+ if ( wp_set_comment_status( $parent, 'approve' ) ) {
+ $comment_auto_approved = true;
+ }
+ }
+ }
+
+ $comment_id = wp_new_comment( $comment_data );
+ $comment = get_comment( $comment_id );
+ if ( ! $comment ) {
+ wp_die( 1 );
+ }
+
+ $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
+
+ ob_start();
+ if ( isset( $_REQUEST['mode'] ) && 'dashboard' == $_REQUEST['mode'] ) {
+ require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
+ _wp_dashboard_recent_comments_row( $comment );
+ } else {
+ if ( isset( $_REQUEST['mode'] ) && 'single' == $_REQUEST['mode'] ) {
+ $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
+ } else {
+ $wp_list_table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
+ }
+ $wp_list_table->single_row( $comment );
+ }
+ $comment_list_item = ob_get_clean();
+
+ $response = array(
+ 'what' => 'comment',
+ 'id' => $comment->comment_ID,
+ 'data' => $comment_list_item,
+ 'position' => $position
+ );
+
+ $counts = wp_count_comments();
+ $response['supplemental'] = array(
+ 'in_moderation' => $counts->moderated,
+ 'i18n_comments_text' => sprintf(
+ _n( '%s Comment', '%s Comments', $counts->approved ),
+ number_format_i18n( $counts->approved )
+ ),
+ 'i18n_moderation_text' => sprintf(
+ _nx( '%s in moderation', '%s in moderation', $counts->moderated, 'comments' ),
+ number_format_i18n( $counts->moderated )
+ )
+ );
+
+ if ( $comment_auto_approved ) {
+ $response['supplemental']['parent_approved'] = $parent->comment_ID;
+ $response['supplemental']['parent_post_id'] = $parent->comment_post_ID;
+ }
+
+ $x = new \WP_Ajax_Response();
+ $x->add( $response );
+ $x->send();
</ins><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="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclassplugincommentslisttablephp"></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-plugin-comments-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-plugin-comments-list-table.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-plugin-comments-list-table.php 2016-03-11 18:04:19 UTC (rev 2735)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,57 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\Admin;
+
+_get_list_table( 'WP_Post_Comments_List_Table' );
+
+/**
+ * Comments list table for comments meta box.
+ *
+ * @package WordPressdotorg\Plugin_Directory\Admin
+ */
+class Plugin_Comments_List_Table extends \WP_Post_Comments_List_Table {
+ /**
+ * Comment type.
+ *
+ * @var string
+ */
+ public $comment_type = '';
+
+ /**
+ * 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() ) {
+ if ( ! empty( $args['comment_type'] ) ) {
+ $this->comment_type = $args['comment_type'];
+ }
+ parent::__construct( $args );
+ }
+
+ /**
+ *
+ * @param bool $output_empty
+ */
+ public function display( $output_empty = false ) {
+ $singular = $this->_args['singular'];
+
+ wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+ ?>
+ <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" data-comment-type="<?php echo esc_attr( $this->comment_type ); ?>" style="display:none;">
+ <colgroup>
+ <col width="20%">
+ <col width="80%">
+ </colgroup>
+ <tbody id="the-comment-list"<?php if ( $singular ) { echo " data-wp-lists='list:$singular'"; } ?>>
+ <?php
+ if ( ! $output_empty ) {
+ $this->display_rows_or_placeholder();
+ }
+ ?>
+ </tbody>
+ </table>
+ <?php
+ }
+}
</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-plugin-comments-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_htmlwpcontentpluginsplugindirectoryadminmetaboxclassinternalnotesphpfromrev2734sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassnotesphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-internal-notes.php (from rev 2734, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-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 (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-internal-notes.php 2016-03-11 18:04:19 UTC (rev 2735)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,28 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\Admin\Metabox;
+use WordPressdotorg\Plugin_Directory\Admin\Plugin_Comments_List_Table;
+
+/**
+ * The Internal Notes admin metabox.
+ *
+ * @package WordPressdotorg\Plugin_Directory\Admin\Metabox
+ */
+class Internal_Notes {
+
+ /**
+ * Displays comment box for internal notes.
+ */
+ static function display() {
+ $wp_list_table = new Plugin_Comments_List_Table( array(
+ 'comment_type' => 'internal-note',
+ ) );
+ wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
+ ?>
+ <p class="hide-if-no-js" id="add-new-comment">
+ <a class="button" href="#commentstatusdiv"><?php _e( 'Add note', 'wporg-plugins' ); ?></a>
+ </p>
+ <?php
+ $wp_list_table->display( true );
+ wp_comment_trashnotice();
+ }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassnotesphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-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-notes.php 2016-03-10 23:14:57 UTC (rev 2734)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-notes.php 2016-03-11 18:04:19 UTC (rev 2735)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,32 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-namespace WordPressdotorg\Plugin_Directory\Admin\Metabox;
-use WordPressdotorg\Plugin_Directory\Tools;
-
-/**
- * The Internal Notes admin metabox.
- *
- * @package WordPressdotorg\Plugin_Directory\Admin\Metabox
- */
-class Notes {
-
- /**
- *
- */
- static function display( $post ) {
- $note = (string) get_post_meta( $post->ID, 'note', true );
-
- ?>
- <div class="view-note hide-if-no-js">
- <?php echo empty( $note ) ? __( 'Add note', 'wporg-plugins' ) : wpautop( $note ); ?>
- </div>
- <div class="edit-note show-if-no-js" style="display: none;">
- <?php wp_nonce_field( 'save-note', 'notce' ); ?>
- <textarea class="note-content" rows="5" style="width: 100%;"><?php echo $note; ?></textarea>
- <p>
- <button type="button" class="button button-primary save-note"><?php _e( 'Save', 'wporg-plugins' ); ?></button>
- <button type="reset" class="button button-secondary cancel-note"><?php _e( 'Cancel', 'wporg-plugins' ); ?></button>
- </p>
- </div>
- <?php
- }
-}
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassplugindirectoryphp"></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/class-plugin-directory.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/class-plugin-directory.php 2016-03-10 23:14:57 UTC (rev 2734)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php 2016-03-11 18:04:19 UTC (rev 2735)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,7 +53,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'not_found_in_trash' => __( 'No plugins found in Trash', 'wporg-plugins' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'description' => __( 'A Repo Plugin', 'wporg-plugins' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'supports' => false,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'supports' => array( 'comments' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'public' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_ui' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'has_archive' => true,
</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-10 23:14:57 UTC (rev 2734)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/css/edit-form.css 2016-03-11 18:04:19 UTC (rev 2735)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,4 +56,70 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box-shadow:
</span><span class="cx" style="display: block; padding: 0 10px"> 0 0 0 1px #5b9dd9,
</span><span class="cx" style="display: block; padding: 0 10px"> 0 0 2px 1px rgba(30, 140, 190, .8);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
+
+/* Comment meta boxes */
+.comments-meta-box #edithead .inside {
+ float: left;
+ padding: 3px 0 2px 5px;
+ margin: 0;
+ text-align: center;
+}
+
+.comments-meta-box.postbox .inside,
+.comments-meta-box .column-comment p {
+ margin: 0;
+ padding: 0;
+}
+
+.comments-meta-box .inside .row-actions {
+ line-height:18px;
+}
+
+.comments-meta-box .inside .column-author *:not(strong) {
+ display: none;
+}
+
+.comments-meta-box #replyrow td {
+ padding: 0;
+}
+
+.comments-meta-box p {
+ padding: 8px 10px;
+ margin: 0;
+}
+
+.comments-meta-box .comments-box {
+ border: 0 none;
+}
+
+.comments-meta-box .comments-box thead th,
+.comments-meta-box .comments-box thead td {
+ background: transparent;
+ padding: 0 7px 4px;
+ font-style: italic;
+}
+
+.comments-meta-box .comments-box tr:last-child td {
+ border-bottom: 0 none;
+}
+
+.comments-meta-box #edithead .inside input {
+ width: 160px;
+}
+
+@media screen and ( max-width: 782px ) {
+ .comments-meta-box .fixed .column-author {
+ display: none !important;
+ }
+
+ .comments-meta-box #edithead .inside {
+ float: none;
+ text-align: left;
+ padding: 3px 5px;
+ }
+
+ .comments-meta-box #edithead .inside input {
+ 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-10 23:14:57 UTC (rev 2734)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/js/edit-form.js 2016-03-11 18:04:19 UTC (rev 2735)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,14 +3,11 @@
</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"> ( function( $, wp ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> var PluginEdit = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $notesBox: {},
</del><span class="cx" style="display: block; padding: 0 10px"> $testedWith: {},
</span><span class="cx" style="display: block; padding: 0 10px"> $pluginStatus: {},
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> ready: function() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- PluginEdit.$notesBox = $( '#plugin-notes' );
</del><span class="cx" style="display: block; padding: 0 10px"> PluginEdit.$testedWith = $( '#tested-with-select' );
</span><span class="cx" style="display: block; padding: 0 10px"> PluginEdit.$pluginStatus = $( '#plugin-status-select' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -22,10 +19,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> .on( 'click', '.cancel-tested-with', PluginEdit.cancelTestedWith )
</span><span class="cx" style="display: block; padding: 0 10px"> .on( 'click', '.cancel-plugin-status', PluginEdit.cancelPluginStatus );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- PluginEdit.$notesBox
- .on( 'click', '.cancel-note', PluginEdit.showNote )
- .on( 'click', '.view-note', PluginEdit.editNote )
- .on( 'click', '.save-note', PluginEdit.saveNote );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _.each( $( '#post-body' ).find( '.comments-box' ), PluginEdit.loadComments );
+
+ $( '#add-new-comment' ).on( 'click', 'a.button', function( event ) {
+ event.preventDefault();
+
+ window.commentReply && commentReply.addcomment( $( '#post_ID' ).val() );
+
+ $( '#replyrow' ).find( '.comment-reply' ).append( $( '<input/>' ).attr({
+ type: 'hidden',
+ name: 'comment_type',
+ value: $( '.comments-box' ).data( 'comment-type' )
+ }) );
+ } );
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> editTestedWith: function() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -66,31 +72,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> PluginEdit.updatePluginStatus( event );
</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">- showNote: function() {
- $( '.view-note', PluginEdit.$notesBox ).show();
- $( '.edit-note', PluginEdit.$notesBox ).hide();
- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ loadComments: function ( element ) {
+ var $commentsList = $( element ),
+ data = {
+ _ajax_nonce: $( '#add_comment_nonce' ).val(),
+ p: $( '#post_ID' ).val(),
+ mode: 'single',
+ start: 0,
+ number: 20,
+ comment_type: $commentsList.data( 'comment-type' )
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editNote: function() {
- var $textarea = $( '.note-content', PluginEdit.$notesBox );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.ajax.post( 'get-comments', data ).always( function( response ) {
+ response = wpAjax.parseAjaxResponse( response );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '.view-note', PluginEdit.$notesBox ).hide();
- $( '.edit-note', PluginEdit.$notesBox ).show();
- $textarea.text( $textarea.val() ).focus();
- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'object' == typeof response && response.responses[0] ) {
+ $commentsList.append( response.responses[0].data ).show();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- saveNote: function() {
- wp.ajax.post( 'save-note', {
- id: $( '#post_ID' ).val(),
- note: $( '.note-content', PluginEdit.$notesBox ).val(),
- notce: $( '#notce' ).val()
- } )
- .done( function( response ) {
- var note = response.note ? response.note : 'Add note';
-
- $( '.view-note', PluginEdit.$notesBox ).html( note );
- PluginEdit.showNote();
- } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( 'a[className*=\':\']' ).unbind();
+ }
+ } );
</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></pre>
</div>
</div>
</body>
</html>