Make WordPress Core

Ticket #28753: 28753.patch

File 28753.patch, 11.4 KB (added by ocean90, 12 years ago)

Fixes browse link on plugin uploader

  • src/wp-admin/css/forms.css

     
    759759        margin: -3px 3px;
    760760}
    761761
     762/*------------------------------------------------------------------------------
     763  21.0 - Upload File
     764------------------------------------------------------------------------------*/
     765
     766.wp-upload-container {
     767        -webkit-box-sizing: border-box;
     768        -moz-box-sizing: border-box;
     769        box-sizing: border-box;
     770        margin: 0px 0 0;
     771        padding: 0;
     772        width: 100%;
     773        overflow: hidden;
     774        position: relative;
     775        top: 10px;
     776}
     777
     778.wp-upload-container-toggle {
     779        display: none;
     780}
     781
     782.wp-upload-container .wp-upload-form {
     783        background: #fafafa;
     784        border: 1px solid #e5e5e5;
     785        padding: 30px;
     786        margin: 30px auto;
     787        max-width: 380px;
     788}
     789
     790.wp-upload-container .install-help {
     791        color: #999;
     792        font-size: 18px;
     793        font-style: normal;
     794        margin: 0;
     795        padding: 40px 0 0;
     796        text-align: center;
     797}
     798
     799body.show-upload-container .hide-on-upload,
     800body.show-upload-container .wp-upload-show {
     801        display: none;
     802}
     803
     804body.show-upload-container .wp-upload-container-toggle {
     805        display: block;
     806}
     807
     808.wp-upload-hide {
     809        display: none;
     810}
     811
     812body.show-upload-container .wp-upload-hide {
     813        display: inline;
     814}
     815
    762816/* =Media Queries
    763817-------------------------------------------------------------- */
    764818
     819@media only screen and (max-width: 1120px) {
     820        .wp-upload-container .wp-upload-form {
     821                margin: 20px 0;
     822                max-width: 100%;
     823        }
     824
     825        .wp-upload-container .install-help {
     826                font-size: 15px;
     827                padding: 20px 0 0;
     828                text-align: left;
     829        }
     830
     831}
     832
    765833@media screen and ( max-width: 782px ) {
    766834        /* Input Elements */
    767835        textarea {
  • src/wp-admin/css/themes.css

     
    10711071        display: none !important;
    10721072}
    10731073
    1074 .theme-install-php a.upload,
    1075 .theme-install-php a.browse-themes {
    1076         cursor: pointer;
    1077 }
    1078 .theme-install-php a.browse-themes,
    1079 .theme-install-php.show-upload-theme a.upload {
    1080         display: none;
    1081 }
    1082 .theme-install-php.show-upload-theme a.browse-themes {
    1083         display: inline;
    1084 }
    1085 .upload-theme {
    1086         -webkit-box-sizing: border-box;
    1087         -moz-box-sizing: border-box;
    1088         box-sizing: border-box;
    1089         display: none;
    1090         margin: 0;
    1091         padding: 0;
    1092         width: 100%;
    1093         overflow: hidden;
    1094         position: relative;
    1095         top: 10px;
    1096 }
    1097 body.show-upload-theme .upload-theme {
    1098         display: block;
    1099 }
    1100 .upload-theme .wp-upload-form {
    1101         background: #fafafa;
    1102         border: 1px solid #e5e5e5;
    1103         padding: 30px;
    1104         margin: 30px auto;
    1105         max-width: 380px;
    1106 }
    1107 .upload-theme .install-help {
    1108         color: #999;
    1109         font-size: 18px;
    1110         font-style: normal;
    1111         margin: 0;
    1112         padding: 40px 0 0;
    1113         text-align: center;
    1114 }
    1115 body.show-upload-theme .upload-theme + .wp-filter,
    1116 body.show-upload-theme .upload-theme + .wp-filter + .theme-browser {
    1117         display: none;
    1118 }
    1119 
    11201074p.no-themes {
    11211075        color: #999;
    11221076        font-size: 18px;
     
    11291083body.no-results p.no-themes {
    11301084        display: block;
    11311085}
    1132 body.show-upload-theme p.no-themes {
     1086body.show-upload-container p.no-themes {
    11331087        display: none !important;
    11341088}
    11351089
     
    11371091        display: none !important;
    11381092}
    11391093
    1140 @media only screen and (max-width: 1120px) {
    1141         .upload-theme .wp-upload-form {
    1142                 margin: 20px 0;
    1143                 max-width: 100%;
    1144         }
    1145         .upload-theme .install-help {
    1146                 font-size: 15px;
    1147                 padding: 20px 0 0;
    1148                 text-align: left;
    1149         }
    1150 }
    1151 
    11521094.rating {
    11531095        margin: 30px 0;
    11541096}
  • src/wp-admin/includes/class-wp-plugin-install-list-table.php

     
    215215                $views = apply_filters( "views_{$this->screen->id}", $views );
    216216
    217217?>
    218 <div class="wp-filter">
     218<div class="wp-filter hide-on-upload">
    219219        <ul class="wp-filter-links">
    220220                <?php
    221221                if ( ! empty( $views ) ) {
  • src/wp-admin/includes/plugin-install.php

     
    196196 */
    197197function install_plugins_upload( $page = 1 ) {
    198198?>
    199         <h4><?php _e('Install a plugin in .zip format'); ?></h4>
    200         <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p>
    201         <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>">
    202                 <?php wp_nonce_field( 'plugin-upload'); ?>
    203                 <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
    204                 <input type="file" id="pluginzip" name="pluginzip" />
    205                 <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
    206         </form>
     199        <div class="wp-upload-container">
     200                <p class="install-help"><?php _e( 'If you have a plugin in a .zip format, you may install it by uploading it here.' ); ?></p>
     201                <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url( 'update.php?action=upload-plugin' ); ?>">
     202                        <?php wp_nonce_field( 'plugin-upload' ); ?>
     203                        <label class="screen-reader-text" for="pluginzip"><?php _e( 'Plugin zip file' ); ?></label>
     204                        <input type="file" id="pluginzip" name="pluginzip" />
     205                        <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
     206                </form>
     207        </div>
    207208<?php
    208209}
    209210add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
  • src/wp-admin/includes/theme-install.php

     
    136136
    137137function install_themes_upload() {
    138138?>
    139 <p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
    140 <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
    141         <?php wp_nonce_field( 'theme-upload'); ?>
    142         <input type="file" name="themezip" />
    143         <?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
    144 </form>
    145         <?php
     139        <div class="wp-upload-container wp-upload-container-toggle">
     140                <p class="install-help"><?php _e( 'If you have a theme in a .zip format, you may install it by uploading it here.' ); ?></p>
     141                <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url( 'update.php?action=upload-theme' ); ?>">
     142                        <?php wp_nonce_field( 'theme-upload' ); ?>
     143                        <input type="file" name="themezip" />
     144                        <?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
     145                </form>
     146        </div>
     147<?php
    146148}
    147149// add_action('install_themes_upload', 'install_themes_upload', 10, 0);
    148150
  • src/wp-admin/js/theme.js

     
    14971497        searchContainer: $( '.wp-filter' ),
    14981498
    14991499        uploader: function() {
    1500                 $( 'a.upload' ).on( 'click', function( event ) {
     1500                $( '.wp-upload-show' ).on( 'click', function( event ) {
    15011501                        event.preventDefault();
    1502                         $( 'body' ).addClass( 'show-upload-theme' );
     1502                        $( 'body' ).addClass( 'show-upload-container' );
    15031503                        themes.router.navigate( themes.router.baseUrl( '?upload' ), { replace: true } );
    15041504                });
    1505                 $( 'a.browse-themes' ).on( 'click', function( event ) {
     1505                $( '.wp-upload-hide' ).on( 'click', function( event ) {
    15061506                        event.preventDefault();
    1507                         $( 'body' ).removeClass( 'show-upload-theme' );
     1507                        $( 'body' ).removeClass( 'show-upload-container' );
    15081508                        themes.router.navigate( themes.router.baseUrl( '' ), { replace: true } );
    15091509                });
    15101510        },
     
    16421642
    16431643                // Support the `upload` route by going straight to upload section
    16441644                themes.router.on( 'route:upload', function() {
    1645                         $( 'a.upload' ).trigger( 'click' );
     1645                        $( '.wp-upload-show' ).trigger( 'click' );
    16461646                });
    16471647
    16481648                // The `search` route event. The router populates the input field.
  • src/wp-admin/plugin-install.php

     
    6767        '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    6868);
    6969
     70function _wp_add_upload_container_class( $classes ) {
     71        global $tab;
     72
     73        $class = ( 'upload' === $tab ) ? ' show-upload-container' : ' hide-upload-container';
     74
     75        return $classes . $class;
     76}
     77
     78add_filter( 'admin_body_class', '_wp_add_upload_container_class' );
     79
    7080/**
    7181 * WordPress Administration Template Header.
    7282 */
     
    7585<div class="wrap">
    7686<h2>
    7787        <?php
    78                 echo esc_html( $title );
    79                 $href = self_admin_url( 'plugin-install.php?tab=upload' );
     88        echo esc_html( $title );
     89
     90        if ( 'upload' === $tab ) {
     91                ?>
     92                <a href="<?php echo esc_url( self_admin_url( 'plugin-install.php' ) ); ?>" class="browse-plugins add-new-h2"><?php _ex( 'Browse', 'plugins' ); ?></a>
     93                <?php
     94        } else {
     95                ?>
     96                <a href="<?php echo esc_url( self_admin_url( 'plugin-install.php?tab=upload' ) ); ?>" class="upload add-new-h2"><?php _e( 'Upload Plugin' ); ?></a>
     97                <?php
     98        }
    8099        ?>
    81         <a href="<?php echo $href; ?>" class="upload add-new-h2"><?php _e( 'Upload Plugin' ); ?></a>
    82100</h2>
    83101
    84102<?php $wp_list_table->views(); ?>
    85103
    86 <br class="clear" />
    87104<?php
    88105/**
    89106 * Fires after the plugins list table in each tab of the Install Plugins screen.
  • src/wp-admin/theme-install.php

     
    118118                <?php
    119119                /**
    120120                 * Filter the tabs shown on the Install Themes screen.
    121                  * 
     121                 *
    122122                 * @since 2.8.0
    123123                 * @param array $tabs The tabs shown on the Install Themes screen. Defaults are
    124124                 *                    'upload' and 'browse-themes'.
    125125                 */
    126126                $tabs = apply_filters( 'install_themes_tabs', $tabs );
    127127                foreach ( $tabs as $tab_slug => $tab_name ) {
    128                         echo '<a href="#" class="' . esc_attr( $tab_slug ) . ' add-new-h2">' . $tab_name . '</a>';
     128                        $visibility = '';
     129                        if ( 'upload' === $tab_slug ) {
     130                                $visibility = ' wp-upload-show';
     131                        } else if ( 'browse-themes' === $tab_slug ) {
     132                                $visibility = ' wp-upload-hide';
     133                        }
     134
     135                        echo '<a href="#" class="' . esc_attr( $tab_slug ) . $visibility . ' add-new-h2">' . $tab_name . '</a>';
    129136                }
    130137                ?>
    131138        </h2>
    132139
    133         <div class="upload-theme">
    134140        <?php install_themes_upload(); ?>
    135         </div>
    136141
    137         <div class="wp-filter">
     142        <div class="wp-filter hide-on-upload">
    138143                <div class="wp-filter-count">
    139144                        <span class="count theme-count"></span>
    140145                </div>
     
    179184                        </div>
    180185                </div>
    181186        </div>
    182         <div class="theme-browser wp-filter-content"></div>
    183         <div class="theme-install-overlay wp-full-overlay expanded"></div>
    184187
    185         <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
    186         <span class="spinner"></span>
     188        <div class="hide-on-upload">
     189                <div class="theme-browser wp-filter-content"></div>
     190                <div class="theme-install-overlay wp-full-overlay expanded"></div>
    187191
     192                <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
     193                <span class="spinner"></span>
     194        </div>
     195
    188196        <br class="clear" />
    189197<?php
    190198/**