Browse and install your wordpress.org plugin favorites from the plugin installer. props Otto42, Japh, DrewAPicture. fixes #22002.
git-svn-id: http://core.svn.wordpress.org/trunk@22026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3c6ef163d6
commit
fc5fb63599
|
@ -33,6 +33,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||||
$tabs['featured'] = _x( 'Featured', 'Plugin Installer' );
|
$tabs['featured'] = _x( 'Featured', 'Plugin Installer' );
|
||||||
$tabs['popular'] = _x( 'Popular', 'Plugin Installer' );
|
$tabs['popular'] = _x( 'Popular', 'Plugin Installer' );
|
||||||
$tabs['new'] = _x( 'Newest', 'Plugin Installer' );
|
$tabs['new'] = _x( 'Newest', 'Plugin Installer' );
|
||||||
|
$tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' );
|
||||||
|
|
||||||
$nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
|
$nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
|
||||||
|
|
||||||
|
@ -71,6 +72,17 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||||
$args['browse'] = $tab;
|
$args['browse'] = $tab;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'favorites':
|
||||||
|
$user = isset( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
|
||||||
|
update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
|
||||||
|
if ( $user )
|
||||||
|
$args['user'] = $user;
|
||||||
|
else
|
||||||
|
$args = false;
|
||||||
|
|
||||||
|
add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$args = false;
|
$args = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,26 @@ function install_plugins_upload( $page = 1 ) {
|
||||||
}
|
}
|
||||||
add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
|
add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a username form for the favorites page
|
||||||
|
* @since 3.5.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function install_plugins_favorites_form() {
|
||||||
|
$user = ! empty( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
|
||||||
|
?>
|
||||||
|
<p class="install-help"><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p>
|
||||||
|
<form method="get" action="">
|
||||||
|
<input type="hidden" name="tab" value="favorites" />
|
||||||
|
<p>
|
||||||
|
<label for="user"><?php _e( 'Your WordPress.org username:' ); ?></label>
|
||||||
|
<input type="search" id="user" name="user" value="<?php echo esc_attr( $user ); ?>" />
|
||||||
|
<input type="submit" class="button" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display plugin content based on plugin list.
|
* Display plugin content based on plugin list.
|
||||||
*
|
*
|
||||||
|
@ -162,12 +182,16 @@ add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
|
||||||
function display_plugins_table() {
|
function display_plugins_table() {
|
||||||
global $wp_list_table;
|
global $wp_list_table;
|
||||||
|
|
||||||
|
if ( current_filter() == 'install_plugins_favorites' && empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) )
|
||||||
|
return;
|
||||||
|
|
||||||
$wp_list_table->display();
|
$wp_list_table->display();
|
||||||
}
|
}
|
||||||
add_action( 'install_plugins_search', 'display_plugins_table' );
|
add_action( 'install_plugins_search', 'display_plugins_table' );
|
||||||
add_action( 'install_plugins_featured', 'display_plugins_table' );
|
add_action( 'install_plugins_featured', 'display_plugins_table' );
|
||||||
add_action( 'install_plugins_popular', 'display_plugins_table' );
|
add_action( 'install_plugins_popular', 'display_plugins_table' );
|
||||||
add_action( 'install_plugins_new', 'display_plugins_table' );
|
add_action( 'install_plugins_new', 'display_plugins_table' );
|
||||||
|
add_action( 'install_plugins_favorites', 'display_plugins_table' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the status we can perform on a plugin.
|
* Determine the status we can perform on a plugin.
|
||||||
|
|
|
@ -45,9 +45,10 @@ get_current_screen()->add_help_tab( array(
|
||||||
'id' => 'adding-plugins',
|
'id' => 'adding-plugins',
|
||||||
'title' => __('Adding Plugins'),
|
'title' => __('Adding Plugins'),
|
||||||
'content' =>
|
'content' =>
|
||||||
'<p>' . __('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' .
|
'<p>' . __('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' .
|
||||||
'<p>' . __('If you just want to get an idea of what’s available, you can browse Featured, Popular, and Newest plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' .
|
'<p>' . __('If you just want to get an idea of what’s available, you can browse Featured, Popular, and Newest plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' .
|
||||||
'<p>' . __('If you want to install a plugin that you’ve downloaded elsewhere, click the Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>'
|
'<p>' . __('You can also browse a user’s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.') . '</p>' .
|
||||||
|
'<p>' . __('If you want to install a plugin that you’ve downloaded elsewhere, click the Upload link in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>'
|
||||||
) );
|
) );
|
||||||
|
|
||||||
get_current_screen()->set_help_sidebar(
|
get_current_screen()->set_help_sidebar(
|
||||||
|
|
Loading…
Reference in New Issue