Making WordPress.org

Ticket #1890: plug in.diff

File plug in.diff, 1.4 KB (added by obenland, 7 years ago)
  • wp-content/plugins/plugin-directory/class-template.php

     
    221221         * @return mixed
    222222         */
    223223        public static function get_plugin_icon( $post = null, $output = 'raw' ) {
    224                 $plugin    = get_post( $post );
    225                 $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true ) ?: array();
     224                $plugin = get_post( $post );
     225
     226                if ( in_array( $plugin->post_status, ['disabled', 'closed'], true ) ) {
     227                        return false;
     228                }
    226229
     230                $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true ) ?: array();
    227231                $icon = $icon_2x = $svg = $generated = false;
     232
    228233                foreach ( $raw_icons as $file => $info ) {
    229234                        switch ( $info['resolution'] ) {
    230235                                case '256x256':
     
    289294        }
    290295
    291296        /**
    292          * Retrieve the Plugin Icon details for a plugin.
     297         * Retrieve the Plugin banner details for a plugin.
    293298         *
    294299         * @static
    295300         *
     
    300305        public static function get_plugin_banner( $post = null, $output = 'raw' ) {
    301306                $plugin = get_post( $post );
    302307
     308                if ( in_array( $plugin->post_status, ['disabled', 'closed'], true ) ) {
     309                        return false;
     310                }
     311
    303312                $banner      = $banner_2x = false;
    304313                $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true ) ?: array();
    305314