WordPress.org

Make WordPress Core

Ticket #37495: 37495.2.diff

File 37495.2.diff, 5.1 KB (added by ocean90, 4 years ago)
  • src/wp-admin/css/themes.css

     
    10261026}
    10271027
    10281028.upload-view-toggle .browse,
    1029 .upload-view-toggle.upload-tab .upload {
     1029.plugin-install-tab-upload .upload-view-toggle .upload {
    10301030        display: none;
    10311031}
    10321032
    1033 .upload-view-toggle.upload-tab .browse {
     1033.plugin-install-tab-upload .upload-view-toggle .browse {
    10341034        display: inline;
    10351035}
    10361036
     
    10481048        top: 10px;
    10491049}
    10501050
     1051.upload-plugin-wrap {
     1052        display: none;
     1053}
     1054
    10511055.show-upload-view .upload-theme,
    10521056.show-upload-view .upload-plugin,
    1053 .upload-tab .upload-plugin {
     1057.show-upload-view .upload-plugin-wrap,
     1058.plugin-install-tab-upload .upload-plugin {
    10541059        display: block;
    10551060}
    10561061
  • src/wp-admin/includes/admin-filters.php

     
    7070
    7171// Plugin Install hooks.
    7272add_action( 'install_plugins_featured',               'install_dashboard' );
     73add_action( 'install_plugins_upload',                 'install_plugins_upload' );
    7374add_action( 'install_plugins_search',                 'display_plugins_table' );
    7475add_action( 'install_plugins_popular',                'display_plugins_table' );
    7576add_action( 'install_plugins_recommended',            'display_plugins_table' );
  • src/wp-admin/js/plugin-install.js

     
    1212                $tabbables,
    1313                $firstTabbable,
    1414                $lastTabbable,
    15                 uploadViewToggle = $( '.upload-view-toggle' ),
     15                $uploadViewToggle = $( '.upload-view-toggle' ),
     16                $wrap = $ ( '.wrap' ),
    1617                $body = $( document.body );
    1718
    1819        tb_position = function() {
     
    183184         * When a user presses the "Upload Plugin" button, show the upload form in place
    184185         * rather than sending them to the devoted upload plugin page.
    185186         * The `?tab=upload` page still exists for no-js support and for plugins that
    186          * might access it directly (?). When we're in this page, let the link behave
     187         * might access it directly. When we're in this page, let the link behave
    187188         * like a link. Otherwise we're in the normal plugin installer pages and the
    188189         * link should behave like a toggle button.
    189190         */
    190         if ( ! uploadViewToggle.hasClass( 'upload-tab' ) ) {
    191                 uploadViewToggle
     191        if ( ! $wrap.hasClass( 'plugin-install-tab-upload' ) ) {
     192                $uploadViewToggle
    192193                        .attr({
    193194                                role: 'button',
    194195                                'aria-expanded': 'false'
     
    196197                        .on( 'click', function( event ) {
    197198                                event.preventDefault();
    198199                                $body.toggleClass( 'show-upload-view' );
    199                                 uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
     200                                $uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) );
    200201                        });
    201202        }
    202203});
  • src/wp-admin/plugin-install.php

     
    6666 */
    6767do_action( "install_plugins_pre_$tab" );
    6868
     69if ( 'upload' !== $tab ) {
     70        /** This action is documented in wp-admin/plugin-install.php */
     71        do_action( 'install_plugins_pre_upload' );
     72}
     73
    6974get_current_screen()->add_help_tab( array(
    7075'id'            => 'overview',
    7176'title'         => __('Overview'),
     
    101106 */
    102107include(ABSPATH . 'wp-admin/admin-header.php');
    103108?>
    104 <div class="wrap">
     109<div class="wrap <?php echo esc_attr( "plugin-install-tab-$tab" ); ?>">
    105110<h1>
    106111        <?php
    107112        echo esc_html( $title );
    108113        if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_plugins' ) ) {
    109                 if ( $tab === 'upload' ) {
    110                         $href = self_admin_url( 'plugin-install.php' );
    111                         $upload_tab_class = ' upload-tab';
    112                 } else {
    113                         $href = self_admin_url( 'plugin-install.php?tab=upload' );
    114                         $upload_tab_class = '';
    115                 }
    116 
    117                 printf( ' <a href="%s" class="upload-view-toggle page-title-action%s"><span class="upload">%s</span><span class="browse">%s</span></a>',
    118                         $href,
    119                         $upload_tab_class,
     114                printf( ' <a href="%s" class="upload-view-toggle page-title-action"><span class="upload">%s</span><span class="browse">%s</span></a>',
     115                        ( 'upload' === $tab ) ? self_admin_url( 'plugin-install.php' ) : self_admin_url( 'plugin-install.php?tab=upload' ),
    120116                        __( 'Upload Plugin' ),
    121117                        __( 'Browse Plugins' )
    122118                );
     
    124120        ?>
    125121</h1>
    126122
    127 <div class="upload-plugin-wrap<?php echo $upload_tab_class; ?>">
    128123<?php
    129124/*
    130125 * Output the upload plugin form on every plugin install screen, so it can be
    131126 * displayed via JavaScript rather then opening up the devoted upload plugin page.
    132127 */
    133 install_plugins_upload(); ?>
    134 </div>
     128if ( $tab !== 'upload' ) {
     129        ?>
     130        <div class="upload-plugin-wrap">
     131                <?php
     132                /** This action is documented in wp-admin/plugin-install.php */
     133                do_action( 'install_plugins_upload' );
     134                ?>
     135        </div>
     136        <?php
     137}
    135138
    136 <?php
    137139if ( $tab !== 'upload' ) {
    138140        $wp_list_table->views();
    139141        echo '<br class="clear" />';