<!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>[6217] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: Plugins: General code cleanup, migrate events that happen on transistions to single place, remove duplicated code, add auditing, simplify logic.</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/6217">6217</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/6217","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>Otto42</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-12-03 19:32:59 +0000 (Sun, 03 Dec 2017)</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'>Plugins: General code cleanup, migrate events that happen on transistions to single place, remove duplicated code, add auditing, simplify logic. props @joostdevalk See <a href="http://meta.trac.wordpress.org/ticket/2860">#2860</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_htmlwpcontentpluginsplugindirectoryadminclassstatustransitionsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.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>
</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 2017-12-03 19:30:38 UTC (rev 6216)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php 2017-12-03 19:32:59 UTC (rev 6217)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,8 +40,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_insert_post_data', array( $this, 'check_existing_plugin_slug_on_post_update' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_unique_post_slug', array( $this, 'check_existing_plugin_slug_on_inline_save' ), 10, 6 );
</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_action( 'save_post', array( $this, 'save_close_reason' ), 10, 2 );
-
</del><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'comment_row_actions', array( $this, 'custom_comment_row_actions' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'get_comment_link', array( $this, 'link_internal_notes_to_admin' ), 10, 2 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -378,29 +376,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">- * Save the reason for closing or disabling a plugin.
- *
- * @param int $post_id Post ID.
- * @param \WP_Post $post Post object.
- */
- public function save_close_reason( $post_id, $post ) {
- if ( 'plugin' !== $post->post_type || ! isset( $_POST['close_reason'] ) ) {
- return;
- }
-
- if ( ! current_user_can( 'plugin_approve', $post_id ) ) {
- return;
- }
-
- if ( ! in_array( $post->post_status, array( 'closed', 'disabled' ) ) ) {
- return;
- }
-
- update_post_meta( $post_id, '_close_reason', sanitize_key( $_POST['close_reason'] ) );
- update_post_meta( $post_id, '_close_date', current_time( 'mysql' ) );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Register the Admin metaboxes for the plugin management screens.
</span><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 screen.
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclassstatustransitionsphp"></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-status-transitions.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-status-transitions.php 2017-12-03 19:30:38 UTC (rev 6216)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php 2017-12-03 19:32:59 UTC (rev 6217)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Plugin_Directory\Admin;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Tools;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Tools\SVN;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordPressdotorg\Plugin_Directory\Tools\Filesystem;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,7 +12,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @package WordPressdotorg\Plugin_Directory\Admin
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Status_Transitions {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fetch the instance of the Status_Transitions class.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,6 +32,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Get the list of allowed status transitions for a given plugin.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $post_status Plugin post status.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return array An array of allowed post status transitions.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function get_allowed_transitions( $post_status ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,6 +73,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $data An array of slashed post data.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $postarr An array of sanitized, but otherwise unmodified post data.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function can_change_post_status( $data, $postarr ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -92,7 +95,10 @@
</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"> // ...or it's a white-listed status for plugin reviewers.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( current_user_can( 'plugin_review', $postarr['ID'] ) && in_array( $postarr['post_status'], array( 'new', 'pending' ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( current_user_can( 'plugin_review', $postarr['ID'] ) && in_array( $postarr['post_status'], array(
+ 'new',
+ 'pending',
+ ) ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $data;
</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">@@ -127,6 +133,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case 'rejected':
</span><span class="cx" style="display: block; padding: 0 10px"> $this->rejected( $post->ID, $post );
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'publish':
+ $this->clean_closed_date( $post->ID );
+ break;
+ case 'disabled':
+ case 'closed':
+ $this->save_close_reason( $post->ID );
+ break;
</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"> // Record the time a plugin was transitioned into a specific status.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -140,7 +153,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param \WP_Post $post Post object.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function approved( $post_id, $post ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $attachments = get_attached_media( 'application/zip', $post_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attachments = get_attached_media( 'application/zip', $post_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> $plugin_author = get_user_by( 'id', $post->post_author );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Create SVN repo.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -177,7 +190,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $subject = sprintf( __( '[WordPress Plugin Directory] %s has been approved!', 'wporg-plugins' ), $post->post_title );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: 1: plugin name, 2: plugin slug */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $content = sprintf( __( 'Congratulations, your plugin hosting request for %1$s has been approved.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = sprintf( __( 'Congratulations, your plugin hosting request for %1$s has been approved.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> Within one hour you will have access to your SVN repository with the WordPress.org username and password you used to log in and submit your request. Your username is case sensitive.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -214,6 +227,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $post->post_name
</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">+ $this->audit_log( 'Plugin approved.', $post_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_mail( $plugin_author->user_email, $subject, $content, 'From: plugins@wordpress.org' );
</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">@@ -233,7 +247,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Change slug to 'rejected-plugin-name-rejected' to free up 'plugin-name'.
</span><span class="cx" style="display: block; padding: 0 10px"> wp_update_post( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'ID' => $post_id,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'post_name' => sprintf( 'rejected-%s-rejected', $post->post_name )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'post_name' => sprintf( 'rejected-%s-rejected', $post->post_name ),
</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"> // Send email.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -241,7 +255,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $subject = sprintf( __( '[WordPress Plugin Directory] %s has been rejected', 'wporg-plugins' ), $post->post_title );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: 1: plugin name, 2: plugins@wordpress.org */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $content = sprintf( __( 'Unfortunately your plugin submission for %1$s has been rejected from the WordPress Plugin Directory.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $content = sprintf( __( 'Unfortunately your plugin submission for %1$s has been rejected from the WordPress Plugin Directory.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> If you believe this to be in error, please email %2$s with your plugin attached as a zip and explain why you feel your plugin should be an exception.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -252,6 +266,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'plugins@wordpress.org'
</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">+ $this->audit_log( 'Plugin rejected.', $post_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_mail( $email, $subject, $content, 'From: plugins@wordpress.org' );
</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">@@ -259,6 +274,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Returns the path to a plugins root directory.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $dir Directory to search in.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function get_plugin_root( $dir ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -278,4 +294,52 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $plugin_root;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Deletes the plugin closed date meta field.
+ *
+ * @param integer $post_id Post ID.
+ */
+ public function clean_closed_date( $post_id ) {
+ delete_post_meta( $post_id, 'plugin_closed_date' );
+ delete_post_meta( $post_id, '_close_reason' );
+ }
+
+ /**
+ * Save the reason for closing or disabling a plugin.
+ *
+ * @param int $post_id Post ID.
+ */
+ public function save_close_reason( $post_id ) {
+ if ( ! isset( $_POST['close_reason'] ) ) {
+ return;
+ }
+
+ if ( ! current_user_can( 'plugin_approve', $post_id ) ) {
+ return;
+ }
+
+ $close_reason = sanitize_key( $_POST['close_reason'] );
+
+ update_post_meta( $post_id, '_close_reason', $close_reason );
+ update_post_meta( $post_id, 'plugin_closed_date', current_time( 'mysql' ) );
+
+ $this->audit_log( sprintf( 'Plugin closed for: %s', $close_reason ), $post_id );
+ }
+
+ /**
+ * Saves an audit_log comment for the plugin.
+ *
+ * @param string $message The message for the audit log.
+ * @param integer $post_id The Post ID.
+ */
+ private function audit_log( $message, $post_id ) {
+ $comment = array(
+ 'comment_type' => 'audit_log',
+ 'comment_post_ID' => $post_id,
+ 'comment_author' => get_current_user_id(),
+ 'comment_content' => $message,
+ );
+ wp_insert_comment( $comment );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></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 2017-12-03 19:30:38 UTC (rev 6216)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php 2017-12-03 19:32:59 UTC (rev 6217)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -343,8 +343,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'label_count' => _n_noop( 'Rejected <span class="count">(%s)</span>', 'Rejected <span class="count">(%s)</span>', 'wporg-plugins' ),
</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">- add_action( 'transition_post_status', array( $this, 'plugin_close_date' ), 10, 3 );
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * TODO
</span><span class="cx" style="display: block; padding: 0 10px"> * Use register_rest_field() to add array and object meta data to the API:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1341,19 +1339,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $result;
</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">- /**
- * Save the date a plugin was closed and delete that date when it's reopened.
- *
- * @param string $new_status The new plugin status.
- * @param string $old_status The old plugin status.
- * @param WP_Post $post Post data.
- */
- public function plugin_close_date( $new_status, $old_status, $post ) {
- if ( in_array( $new_status, array( 'closed', 'disabled' ) ) ) {
- update_post_meta( $post->ID, 'plugin_closed_date', current_time( 'mysql' ) );
- }
- if ( 'publish' === $new_status && in_array( $old_status, array( 'closed', 'disabled' ) ) ) {
- delete_post_meta( $post->ID, 'plugin_closed_date' );
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>