Ticket #2860: 2860.3.diff
File 2860.3.diff, 4.5 KB (added by , 7 years ago) |
---|
-
wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
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 ); 32 add_action( 'disabled_plugin', array( $this, 'closed' ), 10, 2 ); 31 33 } 32 34 33 35 /** … … 246 248 wp_mail( $email, $subject, $content, 'From: plugins@wordpress.org' ); 247 249 } 248 250 251 /** 252 * Fires when a post is transitioned to 'closed'. 253 * 254 * @param int $post_id Post ID. 255 * @param \WP_Post $post Post object. 256 */ 257 public function closed( $post_id, $post ) { 258 259 if ( ! current_user_can( 'plugin_approve', $post ) ) { 260 return; 261 } 262 263 if ( ! isset( $_POST['close_reason'] ) ) { 264 return; 265 } 266 267 update_post_meta( $post->ID, '_close_reason', sanitize_key( $_POST['close_reason'] ) ); 268 } 269 249 270 /** 250 271 * Returns the path to a plugins root directory. 251 272 * -
wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php
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> 86 103 <strong id="plugin-status-display"><?php echo esc_html( get_post_status_object( $post->post_status )->label ); ?></strong> 87 104 105 <?php if ( 'closed' === $post->post_status || 'disabled' === $post->post_status ) : ?> 106 <?php 107 $close_reason = (string) get_post_meta( $post->ID, '_close_reason', true ); 108 109 if ( isset( $close_reasons[ $close_reason ] ) ) { 110 $close_reason = $close_reasons[ $close_reason ]; 111 } elseif ( empty( $close_reason ) ) { 112 $close_reason = _x( 'Unknown', 'unknown close reason', 'wporg-plugins' ); 113 } 114 115 if ( 'closed' === $post->post_status ) { 116 $label = __( 'Close Reason:', 'wporg-plugins' ); 117 } else { 118 $label = __( 'Disable Reason:', 'wporg-plugins' ); 119 } 120 ?> 121 <p><?php echo esc_html( $label ) . ' ' . esc_html( $close_reason ); ?></p> 122 <?php elseif ( in_array( 'closed', $statuses, true ) || in_array( 'disabled', $statuses, true ) ) : ?> 123 <p> 124 <label for="close_reason"><?php esc_html_e( 'Close/Disable Reason:', 'wporg-plugins' ); ?></label> 125 <select name="close_reason" id="close_reason"> 126 <?php foreach ( $close_reasons as $reason => $label ) : ?> 127 <option value="<?php echo esc_attr( $reason ); ?>"><?php echo esc_html( $label ); ?></option> 128 <?php endforeach; ?> 129 </select> 130 </p> 131 <?php endif; ?> 132 88 133 <?php foreach ( $statuses as $status ) : ?> 89 134 <p><button type="submit" name="post_status" value="<?php echo esc_attr( $status ); ?>" class="button set-plugin-status"> 90 135 <?php echo self::get_status_button_label( $status ); ?>