diff --git a/src/wp-admin/css/themes.css b/src/wp-admin/css/themes.css index 113a16c818..ab67ad0646 100644 --- a/src/wp-admin/css/themes.css +++ b/src/wp-admin/css/themes.css @@ -1026,11 +1026,11 @@ body.folded .theme-browser ~ .theme-overlay .theme-wrap { } .upload-view-toggle .browse, -.upload-view-toggle.upload-tab .upload { +.plugin-install-tab-upload .upload-view-toggle .upload { display: none; } -.upload-view-toggle.upload-tab .browse { +.plugin-install-tab-upload .upload-view-toggle .browse { display: inline; } @@ -1048,9 +1048,14 @@ body.folded .theme-browser ~ .theme-overlay .theme-wrap { top: 10px; } +.upload-plugin-wrap { + display: none; +} + .show-upload-view .upload-theme, .show-upload-view .upload-plugin, -.upload-tab .upload-plugin { +.show-upload-view .upload-plugin-wrap, +.plugin-install-tab-upload .upload-plugin { display: block; } diff --git a/src/wp-admin/includes/admin-filters.php b/src/wp-admin/includes/admin-filters.php index 65aaccde36..141e8aa08e 100644 --- a/src/wp-admin/includes/admin-filters.php +++ b/src/wp-admin/includes/admin-filters.php @@ -70,6 +70,7 @@ add_filter( 'whitelist_options', 'option_update_filter' ); // Plugin Install hooks. add_action( 'install_plugins_featured', 'install_dashboard' ); +add_action( 'install_plugins_upload', 'install_plugins_upload' ); add_action( 'install_plugins_search', 'display_plugins_table' ); add_action( 'install_plugins_popular', 'display_plugins_table' ); add_action( 'install_plugins_recommended', 'display_plugins_table' ); diff --git a/src/wp-admin/js/plugin-install.js b/src/wp-admin/js/plugin-install.js index 8954766838..71b0e705ec 100644 --- a/src/wp-admin/js/plugin-install.js +++ b/src/wp-admin/js/plugin-install.js @@ -12,7 +12,8 @@ jQuery( document ).ready( function( $ ) { $tabbables, $firstTabbable, $lastTabbable, - uploadViewToggle = $( '.upload-view-toggle' ), + $uploadViewToggle = $( '.upload-view-toggle' ), + $wrap = $ ( '.wrap' ), $body = $( document.body ); tb_position = function() { @@ -183,12 +184,12 @@ jQuery( document ).ready( function( $ ) { * When a user presses the "Upload Plugin" button, show the upload form in place * rather than sending them to the devoted upload plugin page. * The `?tab=upload` page still exists for no-js support and for plugins that - * might access it directly (?). When we're in this page, let the link behave + * might access it directly. When we're in this page, let the link behave * like a link. Otherwise we're in the normal plugin installer pages and the * link should behave like a toggle button. */ - if ( ! uploadViewToggle.hasClass( 'upload-tab' ) ) { - uploadViewToggle + if ( ! $wrap.hasClass( 'plugin-install-tab-upload' ) ) { + $uploadViewToggle .attr({ role: 'button', 'aria-expanded': 'false' @@ -196,7 +197,7 @@ jQuery( document ).ready( function( $ ) { .on( 'click', function( event ) { event.preventDefault(); $body.toggleClass( 'show-upload-view' ); - uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) ); + $uploadViewToggle.attr( 'aria-expanded', $body.hasClass( 'show-upload-view' ) ); }); } }); diff --git a/src/wp-admin/plugin-install.php b/src/wp-admin/plugin-install.php index 0a123d634a..637424b507 100644 --- a/src/wp-admin/plugin-install.php +++ b/src/wp-admin/plugin-install.php @@ -66,6 +66,15 @@ wp_enqueue_script( 'updates' ); */ do_action( "install_plugins_pre_$tab" ); +/* + * Call the pre upload action on every non-upload plugin install screen + * because the form is always displayed on these screens. + */ +if ( 'upload' !== $tab ) { + /** This action is documented in wp-admin/plugin-install.php */ + do_action( 'install_plugins_pre_upload' ); +} + get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), @@ -101,22 +110,13 @@ get_current_screen()->set_screen_reader_content( array( */ include(ABSPATH . 'wp-admin/admin-header.php'); ?> -
+
">

%s%s', - $href, - $upload_tab_class, + printf( ' %s%s', + ( 'upload' === $tab ) ? self_admin_url( 'plugin-install.php' ) : self_admin_url( 'plugin-install.php?tab=upload' ), __( 'Upload Plugin' ), __( 'Browse Plugins' ) ); @@ -124,16 +124,22 @@ include(ABSPATH . 'wp-admin/admin-header.php'); ?>

-
-
+if ( $tab !== 'upload' ) { + ?> +
+ +
+ views(); echo '
';