WordPress.org

Make WordPress Core

Ticket #27440: 27440-return-and-display-banners.diff

File 27440-return-and-display-banners.diff, 1.5 KB (added by stephdau, 4 years ago)

This builds on tellyworth's work and conditionally adds banners as background. See screenshot of the same name.

  • wp-admin/includes/plugin-install.php

     
    311311function install_plugin_information() {
    312312        global $tab;
    313313
    314         $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), 'is_ssl' => is_ssl() ) );
     314        $api = plugins_api( 'plugin_information', array( 'slug' => wp_unslash( $_REQUEST['plugin'] ), 'is_ssl' => is_ssl(), 'fields' => array( 'banners' => true ) ) );
    315315
    316316        if ( is_wp_error( $api ) )
    317317                wp_die( $api );
     
    354354
    355355        iframe_header( __('Plugin Install') );
    356356
     357        if ( !empty( $api->banners ) && ( !empty( $api->banners['low'] ) || !empty( $api->banners['high'] ) ) ) {
     358                $low  = ( !empty( $api->banners['low'] ) ) ? $api->banners['low'] :  $api->banners['high'];
     359                $high = ( !empty( $api->banners['high'] ) ) ? $api->banners['high'] :  $api->banners['low'];
     360?>
     361<style type="text/css">
     362        #plugin-information-title {
     363                height:250px;
     364                background-image: url(<?php echo $low ?>);
     365                background-size: 100% auto;
     366        }
     367        #plugin-information-tabs {
     368                top:250px;
     369        }
     370        #plugin-information-content {
     371                top:284px;
     372        }
     373        @media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
     374                #plugin-information-title {
     375                        background-image: url(<?php echo $high ?>});
     376                }
     377        }
     378</style>
     379<?php
     380        }
     381
    357382        echo "<div id='{$_tab}-title'>{$api->name}</div>";
    358383        echo "<div id='{$_tab}-tabs'>\n";
    359384