IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
28 | 28 | |
29 | 29 | add_action( 'approved_plugin', array( $this, 'approved' ), 10, 2 ); |
30 | 30 | add_action( 'rejected_plugin', array( $this, 'rejected' ), 10, 2 ); |
| 31 | add_action( 'closed_plugin', array( $this, 'closed' ), 10, 2 ); |
31 | 32 | } |
32 | 33 | |
33 | 34 | /** |
… |
… |
|
246 | 247 | wp_mail( $email, $subject, $content, 'From: plugins@wordpress.org' ); |
247 | 248 | } |
248 | 249 | |
| 250 | /** |
| 251 | * Fires when a post is transitioned to 'closed'. |
| 252 | * |
| 253 | * @param int $post_id Post ID. |
| 254 | * @param \WP_Post $post Post object. |
| 255 | */ |
| 256 | public function closed( $post_id, $post ) { |
| 257 | |
| 258 | if ( ! current_user_can( 'plugin_approve', $post ) ) { |
| 259 | return; |
| 260 | } |
| 261 | |
| 262 | if ( ! isset( $_POST['close_reason'] ) ) { |
| 263 | return; |
| 264 | } |
| 265 | |
| 266 | update_post_meta( $post->ID, '_close_reason', sanitize_key( $_POST['close_reason'] ) ); |
| 267 | } |
| 268 | |
249 | 269 | /** |
250 | 270 | * Returns the path to a plugins root directory. |
251 | 271 | * |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
64 | 64 | return $label; |
65 | 65 | } |
66 | 66 | |
| 67 | /** |
| 68 | * Get labels for reasons for closing a plugin. |
| 69 | * |
| 70 | * @return array Close reason labels. |
| 71 | */ |
| 72 | public static function get_close_reasons() { |
| 73 | return array( |
| 74 | 'security' => __( 'Security Issue', 'wporg-plugins' ), |
| 75 | 'author-request' => __( 'Author Request', 'wporg-plugins' ), |
| 76 | 'guideline-violation' => __( 'Guideline Violation', 'wporg-plugins' ), |
| 77 | 'licensing-trademark-violation' => __( 'Licensing/Trademark Violation', 'wporg-plugins' ), |
| 78 | 'merged-into-core' => __( 'Merged into Core', 'wporg-plugins' ), |
| 79 | ); |
| 80 | } |
| 81 | |
67 | 82 | /** |
68 | 83 | * Displays the Plugin Status control in the Publish metabox. |
69 | 84 | */ |
… |
… |
|
80 | 95 | if ( current_user_can( 'plugin_approve', $post ) ) { |
81 | 96 | $statuses = Status_Transitions::get_allowed_transitions( $post->post_status ); |
82 | 97 | } |
| 98 | |
| 99 | $close_reasons = self::get_close_reasons(); |
83 | 100 | ?> |
84 | 101 | <div class="misc-pub-section misc-pub-plugin-status"> |
85 | 102 | <label for="post_status"><?php _e( 'Status:', 'wporg-plugins' ); ?></label> |
… |
… |
|
89 | 106 | <p><button type="submit" name="post_status" value="<?php echo esc_attr( $status ); ?>" class="button set-plugin-status"> |
90 | 107 | <?php echo self::get_status_button_label( $status ); ?> |
91 | 108 | </button></p> |
| 109 | <?php if ( 'closed' === $status ) : ?> |
| 110 | <label for="close_reason"><?php esc_html_e( 'Close Reason:', 'wporg-plugins' ); ?></label> |
| 111 | <select name="close_reason" id="close_reason"> |
| 112 | <?php foreach ( $close_reasons as $reason => $label ) : ?> |
| 113 | <option value="<?php echo esc_attr( $reason ); ?>"><?php echo esc_html( $label ); ?></option> |
| 114 | <?php endforeach; ?> |
| 115 | </select> |
| 116 | <?php endif; ?> |
92 | 117 | <?php endforeach; ?> |
| 118 | <?php if ( ! in_array( 'closed', $statuses, true ) ) : ?> |
| 119 | <?php |
| 120 | $close_reason = (string) get_post_meta( $post->ID, '_close_reason', true ); |
| 121 | |
| 122 | if ( isset( $close_reasons[ $close_reason ] ) ) { |
| 123 | $close_reason = $close_reasons[ $close_reason ]; |
| 124 | } |
| 125 | |
| 126 | echo esc_html__( 'Close Reason:', 'wporg-plugins' ) . ' ' . esc_html( $close_reason ); |
| 127 | ?> |
| 128 | <?php endif; ?> |
93 | 129 | </div><!-- .misc-pub-section --><?php |
94 | 130 | } |
95 | 131 | |