<!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>[12618] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes: Plugin Directory: Upload Shortcode: Remove a level of `if()` nesting for slightly more readable code.</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 { white-space: pre-line; 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/12618">12618</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/12618","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-06-05 04:40:30 +0000 (Mon, 05 Jun 2023)</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: Upload Shortcode: Remove a level of `if()` nesting for slightly more readable code.</pre>
<h3>Modified Paths</h3>
<ul>
<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_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 2023-06-05 04:28:35 UTC (rev 12617)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php 2023-06-05 04:40:30 UTC (rev 12618)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,8 +60,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string|WP_Error Confirmation message on success, WP_Error object on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function process_upload() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( UPLOAD_ERR_OK !== $_FILES['zip_file']['error'] ) {
+ return new \WP_Error( 'error_upload', __( 'Error in file upload.', 'wporg-plugins' ) );
+ }
+
+ $zip_file = $_FILES['zip_file']['tmp_name'];
</ins><span class="cx" style="display: block; padding: 0 10px"> $has_upload_token = $this->has_valid_upload_token();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $zip_file = $_FILES['zip_file']['tmp_name'];
</del><span class="cx" style="display: block; padding: 0 10px"> $this->plugin_dir = Filesystem::unzip( $zip_file );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $plugin_data = (array) Import::find_plugin_headers( $this->plugin_dir, 1 /* Max Depth to search */ );
</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 2023-06-05 04:28:35 UTC (rev 12617)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php 2023-06-05 04:40:30 UTC (rev 12618)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,356 +41,342 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Renders the upload shortcode.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function display() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! is_user_logged_in() ) {
+ return '<div class="notice notice-error notice-alt"><p>' . sprintf(
+ /* translators: Login URL */
+ __( 'Before you can upload a new plugin, <a href="%s">please log in</a>.', 'wporg-plugins' ),
+ esc_url( wp_login_url() )
+ ) . '</p></div>';
+ }
+
</ins><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"> $uploader = new Upload_Handler();
</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 ( is_user_logged_in() ) :
- include_once ABSPATH . 'wp-admin/includes/template.php';
</del><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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $upload_result = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $upload_result = false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (
- ! empty( $_POST['_wpnonce'] )
- && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' )
- && 'upload' === $_POST['action']
- && ! $submitted_counts->total
- ) {
- if ( UPLOAD_ERR_OK === $_FILES['zip_file']['error'] ) {
- $upload_result = $uploader->process_upload();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (
+ ! empty( $_POST['_wpnonce'] )
+ && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-plugins-upload' )
+ && 'upload' === $_POST['action']
+ && ! $submitted_counts->total
+ && ! empty( $_FILES['zip_file'] )
+ ) {
+ $upload_result = $uploader->process_upload();
</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( $upload_result ) ) {
- $message = $upload_result->get_error_message();
- } else {
- $message = $upload_result;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_wp_error( $upload_result ) ) {
+ $message = $upload_result->get_error_message();
+ } else {
+ $message = $upload_result;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Refresh the lists.
- list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Refresh the lists.
+ list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $message ) ) {
+ echo "<div class='notice notice-warning notice-alt'><p>{$message}</p></div>\n";
+ }
+ }
+
+ if ( ! is_wp_error( $upload_result ) ) :
+ $plugins = wp_count_posts( 'plugin', 'readable' );
+ $oldest_plugin = get_posts( [ 'post_type' => 'plugin', 'post_status' => 'new', 'order' => 'ASC', 'orderby' => 'post_date_gmt', 'numberposts' => 1 ] );
+ $queue_length = floor( ( time() - strtotime( $oldest_plugin[0]->post_date_gmt ?? 'now' ) ) / DAY_IN_SECONDS );
+ ?>
+
+ <div class="plugin-queue-message notice notice-info notice-alt">
+ <p>
+ <?php
+ if ( 1 === (int) $plugins->new ) {
+ esc_html_e( 'Currently there is 1 plugin awaiting review.', 'wporg-plugins' );
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $message = __( 'Error in file upload.', 'wporg-plugins' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ printf(
+ /* translators: %s: Amount of plugins awaiting review. */
+ esc_html( _n(
+ 'Currently there is %s plugin awaiting review.',
+ 'Currently there are %s plugins awaiting review.',
+ $plugins->new,
+ 'wporg-plugins'
+ ) ),
+ '<strong>' . number_format_i18n( $plugins->new ) . '</strong>'
+ );
</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">- if ( ! empty( $message ) ) {
- echo "<div class='notice notice-warning notice-alt'><p>{$message}</p></div>\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If the queue is currently beyond 10 days, display a warning to that effect.
+ if ( $queue_length > 10 ) {
+ echo '</p><p>';
+ esc_html_e( 'The review queue is currently longer than normal, we apologize for the delays and ask for patience.', 'wporg-plugins' );
+
+ echo '</p><p>';
+ printf(
+ /* translators: %s: Number of days. Only displayed if > 10 */
+ esc_html( _n(
+ 'The current wait for an initial review is at least %s day.',
+ 'The current wait for an initial review is at least %s days.',
+ $queue_length,
+ 'wporg-plugins'
+ ) ),
+ '<strong>' . number_format_i18n( $queue_length ) . '</strong>'
+ );
+ } else {
+ echo '</p><p>';
+ printf(
+ /* translators: plugins@wordpress.org */
+ __( 'Please wait at least 7 business days before asking for an update status from <a href="mailto:%1$s">%1$s</a>.', 'wporg-plugins' ),
+ 'plugins@wordpress.org'
+ );
+ echo '</p>';
</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( $upload_result ) ) :
- $plugins = wp_count_posts( 'plugin', 'readable' );
- $oldest_plugin = get_posts( [ 'post_type' => 'plugin', 'post_status' => 'new', 'order' => 'ASC', 'orderby' => 'post_date_gmt', 'numberposts' => 1 ] );
- $queue_length = floor( ( time() - strtotime( $oldest_plugin[0]->post_date_gmt ?? 'now' ) ) / DAY_IN_SECONDS );
</del><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ </p>
+ </div>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div class="plugin-queue-message notice notice-info notice-alt">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( $submitted_counts->total ) : ?>
+
+ <div class="plugin-queue-message notice notice-warning notice-alt">
</ins><span class="cx" style="display: block; padding: 0 10px"> <p>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 1 === (int) $plugins->new ) {
- esc_html_e( 'Currently there is 1 plugin awaiting review.', 'wporg-plugins' );
- } else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 0 !== $submitted_counts->approved ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: %s: Amount of plugins awaiting review. */
- esc_html( _n(
- 'Currently there is %s plugin awaiting review.',
- 'Currently there are %s plugins awaiting review.',
- $plugins->new,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* translators: 1: Amount of approved plugins; 2: URL on how to use SVN */
+ wp_kses_post( _n(
+ 'You have %1$s approved plugin that has not yet been used. We require developers to use the hosting we provide. Please upload your plugin via <a href="%2$s">SVN</a>.',
+ 'You have %1$s approved plugins that have not yet been used. We require developers to use the hosting we provide. Please upload your plugins via <a href="%2$s">SVN</a>.',
+ $submitted_counts->approved,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wporg-plugins'
</span><span class="cx" style="display: block; padding: 0 10px"> ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '<strong>' . number_format_i18n( $plugins->new ) . '</strong>'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '<strong>' . $submitted_counts->approved . '</strong>',
+ 'https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/'
</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 the queue is currently beyond 10 days, display a warning to that effect.
- if ( $queue_length > 10 ) {
- echo '</p><p>';
- esc_html_e( 'The review queue is currently longer than normal, we apologize for the delays and ask for patience.', 'wporg-plugins' );
-
- echo '</p><p>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( 0 !== $submitted_counts->pending ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: %s: Number of days. Only displayed if > 10 */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* translators: %s: Amount of pending plugins. */
</ins><span class="cx" style="display: block; padding: 0 10px"> esc_html( _n(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'The current wait for an initial review is at least %s day.',
- 'The current wait for an initial review is at least %s days.',
- $queue_length,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'You have %s plugin being actively reviewed and have been sent an email regarding issues. You must complete this review before you can submit another plugin. Please reply to that email with your corrected code attached or linked in order to proceed with the review.',
+ 'You have %s plugins being actively reviewed and have been sent emails regarding issues. You must complete their reviews before you can submit another plugin. Please reply to the emails with your corrected code attached or linked in order to proceed with each review.',
+ $submitted_counts->pending,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wporg-plugins'
</span><span class="cx" style="display: block; padding: 0 10px"> ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '<strong>' . number_format_i18n( $queue_length ) . '</strong>'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '<strong>' . $submitted_counts->pending . '</strong>'
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- echo '</p><p>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( 0 !== $submitted_counts->new ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: plugins@wordpress.org */
- __( 'Please wait at least 7 business days before asking for an update status from <a href="mailto:%1$s">%1$s</a>.', 'wporg-plugins' ),
- 'plugins@wordpress.org'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* translators: %s: Amount of new plugins. */
+ esc_html( _n(
+ 'You have %s plugin that has been recently submitted but not yet reviewed. Please wait for your plugin to be reviewed and approved before submitting another.',
+ 'You have %s plugins already submitted but not yet reviewed. Please wait for them to be reviewed and approved before submitting another plugin.',
+ $submitted_counts->new,
+ 'wporg-plugins'
+ ) ),
+ '<strong>' . $submitted_counts->new . '</strong>'
</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 '</p>';
</del><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"> </p>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- </div>
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php if ( $submitted_counts->total ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <ul>
+ <?php
+ // List of all plugins in progress.
+ foreach ( $submitted_plugins as $plugin ) {
+ $can_change_slug = ! $plugin->{'_wporg_plugin_original_slug'};
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div class="plugin-queue-message notice notice-warning notice-alt">
- <p>
- <?php
- if ( 0 !== $submitted_counts->approved ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '<li>';
+ echo '<strong>' . esc_html( $plugin->post_title ) . '</strong>';
+ echo '<ul>';
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: 1: Amount of approved plugins; 2: URL on how to use SVN */
- wp_kses_post( _n(
- 'You have %1$s approved plugin that has not yet been used. We require developers to use the hosting we provide. Please upload your plugin via <a href="%2$s">SVN</a>.',
- 'You have %1$s approved plugins that have not yet been used. We require developers to use the hosting we provide. Please upload your plugins via <a href="%2$s">SVN</a>.',
- $submitted_counts->approved,
- 'wporg-plugins'
- ) ),
- '<strong>' . $submitted_counts->approved . '</strong>',
- 'https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '<li>%s</li>',
+ sprintf(
+ __( 'Review status: %s', 'wporg-plugins' ),
+ $plugin->status
+ )
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 0 !== $submitted_counts->pending ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '<li>';
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: %s: Amount of pending plugins. */
- esc_html( _n(
- 'You have %s plugin being actively reviewed and have been sent an email regarding issues. You must complete this review before you can submit another plugin. Please reply to that email with your corrected code attached or linked in order to proceed with the review.',
- 'You have %s plugins being actively reviewed and have been sent emails regarding issues. You must complete their reviews before you can submit another plugin. Please reply to the emails with your corrected code attached or linked in order to proceed with each review.',
- $submitted_counts->pending,
- 'wporg-plugins'
- ) ),
- '<strong>' . $submitted_counts->pending . '</strong>'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ __( 'Current assigned slug: %s', 'wporg-plugins' ),
+ '<code>' . esc_html( $plugin->post_name ) . '</code>'
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 0 !== $submitted_counts->new ) {
- printf(
- /* translators: %s: Amount of new plugins. */
- esc_html( _n(
- 'You have %s plugin that has been recently submitted but not yet reviewed. Please wait for your plugin to be reviewed and approved before submitting another.',
- 'You have %s plugins already submitted but not yet reviewed. Please wait for them to be reviewed and approved before submitting another plugin.',
- $submitted_counts->new,
- 'wporg-plugins'
- ) ),
- '<strong>' . $submitted_counts->new . '</strong>'
- );
- }
- ?>
- </p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ?>
+ <?php if ( $can_change_slug ) : ?>
+ <a href="#" class="hide-if-no-js" onclick="this.nextElementSibling.showModal()"><?php _e( 'change', 'wporg-plugins' ); ?></a>
+ <dialog class="slug-change hide-if-no-js">
+ <a onclick="this.parentNode.close()" class="close dashicons dashicons-no-alt"></a>
+ <strong><?php _e( 'Request to change your plugin slug', 'wporg-plugins' ); ?></strong>
+ <form>
+ <input type="hidden" name="action" value="request-slug-change" />
+ <input type="hidden" name="id" value="<?php echo esc_attr( $plugin->ID ); ?>" />
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <ul>
- <?php
- // List of all plugins in progress.
- foreach ( $submitted_plugins as $plugin ) {
- $can_change_slug = ! $plugin->{'_wporg_plugin_original_slug'};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="notice notice-info notice-alt">
+ <p><?php _e( 'Your chosen slug cannot be guaranteed, and is subject to change based on the results of your review.', 'wporg-plugins' ); ?></p>
+ <p><?php
+ printf(
+ /* Translators: URL */
+ __( "Your slug is used to generate your plugins URL. Currently it's %s", 'wporg-plugins' ),
+ '<code>' . esc_url( home_url( $plugin->post_name ) . '/' ) . '</code>'
+ );
+ ?></p>
+ <p><?php _e( 'Your slug (aka permalink) cannot be changed once your review is completed. Please choose carefully.', 'wporg-plugins' ); ?></p>
+ </div>
+ <div class="notice notice-error notice-alt hidden"><p></p></div>
+ <p>
+ <label>
+ <strong><?php _e( 'Plugin Name', 'wporg-plugins' ); ?></strong><br>
+ <?php echo esc_html( $plugin->post_title ); ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <strong><?php _e( 'Desired Slug', 'wporg-plugins' ); ?></strong><br>
+ <input type="text" name="post_name" required maxlength="200" pattern="[a-z0-9-]*" value="<?php echo esc_attr( $plugin->post_name ); ?>" />
+ </label>
+ </p>
</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 '<li>';
- echo '<strong>' . esc_html( $plugin->post_title ) . '</strong>';
- echo '<ul>';
- printf(
- '<li>%s</li>',
- sprintf(
- __( 'Review status: %s', 'wporg-plugins' ),
- $plugin->status
- )
- );
- echo '<li>';
- printf(
- __( 'Current assigned slug: %s', 'wporg-plugins' ),
- '<code>' . esc_html( $plugin->post_name ) . '</code>'
- );
- ?>
- <?php if ( $can_change_slug ) : ?>
- <a href="#" class="hide-if-no-js" onclick="this.nextElementSibling.showModal()"><?php _e( 'change', 'wporg-plugins' ); ?></a>
- <dialog class="slug-change hide-if-no-js">
- <a onclick="this.parentNode.close()" class="close dashicons dashicons-no-alt"></a>
- <strong><?php _e( 'Request to change your plugin slug', 'wporg-plugins' ); ?></strong>
- <form>
- <input type="hidden" name="action" value="request-slug-change" />
- <input type="hidden" name="id" value="<?php echo esc_attr( $plugin->ID ); ?>" />
-
- <div class="notice notice-info notice-alt">
- <p><?php _e( 'Your chosen slug cannot be guaranteed, and is subject to change based on the results of your review.', 'wporg-plugins' ); ?></p>
- <p><?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p>
+ <label>
+ <input type="checkbox" name="confirm" required />
+ <?php
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* Translators: URL */
- __( "Your slug is used to generate your plugins URL. Currently it's %s", 'wporg-plugins' ),
- '<code>' . esc_url( home_url( $plugin->post_name ) . '/' ) . '</code>'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /* Translators: URL to plugin guidelines */
+ __( 'I confirm that my slug choice <a href="%s">meets the guidelines for plugin slugs</a>.', 'wporg-plugins' ),
+ 'https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#17-plugins-must-respect-trademarks-copyrights-and-project-names'
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ?></p>
- <p><?php _e( 'Your slug (aka permalink) cannot be changed once your review is completed. Please choose carefully.', 'wporg-plugins' ); ?></p>
- </div>
- <div class="notice notice-error notice-alt hidden"><p></p></div>
- <p>
- <label>
- <strong><?php _e( 'Plugin Name', 'wporg-plugins' ); ?></strong><br>
- <?php echo esc_html( $plugin->post_title ); ?>
- </label>
- </p>
- <p>
- <label>
- <strong><?php _e( 'Desired Slug', 'wporg-plugins' ); ?></strong><br>
- <input type="text" name="post_name" required maxlength="200" pattern="[a-z0-9-]*" value="<?php echo esc_attr( $plugin->post_name ); ?>" />
- </label>
- </p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ?>
+ </label>
+ </p>
+ <p>
+ <input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Request', 'wporg-plugins' ); ?>" />
+ </p>
+ </form>
+ </dialog>
+ <?php
+ endif; // $can_change_slug
+ echo '</li>';
+ echo '</ul>';
+
+ echo "</li>\n";
+ }
+ ?>
+ </ul>
+ </div>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p>
- <label>
- <input type="checkbox" name="confirm" required />
- <?php
- printf(
- /* Translators: URL to plugin guidelines */
- __( 'I confirm that my slug choice <a href="%s">meets the guidelines for plugin slugs</a>.', 'wporg-plugins' ),
- 'https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#17-plugins-must-respect-trademarks-copyrights-and-project-names'
- );
- ?>
- </label>
- </p>
- <p>
- <input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Request', 'wporg-plugins' ); ?>" />
- </p>
- </form>
- </dialog>
- <?php
- endif; // $can_change_slug
- echo '</li>';
- echo '</ul>';
-
- echo "</li>\n";
- }
- ?>
- </ul>
- </div>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php endif; // $submitted_counts->total ?>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php endif; // $submitted_counts->total ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php endif; // ! is_wp_error( $upload_result )
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php endif; // ! is_wp_error( $upload_result ) ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_email_address_unsafe( wp_get_current_user()->user_email ) ) {
+ echo '<div class="notice notice-error notice-alt"><p>' .
+ sprintf(
+ /* translators: %s: Profile edit url. */
+ __( 'Your email host has email deliverability problems. Please <a href="%s">Update your email address</a> first.', 'wporg-plugins'),
+ esc_url( 'https://wordpress.org/support/users/' . wp_get_current_user()->user_nicename . '/edit' )
+ ) .
+ "</p></div>\n";
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php
- if ( is_email_address_unsafe( wp_get_current_user()->user_email ) ) {
- echo '<div class="notice notice-error notice-alt"><p>' .
- sprintf(
- /* translators: %s: Profile edit url. */
- __( 'Your email host has email deliverability problems. Please <a href="%s">Update your email address</a> first.', 'wporg-plugins'),
- esc_url( 'https://wordpress.org/support/users/' . wp_get_current_user()->user_nicename . '/edit' )
- ) .
- "</p></div>\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if ( ! $submitted_counts->total && ( ! $upload_result || is_wp_error( $upload_result ) ) ) : ?>
+ <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action="">
+ <?php wp_nonce_field( 'wporg-plugins-upload' ); ?>
+ <input type="hidden" name="action" value="upload"/>
+ <?php
+ if ( ! empty( $_REQUEST['upload_token'] ) ) {
+ printf(
+ '<input type="hidden" name="upload_token" value="%s"/>',
+ esc_attr( $_REQUEST['upload_token'] )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if ( ! $submitted_counts->total && ( ! $upload_result || is_wp_error( $upload_result ) ) ) : ?>
-
- <form id="upload_form" class="plugin-upload-form" enctype="multipart/form-data" method="POST" action="">
- <?php wp_nonce_field( 'wporg-plugins-upload' ); ?>
- <input type="hidden" name="action" value="upload"/>
- <?php
- if ( ! empty( $_REQUEST['upload_token'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $uploader->has_valid_upload_token() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '<input type="hidden" name="upload_token" value="%s"/>',
- esc_attr( $_REQUEST['upload_token'] )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '<div class="notice notice-error notice-alt"><p>%s</p></div>',
+ esc_html__( 'The token provided is invalid for this user.', 'wporg-plugins')
</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 ( ! $uploader->has_valid_upload_token() ) {
- printf(
- '<div class="notice notice-error notice-alt"><p>%s</p></div>',
- esc_html__( 'The token provided is invalid for this user.', 'wporg-plugins')
- );
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ?>
- <?php
- /*
- <fieldset>
- <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend>
- <ul class="category-checklist">
- <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?>
- </ul>
- </fieldset> */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ ?>
+ <?php
+ /*
+ <fieldset>
+ <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend>
+ <ul class="category-checklist">
+ <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?>
+ </ul>
+ </fieldset> */
</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">- <input type="file" id="zip_file" class="plugin-file" name="zip_file" size="25" accept=".zip"/>
- <label class="button button-secondary" for="zip_file"><?php _e( 'Select File', 'wporg-plugins' ); ?></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <input type="file" id="zip_file" class="plugin-file" name="zip_file" size="25" accept=".zip"/>
+ <label class="button button-secondary" for="zip_file"><?php _e( 'Select File', 'wporg-plugins' ); ?></label>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p>
- <small>
- <?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p>
+ <small>
+ <?php
+ printf(
+ /* translators: Maximum allowed file size. */
+ esc_html__( 'Maximum allowed file size: %s', 'wporg-plugins' ),
+ esc_html( size_format( wp_max_upload_size() ) )
+ );
+ ?>
+ </small>
+ </p>
+
+ <p>
+ <label>
+ <input type="checkbox" name="requirements[faq]" required="required">
+ <?php
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /* translators: Maximum allowed file size. */
- esc_html__( 'Maximum allowed file size: %s', 'wporg-plugins' ),
- esc_html( size_format( wp_max_upload_size() ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ __( 'I have read the <a href="%s">Frequently Asked Questions</a>.', 'wporg-plugins' ),
+ 'https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/'
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ?>
- </small>
- </p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ?>
+ </label>
+ <br>
+ <label>
+ <input type="checkbox" name="requirements[guidelines]" required="required">
+ <?php
+ printf(
+ __( 'This plugin complies with all of the <a href="%s">Plugin Developer Guidelines</a>.', 'wporg-plugins' ),
+ 'https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/'
+ );
+ ?>
+ </label>
+ <br>
+ <label>
+ <input type="checkbox" name="requirements[author]" required="required">
+ <?php _e( 'I have permission to upload this plugin to WordPress.org for others to use and share.', 'wporg-plugins' ); ?>
+ </label>
+ <br>
+ <label>
+ <input type="checkbox" name="requirements[license]" required="required">
+ <?php _e( 'This plugin, all included libraries, and any other included assets are licenced as GPL or are under a GPL compatible license.', 'wporg-plugins' ); ?>
+ </label>
+ </p>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p>
- <label>
- <input type="checkbox" name="requirements[faq]" required="required">
- <?php
- printf(
- __( 'I have read the <a href="%s">Frequently Asked Questions</a>.', 'wporg-plugins' ),
- 'https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/'
- );
- ?>
- </label>
- <br>
- <label>
- <input type="checkbox" name="requirements[guidelines]" required="required">
- <?php
- printf(
- __( 'This plugin complies with all of the <a href="%s">Plugin Developer Guidelines</a>.', 'wporg-plugins' ),
- 'https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/'
- );
- ?>
- </label>
- <br>
- <label>
- <input type="checkbox" name="requirements[author]" required="required">
- <?php _e( 'I have permission to upload this plugin to WordPress.org for others to use and share.', 'wporg-plugins' ); ?>
- </label>
- <br>
- <label>
- <input type="checkbox" name="requirements[license]" required="required">
- <?php _e( 'This plugin, all included libraries, and any other included assets are licenced as GPL or are under a GPL compatible license.', 'wporg-plugins' ); ?>
- </label>
- </p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <input id="upload_button" class="button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/>
+ </form>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <input id="upload_button" class="button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/>
- </form>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php
+ $upload_script = '
+ ( function ( $ ) {
+ var $label = $( "label.button" ),
+ labelText = $label.text();
+ $( "#zip_file" )
+ .on( "change", function( event ) {
+ var fileName = event.target.value.split( "\\\\" ).pop();
+ fileName ? $label.text( fileName ) : $label.text( labelText );
+ } )
+ .on( "focus", function() { $label.addClass( "focus" ); } )
+ .on( "blur", function() { $label.removeClass( "focus" ); } );
+ } ( window.jQuery ) );';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php
- $upload_script = '
- ( function ( $ ) {
- var $label = $( "label.button" ),
- labelText = $label.text();
- $( "#zip_file" )
- .on( "change", function( event ) {
- var fileName = event.target.value.split( "\\\\" ).pop();
- fileName ? $label.text( fileName ) : $label.text( labelText );
- } )
- .on( "focus", function() { $label.addClass( "focus" ); } )
- .on( "blur", function() { $label.removeClass( "focus" ); } );
- } ( window.jQuery ) );';
-
- if ( ! wp_script_is( 'jquery', 'done' ) ) {
- wp_enqueue_script( 'jquery' );
- wp_add_inline_script( 'jquery-migrate', $upload_script );
- } else {
- printf( '<script>%s</script>', $upload_script );
- }
- ?>
-
- <?php endif; // ! $submitted_counts->total ?>
-
- <?php else : ?>
-
- <p>
- <?php
- printf(
- /* translators: Login URL */
- __( 'Before you can upload a new plugin, <a href="%s">please log in</a>.', 'wporg-plugins' ),
- esc_url( wp_login_url() )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! wp_script_is( 'jquery', 'done' ) ) {
+ wp_enqueue_script( 'jquery' );
+ wp_add_inline_script( 'jquery-migrate', $upload_script );
+ } else {
+ printf( '<script>%s</script>', $upload_script );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- </p>
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php
- endif; // is_user_logged_in()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php endif; // ! $submitted_counts->total
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return ob_get_clean();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>