Make WordPress Core

Ticket #28753: 28753.2.diff

File 28753.2.diff, 14.7 KB (added by paulwilde, 12 years ago)
  • trunk/src/wp-admin/css/forms.css

     
    751751        margin: -3px 3px;
    752752}
    753753
     754/*------------------------------------------------------------------------------
     755  21.0 - Upload File
     756------------------------------------------------------------------------------*/
     757
     758.wp-upload-container {
     759        -webkit-box-sizing: border-box;
     760        -moz-box-sizing: border-box;
     761        box-sizing: border-box;
     762        margin: 0px 0 0;
     763        padding: 0;
     764        width: 100%;
     765        overflow: hidden;
     766        position: relative;
     767        top: 10px;
     768}
     769.wp-upload-container-hidden {
     770        display: none;
     771}
     772.wp-upload-container .wp-upload-form {
     773        background: #fafafa;
     774        border: 1px solid #e5e5e5;
     775        padding: 30px;
     776        margin: 30px auto;
     777        max-width: 380px;
     778}
     779.wp-upload-container .install-help {
     780        color: #999;
     781        font-size: 18px;
     782        font-style: normal;
     783        margin: 0;
     784        padding: 40px 0 0;
     785        text-align: center;
     786}
     787
     788body.show-upload-container .hide-on-upload,
     789body.show-upload-container .wp-upload-show {
     790        display: none;
     791}
     792body.show-upload-container .wp-upload-container-hidden {
     793        display: block;
     794}
     795
     796.wp-upload-hide {
     797        display: none;
     798}
     799body.show-upload-container .wp-upload-hide {
     800        display: inline;
     801}
     802
    754803/* =Media Queries
    755804-------------------------------------------------------------- */
    756805
     806@media only screen and (max-width: 1120px) {
     807        .wp-upload-container .wp-upload-form {
     808                margin: 20px 0;
     809                max-width: 100%;
     810        }
     811        .wp-upload-container .install-help {
     812                font-size: 15px;
     813                padding: 20px 0 0;
     814                text-align: left;
     815        }
     816}
     817
    757818@media screen and ( max-width: 782px ) {
    758819        /* Input Elements */
    759820        textarea {
  • trunk/src/wp-admin/css/themes.css

     
    11031103        position: relative;
    11041104        width: 100%;
    11051105}
    1106 .theme-install-php a.upload,
    1107 .theme-install-php a.browse-themes {
    1108         cursor: pointer;
    1109 }
    1110 .theme-install-php a.browse-themes,
    1111 .theme-install-php.show-upload-theme a.upload {
    1112         display: none;
    1113 }
    1114 .theme-install-php.show-upload-theme a.browse-themes {
    1115         display: inline;
    1116 }
    1117 .upload-theme {
    1118         -webkit-box-sizing: border-box;
    1119         -moz-box-sizing: border-box;
    1120         box-sizing: border-box;
    1121         display: none;
    1122         margin: 0px 0 0;
    1123         padding: 0;
    1124         width: 100%;
    1125         overflow: hidden;
    1126         position: relative;
    1127         top: 10px;
    1128 }
    1129 body.show-upload-theme .upload-theme {
    1130         display: block;
    1131 }
    1132 .upload-theme .wp-upload-form {
    1133         background: #fafafa;
    1134         border: 1px solid #e5e5e5;
    1135         padding: 30px;
    1136         margin: 30px auto;
    1137         max-width: 380px;
    1138 }
    1139 .upload-theme .install-help {
    1140         color: #999;
    1141         font-size: 18px;
    1142         font-style: normal;
    1143         margin: 0;
    1144         padding: 40px 0 0;
    1145         text-align: center;
    1146 }
    1147 body.show-upload-theme .upload-theme + .theme-navigation,
    1148 body.show-upload-theme .upload-theme + .theme-navigation + .theme-browser {
    1149         display: none;
    1150 }
    11511106.theme-navigation .theme-count {
    11521107        margin-left: 0;
    11531108        position: absolute;
     
    13401295body.no-results p.no-themes {
    13411296        display: block;
    13421297}
    1343 body.show-upload-theme p.no-themes {
     1298body.show-upload-container p.no-themes {
    13441299        display: none !important;
    13451300}
    13461301
     
    13581313        .more-filters-container {
    13591314                border-bottom: 1px solid #eee;
    13601315        }
    1361         .upload-theme .wp-upload-form {
    1362                 margin: 20px 0;
    1363                 max-width: 100%;
    1364         }
    1365         .upload-theme .install-help {
    1366                 font-size: 15px;
    1367                 padding: 20px 0 0;
    1368                 text-align: left;
    1369         }
    13701316        .more-filters-container .filters-group {
    13711317                margin-bottom: 0;
    13721318                margin-top: 5px;
  • trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php

     
    2727                // These are the tabs which are shown on the page
    2828                $tabs = array();
    2929                $tabs['dashboard'] = __( 'Search' );
    30                 if ( 'search' == $tab )
     30                if ( 'search' == $tab ) {
    3131                        $tabs['search'] = __( 'Search Results' );
    32                 $tabs['upload']    = __( 'Upload' );
     32                }
    3333                $tabs['featured']  = _x( 'Featured', 'Plugin Installer' );
    3434                $tabs['popular']   = _x( 'Popular', 'Plugin Installer' );
    3535                $tabs['new']       = _x( 'Newest', 'Plugin Installer' );
     
    4646                 * @since 2.7.0
    4747                 *
    4848                 * @param array $tabs The tabs shown on the Plugin Install screen. Defaults are 'dashboard', 'search',
    49                  *                    'upload', 'featured', 'popular', 'new', and 'favorites'.
     49                 *                    'featured', 'popular', 'new', and 'favorites'.
    5050                 */
    5151                $tabs = apply_filters( 'install_plugins_tabs', $tabs );
    5252
     
    112112                 * Filter API request arguments for each Plugin Install screen tab.
    113113                 *
    114114                 * The dynamic portion of the hook name, $tab, refers to the plugin install tabs.
    115                  * Default tabs are 'dashboard', 'search', 'upload', 'featured', 'popular', 'new',
     115                 * Default tabs are 'dashboard', 'search', 'featured', 'popular', 'new',
    116116                 * and 'favorites'.
    117117                 *
    118118                 * @since 3.7.0
  • trunk/src/wp-admin/includes/plugin-install.php

     
    126126
    127127function install_dashboard() {
    128128        ?>
    129         <p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%2$s">this page</a>.' ), 'https://wordpress.org/plugins/', self_admin_url( 'plugin-install.php?tab=upload' ) ); ?></p>
     129        <p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or <a href="%2$s" class="wp-upload-show">upload a plugin</a> in .zip format.' ), 'https://wordpress.org/plugins/', self_admin_url( 'plugin-install.php?upload' ) ); ?></p>
    130130
    131131        <h4><?php _e('Search') ?></h4>
    132132        <?php install_search_form( false ); ?>
     
    187187 */
    188188function install_plugins_upload( $page = 1 ) {
    189189?>
    190         <h4><?php _e('Install a plugin in .zip format'); ?></h4>
    191         <p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p>
    192         <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>">
    193                 <?php wp_nonce_field( 'plugin-upload'); ?>
    194                 <label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
    195                 <input type="file" id="pluginzip" name="pluginzip" />
    196                 <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
    197         </form>
     190        <div class="wp-upload-container wp-upload-container-hidden">
     191                <p class="install-help"><?php _e( 'If you have a plugin in a .zip format, you may install it by uploading it here.' ); ?></p>
     192                <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url( 'update.php?action=upload-plugin' ); ?>">
     193                        <?php wp_nonce_field( 'plugin-upload' ); ?>
     194                        <label class="screen-reader-text" for="pluginzip"><?php _e( 'Plugin zip file' ); ?></label>
     195                        <input type="file" id="pluginzip" name="pluginzip" />
     196                        <?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
     197                </form>
     198        </div>
    198199<?php
    199200}
    200201add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
  • trunk/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-hidden">
     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
  • trunk/src/wp-admin/js/theme.js

     
    14971497        searchContainer: $( '.theme-navigation' ),
    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.
  • trunk/src/wp-admin/plugin-install.php

     
    2929$title = __('Install Plugins');
    3030$parent_file = 'plugins.php';
    3131
    32 wp_enqueue_script( 'plugin-install' );
     32wp_localize_script( 'plugin', '_wpPluginSettings', array(
     33        'plugins' => false,
     34        'settings' => array(
     35                'isInstall'     => true,
     36                'canInstall'    => current_user_can( 'install_plugins' ),
     37                'installURI'    => current_user_can( 'install_plugins' ) ? self_admin_url( 'plugin-install.php' ) : null,
     38                'adminUrl'      => parse_url( self_admin_url(), PHP_URL_PATH )
     39        ),
     40        'l10n' => array(
     41                'pluginInformation' => __('Plugin Information:'),
     42                'ays' => __('Are you sure you want to install this plugin?')
     43        ),
     44) );
     45
     46wp_enqueue_script( 'plugin' );
     47
    3348if ( 'plugin-information' != $tab )
    3449        add_thickbox();
    3550
     
    7388include(ABSPATH . 'wp-admin/admin-header.php');
    7489?>
    7590<div class="wrap">
    76 <h2><?php echo esc_html( $title ); ?></h2>
     91        <h2>
     92                <?php echo esc_html( $title ); ?>
     93               
     94                <a href="#" class="wp-upload-show add-new-h2"><?php echo __( 'Upload Plugin' ); ?></a>
     95                <a href="#" class="wp-upload-hide add-new-h2"><?php echo __( 'Browse', 'plugins' ); ?></a>
     96        </h2>
    7797
    78 <?php $wp_list_table->views(); ?>
     98        <?php install_plugins_upload(); ?>
    7999
    80 <br class="clear" />
    81 <?php
    82 /**
    83  * Fires after the plugins list table in each tab of the Install Plugins screen.
    84  *
    85  * The dynamic portion of the action hook, $tab, allows for targeting
    86  * individual tabs, for instance 'install_plugins_plugin-information'.
    87  *
    88  * @since 2.7.0
    89  *
    90  * @param int $paged The current page number of the plugins list table.
    91  */
    92 ?>
    93 <?php do_action( "install_plugins_$tab", $paged ); ?>
     100        <div class="hide-on-upload">
     101                <?php $wp_list_table->views(); ?>
     102       
     103                <br class="clear" />
     104       
     105                <?php
     106                /**
     107                 * Fires after the plugins list table in each tab of the Install Plugins screen.
     108                 *
     109                 * The dynamic portion of the action hook, $tab, allows for targeting
     110                 * individual tabs, for instance 'install_plugins_plugin-information'.
     111                 *
     112                 * @since 2.7.0
     113                 *
     114                 * @param int $paged The current page number of the plugins list table.
     115                 */
     116                do_action( "install_plugins_$tab", $paged ); ?>
     117        </div>
    94118</div>
    95119<?php
    96120/**
  • trunk/src/wp-admin/theme-install.php

     
    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 = $tab_slug == 'upload' ? ' wp-upload-show' : ' wp-upload-hide';
     129                       
     130                        echo '<a href="#" class="' . esc_attr( $tab_slug ) . $visibility . ' add-new-h2">' . $tab_name . '</a>';
    129131                }
    130132                ?>
    131133        </h2>
    132134
    133         <div class="upload-theme">
    134135        <?php install_themes_upload(); ?>
    135         </div>
    136 
    137         <div class="theme-navigation">
     136       
     137        <div class="theme-navigation hide-on-upload">
    138138                <span class="theme-count"></span>
    139139                <a class="theme-section" href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a>
    140140                <a class="theme-section" href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a>
     
    175175                        </div>
    176176                </div>
    177177        </div>
    178         <div class="theme-browser"></div>
     178        <div class="theme-browser hide-on-upload"></div>
    179179        <div class="theme-install-overlay wp-full-overlay expanded"></div>
    180180
    181181        <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
  • trunk/src/wp-includes/script-loader.php

     
    486486                        'error' => __('Error while saving the changes.')
    487487                ) );
    488488
    489                 $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), false, 1 );
    490                 did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
    491                         'plugin_information' => __('Plugin Information:'),
    492                         'ays' => __('Are you sure you want to install this plugin?')
    493                 ) );
     489                $scripts->add( 'plugin', "/wp-admin/js/plugin$suffix.js", array( 'wp-backbone' ), false, 1 );
    494490
    495491                $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery' ) );
    496492