Changeset 14747 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
- Timestamp:
- 03/24/2026 04:29:07 AM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
r14745 r14747 121 121 $plugins = wp_count_posts( 'plugin', 'readable' ); 122 122 $oldest_plugin = get_posts( [ 'post_type' => 'plugin', 'post_status' => 'new', 'order' => 'ASC', 'orderby' => 'post_date_gmt', 'numberposts' => 1 ] ); 123 $queue_length_in_days = 0;124 $queue_oldest_new_plugin_date_with_offset = '';125 if(!empty($oldest_plugin)) {126 $queue_length_in_days = floor( ( time() - strtotime( $oldest_plugin[0]->post_date_gmt ?? 'now' ) ) / DAY_IN_SECONDS );127 // It adds a 36 hours offset to avoid confusion related to timezones and for it to be at least the previous day of the latest submission.128 $queue_oldest_new_plugin_date_with_offset = date_i18n(129 get_option( 'date_format' ),130 strtotime( $oldest_plugin[0]->post_date_gmt ?? 'now' ) - ( 36 * HOUR_IN_SECONDS )131 );132 }123 $queue_length_in_days = 0; 124 $queue_oldest_new_plugin_date_with_offset = ''; 125 if ( ! empty( $oldest_plugin ) ) { 126 $queue_length_in_days = floor( ( time() - strtotime( $oldest_plugin[0]->post_date_gmt ?? 'now' ) ) / DAY_IN_SECONDS ); 127 // It adds a 36 hours offset to avoid confusion related to timezones and for it to be at least the previous day of the latest submission. 128 $queue_oldest_new_plugin_date_with_offset = date_i18n( 129 get_option( 'date_format' ), 130 strtotime( $oldest_plugin[0]->post_date_gmt ?? 'now' ) - ( 36 * HOUR_IN_SECONDS ) 131 ); 132 } 133 133 ?> 134 134 … … 151 151 } 152 152 153 if($plugins->new > 0 && !empty($queue_oldest_new_plugin_date_with_offset)) {154 echo '</p><p>';155 printf(156 /* translators: %s: Date of the oldest new plugin in the queue, with a 36 hours offset. */157 esc_html( __(158 'All plugins that have been submitted before %s have received an initial response by email to their submission.',159 'wporg-plugins'160 ) ),161 '<strong>' . esc_html( $queue_oldest_new_plugin_date_with_offset ) . '</strong>'162 );163 164 // If the queue is currently beyond 10 days, display a warning to that effect.165 if($queue_length_in_days >= 10) {166 echo ' '.__( 'The review queue is currently longer than normal, we apologize for the delays and ask for patience.', 'wporg-plugins' );167 }168 }153 if ( $plugins->new > 0 && ! empty( $queue_oldest_new_plugin_date_with_offset ) ) { 154 echo '</p><p>'; 155 printf( 156 /* translators: %s: Date of the oldest new plugin in the queue, with a 36 hours offset. */ 157 esc_html( __( 158 'All plugins that have been submitted before %s have received an initial response by email to their submission.', 159 'wporg-plugins' 160 ) ), 161 '<strong>' . esc_html( $queue_oldest_new_plugin_date_with_offset ) . '</strong>' 162 ); 163 164 // If the queue is currently beyond 10 days, display a warning to that effect. 165 if ( $queue_length_in_days >= 10 ) { 166 echo ' ' . __( 'The review queue is currently longer than normal, we apologize for the delays and ask for patience.', 'wporg-plugins' ); 167 } 168 } 169 169 ?> 170 170 </p> … … 227 227 echo '<li class="plugin-submission-item">'; 228 228 echo '<div class="plugin-submission-name">' . esc_html( $plugin->post_title ) . '</div>'; 229 printf(230 '<div class="plugin-submission-submited-date">%s</div>',231 sprintf(232 __( 'Submitted on: %s', 'wporg-plugins' ),233 esc_html( wp_date( get_option( 'date_format' ), strtotime( $plugin->post_date_gmt ) ) )234 )235 );229 printf( 230 '<div class="plugin-submission-submited-date">%s</div>', 231 sprintf( 232 __( 'Submitted on: %s', 'wporg-plugins' ), 233 esc_html( wp_date( get_option( 'date_format' ), strtotime( $plugin->post_date_gmt ) ) ) 234 ) 235 ); 236 236 printf( 237 237 '<div class="plugin-submission-status">%s</div>', … … 241 241 ) 242 242 ); 243 if( 'pending' === $plugin->post_status && 244 !empty($plugin->review_email) && 245 !empty($plugin->review_email->subject) && !empty($plugin->review_email->created)) { 246 printf( 247 '<div class="plugin-submission-email">✉️✔️ %s</div>', 248 sprintf( 249 __( 'Our team emailed you on <strong>%s</strong> regarding your submission. The subject line is: "<strong>%s</strong>".', 'wporg-plugins' ), 250 esc_html( wp_date( get_option( 'date_format' ), strtotime( $plugin->review_email->created ) ) ), 251 esc_html( $plugin->review_email->subject ) 252 ) 253 ); 254 echo '<div class="plugin-submission-email-clarification">'; 255 esc_html_e('Please follow the instructions in that email to continue the review process. If you don’t see it in your inbox, check your spam or junk folder. You may also want to add plugins@wordpress.org to your email whitelist to ensure you receive future updates.', 'wporg-plugins'); 256 echo '</div>'; 257 } 258 if('new' === $plugin->post_status){ 259 printf( 260 '<div class="plugin-submission-email">✉️⏳ %s</div>', 261 sprintf( 262 __( 'Please be patient and wait for the review email. It will be sent to your email address, <strong>%s</strong>, with the subject line: "<strong>%s</strong>".', 'wporg-plugins' ), 263 esc_html( get_userdata( $plugin->post_author )->user_email ), 264 '[WordPress Plugin Directory] Review in Progress: '.$plugin->post_title 265 ) 266 ); 267 echo '<div class="plugin-submission-email-clarification">'; 268 esc_html_e('Be sure to check your spam folder, and consider adding plugins@wordpress.org to your email whitelist to ensure the message does not get missed.', 'wporg-plugins'); 269 echo '</div>'; 270 } 243 if ( 244 'pending' === $plugin->post_status && 245 ! empty( $plugin->review_email ) && 246 ! empty( $plugin->review_email->subject ) && 247 ! empty( $plugin->review_email->created ) 248 ) { 249 printf( 250 '<div class="plugin-submission-email">✉️✔️ %s</div>', 251 sprintf( 252 __( 'Our team emailed you on <strong>%s</strong> regarding your submission. The subject line is: "<strong>%s</strong>".', 'wporg-plugins' ), 253 esc_html( wp_date( get_option( 'date_format' ), strtotime( $plugin->review_email->created ) ) ), 254 esc_html( $plugin->review_email->subject ) 255 ) 256 ); 257 echo '<div class="plugin-submission-email-clarification">'; 258 esc_html_e( 'Please follow the instructions in that email to continue the review process. If you don’t see it in your inbox, check your spam or junk folder. You may also want to add plugins@wordpress.org to your email whitelist to ensure you receive future updates.', 'wporg-plugins' ); 259 echo '</div>'; 260 } 261 if ( 'new' === $plugin->post_status ) { 262 printf( 263 '<div class="plugin-submission-email">✉️⏳ %s</div>', 264 sprintf( 265 __( 'Please be patient and wait for the review email. It will be sent to your email address, <strong>%s</strong>, with the subject line: "<strong>%s</strong>".', 'wporg-plugins' ), 266 esc_html( get_userdata( $plugin->post_author )->user_email ), 267 '[WordPress Plugin Directory] Review in Progress: ' . $plugin->post_title 268 ) 269 ); 270 echo '<div class="plugin-submission-email-clarification">'; 271 esc_html_e( 'Be sure to check your spam folder, and consider adding plugins@wordpress.org to your email whitelist to ensure the message does not get missed.', 'wporg-plugins' ); 272 echo '</div>'; 273 } 271 274 echo '<div class="plugin-submission-assigned-slug">'; 272 275 printf( … … 371 374 echo '<strong>' . __( 'Submitted files:', 'wporg-plugins' ) . '</strong>'; 372 375 foreach ( $attached_media as $attachment_post_id => $upload ) { 373 echo '<div class="plugin-submission-file">';374 echo '<table class="plugin-submission-file__meta">';375 echo '<tbody>';376 377 echo '<tr>';378 echo '<th scope="row">' . esc_html__( 'Upload Date:', 'wporg-plugins' ) . '</th>';379 echo '<td>' . esc_html( wp_date( get_option( 'date_format' ), strtotime( $upload->post_date ) ) ) . '</td>';380 echo '</tr>';381 382 echo '<tr>';383 echo '<th scope="row">' . esc_html__( 'File:', 'wporg-plugins' ) . '</th>';384 echo '<td><code>' . esc_html( $upload->submitted_name ) . '</code></td>';385 echo '</tr>';386 387 echo '<tr>';388 echo '<th scope="row">' . esc_html__( 'Version:', 'wporg-plugins' ) . '</th>';389 echo '<td><code>' . esc_html( $upload->version ) . '</code></td>';390 echo '</tr>';391 392 echo '</tbody>';393 echo '</table>';394 395 if ( $upload->post_content ) {396 echo '<div class="plugin-submission-file__notes">' . nl2br( wp_kses_post( $upload->post_content ) ) . '</div>';397 }398 399 if ( array_key_first( $attached_media ) === $attachment_post_id ) {400 printf(401 '<div class="plugin-submission-file__pcp wp-block-button is-small"><a href="%s" class="%s" target="_blank">%s</a></div>',402 esc_url( Template::preview_link_zip( $plugin->post_name, $upload->ID, 'pcp' ) ),403 'wp-block-button__link',404 __( 'Check with Plugin Check', 'wporg-plugins' )405 );406 }407 echo '</div>';376 echo '<div class="plugin-submission-file">'; 377 echo '<table class="plugin-submission-file__meta">'; 378 echo '<tbody>'; 379 380 echo '<tr>'; 381 echo '<th scope="row">' . esc_html__( 'Upload Date:', 'wporg-plugins' ) . '</th>'; 382 echo '<td>' . esc_html( wp_date( get_option( 'date_format' ), strtotime( $upload->post_date ) ) ) . '</td>'; 383 echo '</tr>'; 384 385 echo '<tr>'; 386 echo '<th scope="row">' . esc_html__( 'File:', 'wporg-plugins' ) . '</th>'; 387 echo '<td><code>' . esc_html( $upload->submitted_name ) . '</code></td>'; 388 echo '</tr>'; 389 390 echo '<tr>'; 391 echo '<th scope="row">' . esc_html__( 'Version:', 'wporg-plugins' ) . '</th>'; 392 echo '<td><code>' . esc_html( $upload->version ) . '</code></td>'; 393 echo '</tr>'; 394 395 echo '</tbody>'; 396 echo '</table>'; 397 398 if ( $upload->post_content ) { 399 echo '<div class="plugin-submission-file__notes">' . nl2br( wp_kses_post( $upload->post_content ) ) . '</div>'; 400 } 401 402 if ( array_key_first( $attached_media ) === $attachment_post_id ) { 403 printf( 404 '<div class="plugin-submission-file__pcp wp-block-button is-small"><a href="%s" class="%s" target="_blank">%s</a></div>', 405 esc_url( Template::preview_link_zip( $plugin->post_name, $upload->ID, 'pcp' ) ), 406 'wp-block-button__link', 407 __( 'Check with Plugin Check', 'wporg-plugins' ) 408 ); 409 } 410 echo '</div>'; 408 411 } 409 412 … … 443 446 <input type="hidden" name="action" value="upload"/> 444 447 445 <h3><?php esc_html_e( 'Please, read and check the following before uploading your plugin', 'wporg-plugins' ); ?></h3>448 <h3><?php esc_html_e( 'Please, read and check the following before uploading your plugin', 'wporg-plugins' ); ?></h3> 446 449 447 450 <p> … … 488 491 </p> 489 492 490 <h3><?php esc_html_e( 'Plugin Naming', 'wporg-plugins' ); ?></h3>491 <p><?php echo wp_kses_post( __( '<strong>Generic names</strong> that <strong>resemble existing plugins in the directory</strong> (e.g., “AI Writer”, “Image Optimization”) won’t be accepted, even if the slug is available.', 'wporg-plugins' ) ); ?></p>492 <p><?php echo wp_kses_post( __( 'Instead, please <strong>start your plugin name with a unique or coined term</strong>, such as your brand, alias, or organization name (e.g., “Acme AI Writer”, “WriteralAI - AI Writter”, “Acme Image Optimization”, “Imageralia - Image Optimization”).', 'wporg-plugins' ) ); ?></p>493 494 <h3><?php esc_html_e( 'Plugin Ownership', 'wporg-plugins' ); ?></h3>495 <p><?php printf(496 /* translators: 1: User profile URL. */497 wp_kses_post(498 __( 'Names that <strong>begin</strong> with a project, organization, or trademark are <strong>only accepted if submitted by the verified owner</strong>. Ownership can be <strong>confirmed through the email domain in your <a href="%1$s" target="_blank">user profile</a></strong> - update it before submitting.', 'wporg-plugins' )499 ),500 esc_url( 'https://profiles.wordpress.org/profile/edit' )501 ); ?>502 <br>503 <?php echo wp_kses_post( __( '<i>For example, use an official Acme email domain (e.g., “john@acme.example”) for a plugin named “Acme AI Writer”.</i>', 'wporg-plugins' ) ); ?>504 </p>505 <p><?php echo wp_kses_post( __( '<strong>If you don’t own the entity, don’t imply affiliation</strong>. Place their name <strong>at the end</strong> and <strong>make the distinction clear</strong>.', 'wporg-plugins' ) ); ?>506 <br>507 <?php echo wp_kses_post( __( '<i>For example, if you don’t own “Acme” use a structure like: “{your-distinguible-plugin-name} for Acme” (e.g., “WriteralAI – AI Writer for Acme”).</i>', 'wporg-plugins' ) ); ?>508 </p>509 510 <h3><?php esc_html_e( 'Are you ready? Upload the .zip file for your plugin', 'wporg-plugins' ); ?></h3>511 512 <?php513 if ( ! empty( $_REQUEST['upload_token'] ) ) {514 printf(515 '<input type="hidden" name="upload_token" value="%s"/>',516 esc_attr( $_REQUEST['upload_token'] )517 );518 519 if ( ! $uploader->has_valid_upload_token() ) {520 printf(521 '<div class="notice notice-error notice-alt"><p>%s</p></div>',522 esc_html__( 'The token provided is invalid for this user.', 'wporg-plugins')523 );524 }525 }526 ?>527 <?php528 /*529 <fieldset>530 <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend>531 <ul class="category-checklist">532 <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?>533 </ul>534 </fieldset> */535 ?>536 537 <label class="wp-block-button__link zip-file">538 <input type="file" class="plugin-file" name="zip_file" size="25" accept=".zip" required data-maxbytes="<?php echo esc_attr( wp_max_upload_size() ); ?>" />539 <span><?php _e( 'Select File', 'wporg-plugins' ); ?></span>540 </label>541 542 <div>543 <small>544 <?php545 printf(546 /* translators: Maximum allowed file size. */547 esc_html__( 'Maximum allowed file size: %s', 'wporg-plugins' ),548 esc_html( size_format( wp_max_upload_size() ) )549 );550 ?>551 </small>552 </div>553 554 <p>555 <label>556 <?php _e( 'Additional Information', 'wporg-plugins' ); ?><br>557 <textarea name="comment" rows="3" cols="80"><?php558 if ( ! empty( $_REQUEST['comment'] ) ) {559 echo esc_textarea( $_REQUEST['comment'] );560 }561 ?></textarea>562 </label>563 </p>493 <h3><?php esc_html_e( 'Plugin Naming', 'wporg-plugins' ); ?></h3> 494 <p><?php echo wp_kses_post( __( '<strong>Generic names</strong> that <strong>resemble existing plugins in the directory</strong> (e.g., “AI Writer”, “Image Optimization”) won’t be accepted, even if the slug is available.', 'wporg-plugins' ) ); ?></p> 495 <p><?php echo wp_kses_post( __( 'Instead, please <strong>start your plugin name with a unique or coined term</strong>, such as your brand, alias, or organization name (e.g., “Acme AI Writer”, “WriteralAI - AI Writter”, “Acme Image Optimization”, “Imageralia - Image Optimization”).', 'wporg-plugins' ) ); ?></p> 496 497 <h3><?php esc_html_e( 'Plugin Ownership', 'wporg-plugins' ); ?></h3> 498 <p><?php printf( 499 /* translators: 1: User profile URL. */ 500 wp_kses_post( 501 __( 'Names that <strong>begin</strong> with a project, organization, or trademark are <strong>only accepted if submitted by the verified owner</strong>. Ownership can be <strong>confirmed through the email domain in your <a href="%1$s" target="_blank">user profile</a></strong> - update it before submitting.', 'wporg-plugins' ) 502 ), 503 esc_url( 'https://profiles.wordpress.org/profile/edit' ) 504 ); ?> 505 <br> 506 <?php echo wp_kses_post( __( '<i>For example, use an official Acme email domain (e.g., “john@acme.example”) for a plugin named “Acme AI Writer”.</i>', 'wporg-plugins' ) ); ?> 507 </p> 508 <p><?php echo wp_kses_post( __( '<strong>If you don’t own the entity, don’t imply affiliation</strong>. Place their name <strong>at the end</strong> and <strong>make the distinction clear</strong>.', 'wporg-plugins' ) ); ?> 509 <br> 510 <?php echo wp_kses_post( __( '<i>For example, if you don’t own “Acme” use a structure like: “{your-distinguible-plugin-name} for Acme” (e.g., “WriteralAI – AI Writer for Acme”).</i>', 'wporg-plugins' ) ); ?> 511 </p> 512 513 <h3><?php esc_html_e( 'Are you ready? Upload the .zip file for your plugin', 'wporg-plugins' ); ?></h3> 514 515 <?php 516 if ( ! empty( $_REQUEST['upload_token'] ) ) { 517 printf( 518 '<input type="hidden" name="upload_token" value="%s"/>', 519 esc_attr( $_REQUEST['upload_token'] ) 520 ); 521 522 if ( ! $uploader->has_valid_upload_token() ) { 523 printf( 524 '<div class="notice notice-error notice-alt"><p>%s</p></div>', 525 esc_html__( 'The token provided is invalid for this user.', 'wporg-plugins' ) 526 ); 527 } 528 } 529 ?> 530 <?php 531 /* 532 <fieldset> 533 <legend><?php _e( 'Select categories (up to 3)', 'wporg-plugins' ); ?></legend> 534 <ul class="category-checklist"> 535 <?php wp_terms_checklist( 0, array( 'taxonomy' => 'plugin_category' ) ); ?> 536 </ul> 537 </fieldset> */ 538 ?> 539 540 <label class="wp-block-button__link zip-file"> 541 <input type="file" class="plugin-file" name="zip_file" size="25" accept=".zip" required data-maxbytes="<?php echo esc_attr( wp_max_upload_size() ); ?>" /> 542 <span><?php _e( 'Select File', 'wporg-plugins' ); ?></span> 543 </label> 544 545 <div> 546 <small> 547 <?php 548 printf( 549 /* translators: Maximum allowed file size. */ 550 esc_html__( 'Maximum allowed file size: %s', 'wporg-plugins' ), 551 esc_html( size_format( wp_max_upload_size() ) ) 552 ); 553 ?> 554 </small> 555 </div> 556 557 <p> 558 <label> 559 <?php _e( 'Additional Information', 'wporg-plugins' ); ?><br> 560 <textarea name="comment" rows="3" cols="80"><?php 561 if ( ! empty( $_REQUEST['comment'] ) ) { 562 echo esc_textarea( $_REQUEST['comment'] ); 563 } 564 ?></textarea> 565 </label> 566 </p> 564 567 565 568 <input id="upload_button" class="wp-block-button__link" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ); ?>"/>
Note:
See TracChangeset
for help on using the changeset viewer.