<!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>[3335] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: Plugin Directory: Let plugin authors select categories on upload.</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/3335">3335</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/3335","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-06-11 22:07:10 +0000 (Sat, 11 Jun 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: Let plugin authors select categories on upload.
Also refactors `create_plugin_post()` to me more of a direct wrapper of
`wp_insert_post()`. Front-end needs styles.
See <a href="http://meta.trac.wordpress.org/ticket/1573">#1573</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_htmlwpcontentpluginsplugindirectorycliclassimportphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassuploadhandlerphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassuploadphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.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-06-11 21:55:15 UTC (rev 3334)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php 2016-06-11 22:07:10 UTC (rev 3335)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,7 +28,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'save_post_plugin', array( $this, 'save_plugin_post' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'tax_input_pre', array( $this, 'filter_tax_input' ) );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'load-edit.php', array( $this, 'bulk_reject_plugins' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -471,22 +470,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 value of tax_inputs before saving.
- *
- * @param array $tax_input Array of taxonomies with selected terms.
- * @return array
- */
- public function filter_tax_input( $tax_input ) {
-
- // Limit the amount of assignable categories to 3.
- if ( isset( $tax_input['plugin_category'] ) ) {
- $tax_input['plugin_category'] = array_slice( array_filter( $tax_input['plugin_category'] ), 0, 3 );
- }
-
- return $tax_input;
- }
-
- /**
</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></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-06-11 21:55:15 UTC (rev 3334)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php 2016-06-11 22:07:10 UTC (rev 3335)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,6 +25,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'term_link', array( $this, 'term_link' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'tax_input_pre', array( $this, 'filter_tax_input' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,6 +34,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Shim in postmeta support for data which doesn't yet live in postmeta
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'get_post_metadata', array( $this, 'filter_shim_postmeta' ), 10, 3 );
</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"> add_filter( 'map_meta_cap', array( __NAMESPACE__ . '\Capabilities', 'map_meta_cap' ), 10, 4 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Load the API routes
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -609,6 +611,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Filters the value of tax_inputs before saving.
+ *
+ * Used both in the admin and the uploader.
+ *
+ * @param array $tax_input Array of taxonomies with selected terms.
+ * @return array
+ */
+ public function filter_tax_input( $tax_input ) {
+
+ // Limit the amount of assignable categories to 3.
+ if ( isset( $tax_input['plugin_category'] ) ) {
+ $tax_input['plugin_category'] = array_slice( array_filter( $tax_input['plugin_category'] ), 0, 3 );
+ }
+
+ return $tax_input;
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Retrieve the WP_Post object representing a given plugin.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param $plugin_slug string|\WP_Post The slug of the plugin to retrieve.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -650,55 +670,69 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Create a new post entry for a given plugin slug.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $plugin_info {
- * Array of initial plugin post data, all fields are optional.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $args {
+ * An array of elements that make up a post to insert.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $title The title of the plugin.
- * @type string $slug The slug of the plugin.
- * @type string $status The status of the plugin ( 'publish', 'pending', 'disabled', 'closed' ).
- * @type int $author The ID of the plugin author.
- * @type string $description The short description of the plugin.
- * @type string $content The long description of the plugin.
- * @type array $tags The tags associated with the plugin.
- * @type array $meta The meta information of the plugin.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type int $ID The post ID. If equal to something other than 0,
+ * the post with that ID will be updated. Default 0.
+ * @type int $post_author The ID of the user who added the post. Default is
+ * the current user ID.
+ * @type string $post_date The date of the post. Default is the current time.
+ * @type string $post_date_gmt The date of the post in the GMT timezone. Default is
+ * the value of `$post_date`.
+ * @type mixed $post_content The post content. Default empty.
+ * @type string $post_content_filtered The filtered post content. Default empty.
+ * @type string $post_title The post title. Default empty.
+ * @type string $post_excerpt The post excerpt. Default empty.
+ * @type string $post_status The post status. Default 'draft'.
+ * @type string $post_type The post type. Default 'post'.
+ * @type string $comment_status Whether the post can accept comments. Accepts 'open' or 'closed'.
+ * Default is the value of 'default_comment_status' option.
+ * @type string $ping_status Whether the post can accept pings. Accepts 'open' or 'closed'.
+ * Default is the value of 'default_ping_status' option.
+ * @type string $post_password The password to access the post. Default empty.
+ * @type string $post_name The post name. Default is the sanitized post title
+ * when creating a new post.
+ * @type string $to_ping Space or carriage return-separated list of URLs to ping.
+ * Default empty.
+ * @type string $pinged Space or carriage return-separated list of URLs that have
+ * been pinged. Default empty.
+ * @type string $post_modified The date when the post was last modified. Default is
+ * the current time.
+ * @type string $post_modified_gmt The date when the post was last modified in the GMT
+ * timezone. Default is the current time.
+ * @type int $post_parent Set this for the post it belongs to, if any. Default 0.
+ * @type int $menu_order The order the post should be displayed in. Default 0.
+ * @type string $post_mime_type The mime type of the post. Default empty.
+ * @type string $guid Global Unique ID for referencing the post. Default empty.
+ * @type array $post_category Array of category names, slugs, or IDs.
+ * Defaults to value of the 'default_category' option.
+ * @type array $tax_input Array of taxonomy terms keyed by their taxonomy name. Default empty.
+ * @type array $meta_input Array of post meta values keyed by their post meta key. Default empty.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @return \WP_Post|\WP_Error
</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 public function create_plugin_post( array $plugin_info ) {
- $title = ! empty( $plugin_info['title'] ) ? $plugin_info['title'] : '';
- $slug = ! empty( $plugin_info['slug'] ) ? $plugin_info['slug'] : sanitize_title( $title );
- $status = ! empty( $plugin_info['status'] ) ? $plugin_info['status'] : 'draft';
- $author = ! empty( $plugin_info['author'] ) ? $plugin_info['author'] : 0;
- $desc = ! empty( $plugin_info['description'] ) ? $plugin_info['description'] : '';
- $content = ! empty( $plugin_info['content'] ) ? $plugin_info['content'] : '';
- $meta = ! empty( $plugin_info['meta'] ) ? $plugin_info['meta'] : array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function create_plugin_post( array $args ) {
+ $title = $args['post_title'] ?: $args['post_name'];
+ $slug = $args['post_name'] ?: sanitize_title( $title );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_date = ! empty( $plugin_info['post_date'] ) ? $plugin_info['post_date'] : '';
- $post_date_gmt = ! empty( $plugin_info['post_date_gmt'] ) ? $plugin_info['post_date_gmt'] : '';
- $post_modified = ! empty( $plugin_info['post_modified'] ) ? $plugin_info['post_modified'] : '';
- $post_modified_gmt = ! empty( $plugin_info['post_modified_gmt'] ) ? $plugin_info['post_modified_gmt'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $args = wp_parse_args( $args, array(
+ 'post_title' => $title,
+ 'post_name' => $slug,
+ 'post_type' => 'plugin',
+ 'post_date' => '',
+ 'post_date_gmt' => '',
+ 'post_modified' => '',
+ 'post_modified_gmt' => '',
+ ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $id = wp_insert_post( array(
- 'post_type' => 'plugin',
- 'post_status' => $status,
- 'post_name' => $slug,
- 'post_title' => $title ?: $slug,
- 'post_author' => $author,
- 'post_content' => $content,
- 'post_excerpt' => $desc,
- 'meta_input' => $meta,
- 'post_date' => $post_date,
- 'post_date_gmt' => $post_date_gmt,
- 'post_modified' => $post_modified,
- 'post_modified_gmt' => $post_modified_gmt,
- ), true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $result = wp_insert_post( $args, true );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_wp_error( $id ) ) {
- return $id;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! is_wp_error( $result ) ) {
+ wp_cache_set( $result, $slug, 'plugin-slugs' );
+ $result = get_post( $result );
</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">- wp_cache_set( $id, $slug, 'plugin-slugs' );
-
- return get_post( $id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $result;
</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_htmlwpcontentpluginsplugindirectorycliclassimportphp"></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/cli/class-import.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/cli/class-import.php 2016-06-11 21:55:15 UTC (rev 3334)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php 2016-06-11 22:07:10 UTC (rev 3335)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,15 +82,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $author_ip = $wpdb->get_var( $wpdb->prepare( 'SELECT poster_ip FROM ' . PLUGINS_TABLE_PREFIX . 'posts WHERE topic_id = %s', $topic->topic_id ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin = Plugin_Directory::create_plugin_post( array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'slug' => $plugin_slug,
- 'status' => $status,
- 'author' => $topic->topic_poster,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'post_name' => $plugin_slug,
+ 'post_status' => $status,
+ 'post_author' => $topic->topic_poster,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'override_modified_date' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_date_gmt' => $topic->topic_start_time,
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_date' => $topic->topic_start_time,
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_modified' => $topic->topic_time,
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_modified_gmt' => $topic->topic_time,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'meta' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'meta_input' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> '_author_ip' => $author_ip,
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassuploadhandlerphp"></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/shortcodes/class-upload-handler.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/shortcodes/class-upload-handler.php 2016-06-11 21:55:15 UTC (rev 3334)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php 2016-06-11 22:07:10 UTC (rev 3335)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -174,14 +174,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Add a Plugin Directory entry for this plugin.
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_post = Plugin_Directory::create_plugin_post( array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'title' => $this->plugin['Name'],
- 'slug' => $this->plugin_slug,
- 'status' => 'draft',
- 'author' => get_current_user_id(),
- 'content' => $content,
- 'description' => $this->plugin['Description'],
- 'tags' => $readme->tags,
- 'meta' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'post_title' => $this->plugin['Name'],
+ 'post_name' => $this->plugin_slug,
+ 'post_content' => $content,
+ 'post_excerpt' => $this->plugin['Description'],
+ 'tax_input' => wp_unslash( $_POST['tax_input'] ),
+ 'meta_input' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'tested' => $readme->tested,
</span><span class="cx" style="display: block; padding: 0 10px"> 'requires' => $readme->requires,
</span><span class="cx" style="display: block; padding: 0 10px"> 'stable_tag' => $readme->stable_tag,
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassuploadphp"></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/shortcodes/class-upload.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/shortcodes/class-upload.php 2016-06-11 21:55:15 UTC (rev 3334)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php 2016-06-11 22:07:10 UTC (rev 3335)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,6 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ob_start();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_user_logged_in() ) :
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ include_once ABSPATH . 'wp-admin/includes/template.php';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' ) && 'upload' === $_POST['action'] ) :
</span><span class="cx" style="display: block; padding: 0 10px"> if ( UPLOAD_ERR_OK === $_FILES['zip_file']['error'] ) :
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,9 +41,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <form enctype="multipart/form-data" id="upload_form" method="POST" action="">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <form id="upload_form" enctype="multipart/form-data" method="POST" action="">
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php wp_nonce_field( 'wporg-plugins-upload' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="action" value="upload"/>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <fieldset>
+ <legend><?php _e( 'Plugin Categories (up to 3)', 'wporg-plugins' ); ?></legend>
+ <ul class="category-checklist form-no-clear">
+ <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?>
+ </ul>
+ </fieldset>
</ins><span class="cx" style="display: block; padding: 0 10px"> <input type="file" id="zip_file" name="zip_file" size="25"/>
</span><span class="cx" style="display: block; padding: 0 10px"> <input id="upload_button" class="button" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/>
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>