WordPress.org

Making WordPress.org


Ignore:
Timestamp:
11/23/17 02:08:54 (3 weeks ago)
Author:
SergeyBiryukov
Message:

Plugin Directory, Author Card: Display close reason for closed or disabled plugins.

Fixes #3278.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php

    r6043 r6162  
    22namespace WordPressdotorg\Plugin_Directory\Admin\Metabox; 
    33use WordPressdotorg\Plugin_Directory\Admin\Status_Transitions; 
     4use WordPressdotorg\Plugin_Directory\Template; 
    45 
    56/** 
     
    7374 
    7475    /** 
    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     /** 
    9176     * Displays the Plugin Status control in the Publish metabox. 
    9277     */ 
     
    10590        } 
    10691 
    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 ); 
    10994 
    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 ); 
    11797        ?> 
    11898        <div class="misc-pub-section misc-pub-plugin-status"> 
Note: See TracChangeset for help on using the changeset viewer.