Split add new plugin dashboard into search and upload.

git-svn-id: http://svn.automattic.com/wordpress/trunk@10829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-03-20 13:31:00 +00:00
parent 226f9a9789
commit 05e7b08659
2 changed files with 23 additions and 11 deletions

View File

@ -128,14 +128,6 @@ function install_dashboard() {
<p class="install-help"><?php _e('Search for plugins by keyword, author, or tag.') ?></p>
<?php install_search_form(); ?>
<h4><?php _e('Install a plugin in .zip format') ?></h4>
<p class="install-help"><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p>
<form method="post" enctype="multipart/form-data" action="<?php echo admin_url('plugin-install.php?tab=upload') ?>">
<?php wp_nonce_field( 'plugin-upload') ?>
<input type="file" name="pluginzip" />
<input type="submit" class="button" value="<?php _e('Install Now') ?>" />
</form>
<h4><?php _e('Popular tags') ?></h4>
<p class="install-help"><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>
<?php
@ -205,6 +197,25 @@ function install_popular($page = 1) {
display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
}
add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
/**
* Upload from zip
* @since 2.8.0
*
* @param string $page
*/
function install_plugins_upload( $page = 1 ) {
?>
<h4><?php _e('Install a plugin in .zip format') ?></h4>
<p class="install-help"><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p>
<form method="post" enctype="multipart/form-data" action="<?php echo admin_url('plugin-install.php?tab=do_upload') ?>">
<?php wp_nonce_field( 'plugin-upload') ?>
<input type="file" name="pluginzip" />
<input type="submit" class="button" value="<?php _e('Install Now') ?>" />
</form>
<?php
}
add_action('install_plugins_new', 'install_new', 10, 1);
/**
* Display new plugins.
@ -535,7 +546,7 @@ function install_plugin_information() {
}
add_action('install_plugins_upload', 'upload_plugin');
add_action('install_plugins_do_upload', 'upload_plugin');
function upload_plugin() {
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )

View File

@ -24,15 +24,16 @@ add_thickbox();
//These are the tabs which are shown on the page,
$tabs = array();
$tabs['dashboard'] = __('Start Page'); //TODO: Better name?
$tabs['dashboard'] = __('Search'); //TODO: Better name?
if ( 'search' == $tab )
$tabs['search'] = __('Search Results');
$tabs['upload'] = __('Upload');
$tabs['featured'] = __('Featured');
$tabs['popular'] = __('Popular');
$tabs['new'] = __('Newest');
$tabs['updated'] = __('Recently Updated');
$nonmenu_tabs = array('install', 'plugin-information', 'upload'); //Valid actions to perform which do not have a Menu item.
$nonmenu_tabs = array('install', 'plugin-information', 'do_upload'); //Valid actions to perform which do not have a Menu item.
$tabs = apply_filters('install_plugins_tabs', $tabs );
$nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);