Changeset 13033
- Timestamp:
- 12/08/2023 03:47:14 AM (15 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r13024 r13033 475 475 } 476 476 477 if ( 'disabled' == $post->post_status && 'disabled' != $post_status) {477 if ( 'disabled' == $post->post_status ) { 478 478 $post_states['disabled'] = _x( 'Disabled', 'plugin status', 'wporg-plugins' ); 479 479 // Affix the reason it's disabled. … … 483 483 } 484 484 } 485 if ( 'closed' == $post->post_status && 'closed' != $post_status ) { 485 486 if ( 'closed' == $post->post_status ) { 486 487 $post_states['closed'] = _x( 'Closed', 'plugin status', 'wporg-plugins' ); 487 488 // Affix the reason it's closed. … … 491 492 } 492 493 } 493 if ( 'rejected' == $post->post_status && 'rejected' != $post_status ) { 494 495 if ( 'rejected' == $post->post_status ) { 494 496 $post_states['rejected'] = _x( 'Rejected', 'plugin status', 'wporg-plugins' ); 497 498 if ( $post->_rejection_reason ) { 499 $post_states['reason'] = Template::get_rejection_reasons()[ $post->_rejection_reason ] ?? ''; 500 } 501 495 502 } 496 503 if ( 'approved' == $post->post_status && 'approved' != $post_status ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
r12991 r13033 142 142 143 143 case 'rejected': 144 $this->save_rejected_reason( $post->ID ); 144 145 $this->rejected( $post->ID, $post ); 145 146 $this->clear_reviewer( $post ); … … 271 272 'slug' => $original_permalink, 272 273 'submission_date' => $submission_date, 274 'reason' => sanitize_key( $_POST['rejection_reason'] ?? '' ) 273 275 ] 274 276 ); 275 // ..and log rejection. 276 if ( $email->send() ) { 277 Tools::audit_log( 'Plugin rejected.', $post_id ); 278 } else { 279 Tools::audit_log( 'Plugin rejected. Email not sent.', $post_id ); 280 } 277 278 $email->send(); 281 279 } 282 280 … … 331 329 } 332 330 333 if ( ! current_user_can( 'plugin_ approve', $post_id ) ) {331 if ( ! current_user_can( 'plugin_close', $post_id ) ) { 334 332 return; 335 333 } … … 341 339 342 340 Tools::audit_log( sprintf( 'Plugin closed. Reason: %s', $close_reason ), $post_id ); 341 } 342 343 /** 344 * Save the reason for rejecting a plugin. 345 * 346 * @param int $post_id Post ID. 347 */ 348 public function save_rejected_reason( $post_id ) { 349 if ( ! isset( $_REQUEST['rejection_reason'] ) ) { 350 return; 351 } 352 353 if ( ! current_user_can( 'plugin_reject', $post_id ) ) { 354 return; 355 } 356 357 $rejection_reason = sanitize_key( $_REQUEST['rejection_reason'] ); 358 359 update_post_meta( $post_id, '_rejection_reason', $rejection_reason ); 360 update_post_meta( $post_id, 'plugin_rejected_date', current_time( 'mysql' ) ); 361 362 Tools::audit_log( sprintf( 'Plugin rejected. Reason: %s', $rejection_reason ), $post_id ); 343 363 } 344 364 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r13024 r13033 606 606 </select> 607 607 </fieldset> 608 609 <fieldset class="alignleft actions hide-if-js bulk-plugin_reject" disabled="disabled"> 610 <select name="rejection_reason" id="rejection_reason"> 611 <option disabled="disabled" value='' selected="selected"><?php esc_html_e( 'Rejection Reason:', 'wporg-plugins' ); ?></option> 612 <?php foreach ( Template::get_rejection_reasons() as $key => $label ) : ?> 613 <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></option> 614 <?php endforeach; ?> 615 </select> 616 </fieldset> 617 608 618 <?php 609 619 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php
r12610 r13033 86 86 } 87 87 88 $close_reasons = Template::get_close_reasons(); 89 $close_reason = (string) get_post_meta( $post->ID, '_close_reason', true ); 90 $active_installs = (int) get_post_meta( $post->ID, 'active_installs', true ); 91 92 $reason_label = Template::get_close_reason(); 93 $reason_unknown = ( _x( 'Unknown', 'unknown close reason', 'wporg-plugins' ) === $reason_label ); 88 $close_reasons = Template::get_close_reasons(); 89 $close_reason = (string) get_post_meta( $post->ID, '_close_reason', true ); 90 $rejection_reasons = Template::get_rejection_reasons(); 91 $rejection_reason = (string) get_post_meta( $post->ID, '_rejection_reason', true ); 92 $active_installs = (int) get_post_meta( $post->ID, 'active_installs', true ); 93 94 $close_reason_label = Template::get_close_reason(); 95 $close_reason_unknown = ( _x( 'Unknown', 'unknown close reason', 'wporg-plugins' ) === $reason_label ); 96 $rejection_reason_label = $rejection_reasons[ $rejection_reason ] ?? $rejection_reasons[ 'other' ]; 94 97 ?> 95 98 <div class="misc-pub-section misc-pub-plugin-status"> … … 97 100 <?php if ( 'closed' === $post->post_status ) : ?> 98 101 99 <p><?php printf( __( 'Close Reason: %s', 'wporg-plugins' ), '<strong>' . $ reason_label . '</strong>' ); ?></p>102 <p><?php printf( __( 'Close Reason: %s', 'wporg-plugins' ), '<strong>' . $close_reason_label . '</strong>' ); ?></p> 100 103 101 104 <?php elseif ( 'disabled' === $post->post_status ) : ?> 102 105 103 <p><?php printf( __( 'Disable Reason: %s', 'wporg-plugins' ), '<strong>' . $reason_label . '</strong>' ); ?></p> 106 <p><?php printf( __( 'Disable Reason: %s', 'wporg-plugins' ), '<strong>' . $close_reason_label . '</strong>' ); ?></p> 107 108 <?php elseif ( 'rejected' === $post->post_status ) : ?> 109 110 <p><?php printf( 111 __( 'Rejection Reason: %s', 'wporg-plugins' ), 112 '<strong>' . $rejection_reason_label . '</strong>' 113 ); ?></p> 104 114 105 115 <?php elseif ( 'publish' === $post->post_status ) : ?> … … 108 118 <p><strong><?php _e( 'Notice:', 'wporg-plugins' ); ?></strong> <?php _e( 'Due to the large volume of active users, the developers should be warned and their plugin remain open save under extreme circumstances.', 'wporg-plugins' ); ?>.</p> 109 119 <?php endif; ?> 110 111 <?php endif; ?>112 113 <?php114 if (115 ( in_array( 'closed', $statuses, true ) || in_array( 'disabled', $statuses, true ) )116 &&117 ( ! in_array( $post->post_status, array( 'closed', 'disabled' ) ) || $reason_unknown )118 ) :119 ?>120 121 <p>122 <label for="close_reason"><?php _e( 'Close/Disable Reason:', 'wporg-plugins' ); ?></label>123 <select name="close_reason" id="close_reason">124 <?php foreach ( $close_reasons as $key => $label ) : ?>125 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $close_reason ); ?>><?php echo esc_html( $label ); ?></option>126 <?php endforeach; ?>127 </select>128 </p>129 120 130 121 <?php endif; ?> … … 142 133 } 143 134 135 if ( 'closed' === $status || 'disabled' === $status ) { ?> 136 <p> 137 <label for="close_reason"><?php _e( 'Close/Disable Reason:', 'wporg-plugins' ); ?></label> 138 <select name="close_reason" id="close_reason"> 139 <?php foreach ( $close_reasons as $key => $label ) : ?> 140 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $close_reason ); ?>><?php echo esc_html( $label ); ?></option> 141 <?php endforeach; ?> 142 </select> 143 </p> 144 <?php } 145 146 if ( 'rejected' === $status ) { ?> 147 <p> 148 <label for="rejection_reason"><?php _e( 'Rejection Reason:', 'wporg-plugins' ); ?></label> 149 <select name="rejection_reason" id="rejection_reason"> 150 <?php foreach ( $rejection_reasons as $key => $label ) : ?> 151 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $rejection_reason ); ?>><?php echo esc_html( $label ); ?></option> 152 <?php endforeach; ?> 153 </select> 154 </p> 155 <?php } 156 144 157 printf( 145 158 '<button type="submit" name="post_status" value="%s" class="button set-plugin-status">%s</button>', -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-stats-report.php
r13009 r13033 277 277 AND `comment_agent` = '' 278 278 AND ( 279 `comment_content` IN( 'Plugin Approved.', ' Plugin Rejected.', 'Unassigned.' )279 `comment_content` IN( 'Plugin Approved.', 'Unassigned.' ) 280 280 OR `comment_content` LIKE 'Assigned TO%' 281 OR `comment_content` LIKE 'Plugin rejected.%' 281 282 OR ( 282 283 `comment_content` LIKE 'Plugin closed.%' … … 653 654 echo '</td>'; 654 655 655 // Plugins Approved , Rejected.656 // Plugins Approved. 656 657 echo '<td>', number_format_i18n( $user_stat[ 'Plugin approved.' ] ?? 0 ), '</td>'; 657 echo '<td>', number_format_i18n( $user_stat[ 'Plugin rejected.' ] ?? 0 ), '</td>'; 658 659 // Plugins Rejected. 660 $user_rejected_breakdown = ''; 661 $user_rejected_count = 0; 662 foreach ( $user_stat as $key => $count ) { 663 if ( ! preg_match( '/^Plugin rejected\./', $key ) ) { 664 continue; 665 } 666 $user_rejected_count += $count; 667 $reason = trim( explode( ':', $key )[1] ?? '' ); 668 669 if ( ! $reason ) { 670 continue; 671 } 672 673 $user_rejected_breakdown .= sprintf( 674 "%s: %s\n", 675 Template::get_rejection_reasons()[ $reason ], 676 number_format_i18n( $count ) 677 ); 678 } 679 $user_rejected_breakdown = trim( $user_rejected_breakdown ); 680 681 echo '<td class="breakdown">', '<span title="', esc_attr( $user_rejected_breakdown ), '">', number_format_i18n( $user_rejected_count ), '</span>'; 682 if ( $user_rejected_breakdown ) { 683 echo '<div class="hidden">', nl2br( $user_rejected_breakdown ), '</div>'; 684 } 685 echo '</td>'; 658 686 659 687 // Plugins Closed. … … 693 721 $(this).children().length > 1 && $(this).children().toggleClass("hidden"); 694 722 } ); 695 } );</script>' 723 } );</script>'; 696 724 697 725 ?> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r12999 r13033 908 908 'merged-into-core' => __( 'Merged into Core', 'wporg-plugins' ), 909 909 'unused' => __( 'Unused', 'wporg-plugins' ), 910 ); 911 } 912 913 /** 914 * Returns the reasons for rejecting a plugin. 915 * 916 * @return array Rejection reason labels. 917 */ 918 public static function get_rejection_reasons() { 919 return array( 920 '3-month' => '3 months without completion', 921 'core-supports' => 'Code is already in core', 922 'duplicate-copy' => 'Duplicate (copy) of another Plugin', 923 'library-or-framework' => 'Framework or Library Plugin', 924 'generic' => "Something we're just not hosting", 925 'duplicate' => 'New/renamed version of their own plugin', 926 'wp-cli' => 'WP-CLI Only Plugins', 927 'storefront' => 'Storefront', 928 'not-owner' => 'Not the submitters plugin', 929 'script-insertion' => 'Script Insertion Plugins are Dangerous', 930 'demo' => 'Test/Demo plugin (non functional)', 931 'translation' => 'Translation of existing plugin', 932 'banned' => 'Banned developer trying to sneak back in', 933 'author-request' => 'Author requested not to continue', 934 'other' => 'OTHER: See notes', 910 935 ); 911 936 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/email/class-plugin-rejected.php
r11438 r13033 19 19 20 20 function body() { 21 // NOTE: $this->args['reason'] has rejection reason if applicable. 22 21 23 /* translators: 1: plugin name, 2: plugin permalink, 3: date of submission, 4: plugins@wordpress.org */ 22 24 $email_text = __(
Note: See TracChangeset
for help on using the changeset viewer.