Changeset 12617 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
- Timestamp:
- 06/05/2023 04:28:35 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
r12565 r12617 7 7 * Retrieves plugins in the queue submitted by the current user. 8 8 * 9 * @return array An array of user's plugins .9 * @return array An array of user's plugins, and counts of it. 10 10 */ 11 11 public static function get_submitted_plugins() { … … 19 19 ) ); 20 20 21 return $plugins; 21 $counts = (object) array_fill_keys( array( 'new', 'pending', 'approved' ), 0 ); 22 $counts->total = count( $plugins ); 23 24 // Set the status text for each type. 25 foreach ( $plugins as &$plugin ) { 26 $counts->{ $plugin->post_status }++; 27 28 if ( 'new' === $plugin->post_status ) { 29 $plugin->status = __( 'Awaiting Review — This plugin has not yet been reviewed.', 'wporg-plugins' ); 30 } elseif ( 'pending' === $plugin->post_status ) { 31 $plugin->status = __( 'Being Reviewed — This plugin is currently waiting on action from you. Please check your email for details.', 'wporg-plugins' ); 32 } elseif ( 'approved' === $plugin->post_status ) { 33 $plugin->status = __( 'Approved — Please check your email for instructions on uploading your plugin.', 'wporg-plugins' ); 34 } 35 } 36 37 return [ $plugins, $counts ]; 22 38 } 23 39 … … 33 49 include_once ABSPATH . 'wp-admin/includes/template.php'; 34 50 35 $submitted_plugins = self::get_submitted_plugins(); 36 $submitted_counts = (object) array_fill_keys( array( 'new', 'pending', 'approved' ), 0 ); 37 38 $submitted_counts->total = count( $submitted_plugins ); 39 40 foreach ( $submitted_plugins as $key => $plugin ) { 41 if ( 'new' === $plugin->post_status ) { 42 $submitted_plugins[ $key ]->status = __( 'Awaiting Review', 'wporg-plugins' ); 43 $submitted_counts->new++; 44 } elseif ( 'pending' === $plugin->post_status ) { 45 $submitted_plugins[ $key ]->status = __( 'Being Reviewed', 'wporg-plugins' ); 46 $submitted_counts->pending++; 47 } elseif ( 'approved' === $plugin->post_status ) { 48 $submitted_plugins[ $key ]->status = __( 'Approved', 'wporg-plugins' ); 49 $submitted_counts->approved++; 50 } 51 } 51 list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins(); 52 52 53 53 $upload_result = false; … … 58 58 && 'upload' === $_POST['action'] 59 59 && ! $submitted_counts->total 60 ) :61 if ( UPLOAD_ERR_OK === $_FILES['zip_file']['error'] ) :60 ) { 61 if ( UPLOAD_ERR_OK === $_FILES['zip_file']['error'] ) { 62 62 $upload_result = $uploader->process_upload(); 63 63 … … 67 67 $message = $upload_result; 68 68 } 69 else : 69 70 // Refresh the lists. 71 list( $submitted_plugins, $submitted_counts ) = self::get_submitted_plugins(); 72 73 } else { 70 74 $message = __( 'Error in file upload.', 'wporg-plugins' ); 71 endif;72 73 if ( ! empty( $message ) ) :75 } 76 77 if ( ! empty( $message ) ) { 74 78 echo "<div class='notice notice-warning notice-alt'><p>{$message}</p></div>\n"; 75 endif; 76 77 else : 79 } 80 } 81 82 if ( ! is_wp_error( $upload_result ) ) : 78 83 $plugins = wp_count_posts( 'plugin', 'readable' ); 79 84 $oldest_plugin = get_posts( [ 'post_type' => 'plugin', 'post_status' => 'new', 'order' => 'ASC', 'orderby' => 'post_date_gmt', 'numberposts' => 1 ] ); … … 115 120 '<strong>' . number_format_i18n( $queue_length ) . '</strong>' 116 121 ); 122 } else { 123 echo '</p><p>'; 124 printf( 125 /* translators: plugins@wordpress.org */ 126 __( 'Please wait at least 7 business days before asking for an update status from <a href="mailto:%1$s">%1$s</a>.', 'wporg-plugins' ), 127 'plugins@wordpress.org' 128 ); 129 echo '</p>'; 117 130 } 118 131 ?> … … 167 180 // List of all plugins in progress. 168 181 foreach ( $submitted_plugins as $plugin ) { 169 echo '<li>' . esc_html( $plugin->post_title ) . ' — ' . $plugin->status . "</li>\n"; 182 $can_change_slug = ! $plugin->{'_wporg_plugin_original_slug'}; 183 184 echo '<li>'; 185 echo '<strong>' . esc_html( $plugin->post_title ) . '</strong>'; 186 echo '<ul>'; 187 printf( 188 '<li>%s</li>', 189 sprintf( 190 __( 'Review status: %s', 'wporg-plugins' ), 191 $plugin->status 192 ) 193 ); 194 echo '<li>'; 195 printf( 196 __( 'Current assigned slug: %s', 'wporg-plugins' ), 197 '<code>' . esc_html( $plugin->post_name ) . '</code>' 198 ); 199 ?> 200 <?php if ( $can_change_slug ) : ?> 201 <a href="#" class="hide-if-no-js" onclick="this.nextElementSibling.showModal()"><?php _e( 'change', 'wporg-plugins' ); ?></a> 202 <dialog class="slug-change hide-if-no-js"> 203 <a onclick="this.parentNode.close()" class="close dashicons dashicons-no-alt"></a> 204 <strong><?php _e( 'Request to change your plugin slug', 'wporg-plugins' ); ?></strong> 205 <form> 206 <input type="hidden" name="action" value="request-slug-change" /> 207 <input type="hidden" name="id" value="<?php echo esc_attr( $plugin->ID ); ?>" /> 208 209 <div class="notice notice-info notice-alt"> 210 <p><?php _e( 'Your chosen slug cannot be guaranteed, and is subject to change based on the results of your review.', 'wporg-plugins' ); ?></p> 211 <p><?php 212 printf( 213 /* Translators: URL */ 214 __( "Your slug is used to generate your plugins URL. Currently it's %s", 'wporg-plugins' ), 215 '<code>' . esc_url( home_url( $plugin->post_name ) . '/' ) . '</code>' 216 ); 217 ?></p> 218 <p><?php _e( 'Your slug (aka permalink) cannot be changed once your review is completed. Please choose carefully.', 'wporg-plugins' ); ?></p> 219 </div> 220 <div class="notice notice-error notice-alt hidden"><p></p></div> 221 <p> 222 <label> 223 <strong><?php _e( 'Plugin Name', 'wporg-plugins' ); ?></strong><br> 224 <?php echo esc_html( $plugin->post_title ); ?> 225 </label> 226 </p> 227 <p> 228 <label> 229 <strong><?php _e( 'Desired Slug', 'wporg-plugins' ); ?></strong><br> 230 <input type="text" name="post_name" required maxlength="200" pattern="[a-z0-9-]*" value="<?php echo esc_attr( $plugin->post_name ); ?>" /> 231 </label> 232 </p> 233 234 <p> 235 <label> 236 <input type="checkbox" name="confirm" required /> 237 <?php 238 printf( 239 /* Translators: URL to plugin guidelines */ 240 __( 'I confirm that my slug choice <a href="%s">meets the guidelines for plugin slugs</a>.', 'wporg-plugins' ), 241 'https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#17-plugins-must-respect-trademarks-copyrights-and-project-names' 242 ); 243 ?> 244 </label> 245 </p> 246 <p> 247 <input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Request', 'wporg-plugins' ); ?>" /> 248 </p> 249 </form> 250 </dialog> 251 <?php 252 endif; // $can_change_slug 253 echo '</li>'; 254 echo '</ul>'; 255 256 echo "</li>\n"; 170 257 } 171 258 ?> 172 259 </ul> 173 174 <p>175 <?php176 printf(177 /* translators: plugins@wordpress.org */178 __( 'Please wait at least 7 business days before asking for an update status from <a href="mailto:%1$s">%1$s</a>.', 'wporg-plugins' ),179 'plugins@wordpress.org'180 );181 ?>182 </p>183 260 </div> 184 261 185 262 <?php endif; // $submitted_counts->total ?> 186 263 187 <?php endif; // wp_verify_nonce() && 'upload' === $_POST['action']?>264 <?php endif; // ! is_wp_error( $upload_result ) ?> 188 265 189 266 <?php
Note: See TracChangeset
for help on using the changeset viewer.