Changeset 6162
- Timestamp:
- 11/23/2017 02:08:54 AM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php
r5556 r6162 4 4 require_once dirname( dirname( __DIR__ ) ) . '/class-tools.php'; 5 5 6 use WordPressdotorg\Plugin_Directory\Template; 6 7 use WordPressdotorg\Plugin_Directory\Tools; 7 8 … … 153 154 $plugin_slug = $plugin->post_name; 154 155 if ( in_array( $plugin->post_status, array( 'new', 'pending' ) ) ) { 155 $extra .= ' (requested ' . human_time_diff( strtotime( $last_updated ) ) . ' ago)';156 $extra .= sprintf( '(requested %s ago)', human_time_diff( strtotime( $last_updated ) ) ); 156 157 $tooltips[] = 'Requested, remains unapproved.'; 157 158 $classes[] = 'profile-plugin-requested'; … … 163 164 164 165 } elseif ( 'closed' === $plugin->post_status ) { 166 $extra .= sprintf( '(closed: %s)', Template::get_close_reason( $plugin ) ); 165 167 $tooltips[] = 'Plugin is closed.'; 166 168 $classes[] = 'profile-plugin-closed'; 167 169 168 170 } elseif ( 'disabled' === $plugin->post_status ) { 171 $extra .= sprintf( '(disabled: %s)', Template::get_close_reason( $plugin ) ); 169 172 $tooltips[] = 'Plugin is disabled (updates are active).'; 170 173 $classes[] = 'profile-plugin-closed'; … … 206 209 207 210 if ( $extra ) { 208 echo $extra;211 echo ' ' . $extra; 209 212 } 210 213 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php
r6043 r6162 2 2 namespace WordPressdotorg\Plugin_Directory\Admin\Metabox; 3 3 use WordPressdotorg\Plugin_Directory\Admin\Status_Transitions; 4 use WordPressdotorg\Plugin_Directory\Template; 4 5 5 6 /** … … 73 74 74 75 /** 75 * Get reasons for closing or disabling a plugin.76 *77 * @return array Close/disable reason labels.78 */79 public static function get_close_reasons() {80 return array(81 'security-issue' => __( 'Security Issue', 'wporg-plugins' ),82 'author-request' => __( 'Author Request', 'wporg-plugins' ),83 'guideline-violation' => __( 'Guideline Violation', 'wporg-plugins' ),84 'licensing-trademark-violation' => __( 'Licensing/Trademark Violation', 'wporg-plugins' ),85 'merged-into-core' => __( 'Merged into Core', 'wporg-plugins' ),86 'unused' => __( 'Unused', 'wporg-plugins' ),87 );88 }89 90 /**91 76 * Displays the Plugin Status control in the Publish metabox. 92 77 */ … … 105 90 } 106 91 107 $close_reasons = self::get_close_reasons();108 $close_reason = (string) get_post_meta( $post->ID, '_close_reason', true );92 $close_reasons = Template::get_close_reasons(); 93 $close_reason = (string) get_post_meta( $post->ID, '_close_reason', true ); 109 94 110 if ( isset( $close_reasons[ $close_reason ] ) ) { 111 $reason_label = $close_reasons[ $close_reason ]; 112 $reason_unknown = false; 113 } else { 114 $reason_label = _x( 'Unknown', 'unknown close reason', 'wporg-plugins' ); 115 $reason_unknown = true; 116 } 95 $reason_label = Template::get_close_reason(); 96 $reason_unknown = ( _x( 'Unknown', 'unknown close reason', 'wporg-plugins' ) === $reason_label ); 117 97 ?> 118 98 <div class="misc-pub-section misc-pub-plugin-status"> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r6139 r6162 663 663 664 664 /** 665 * Returns the reasons for closing or disabling a plugin. 666 * 667 * @return array Close/disable reason labels. 668 */ 669 public static function get_close_reasons() { 670 return array( 671 'security-issue' => __( 'Security Issue', 'wporg-plugins' ), 672 'author-request' => __( 'Author Request', 'wporg-plugins' ), 673 'guideline-violation' => __( 'Guideline Violation', 'wporg-plugins' ), 674 'licensing-trademark-violation' => __( 'Licensing/Trademark Violation', 'wporg-plugins' ), 675 'merged-into-core' => __( 'Merged into Core', 'wporg-plugins' ), 676 'unused' => __( 'Unused', 'wporg-plugins' ), 677 ); 678 } 679 680 /** 681 * Returns the close/disable reason for a plugin. 682 * 683 * @param int|\WP_Post|null $post Optional. Post ID or post object. Defaults to global $post. 684 * @return string Close/disable reason. 685 */ 686 public static function get_close_reason( $post = null ) { 687 $post = get_post( $post ); 688 689 $close_reasons = self::get_close_reasons(); 690 $close_reason = (string) get_post_meta( $post->ID, '_close_reason', true ); 691 692 if ( isset( $close_reasons[ $close_reason ] ) ) { 693 $reason_label = $close_reasons[ $close_reason ]; 694 } else { 695 $reason_label = _x( 'Unknown', 'unknown close reason', 'wporg-plugins' ); 696 } 697 698 return $reason_label; 699 } 700 701 /** 665 702 * Adds hreflang link attributes to WordPress.org pages. 666 703 *
Note: See TracChangeset
for help on using the changeset viewer.