Make WordPress Core

Changeset 22026


Ignore:
Timestamp:
09/27/2012 12:47:01 AM (11 years ago)
Author:
nacin
Message:

Browse and install your wordpress.org plugin favorites from the plugin installer. props Otto42, Japh, DrewAPicture. fixes #22002.

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-plugin-install-list-table.php

    r22019 r22026  
    3030        if ( 'search' == $tab )
    3131            $tabs['search'] = __( 'Search Results' );
    32         $tabs['upload'] = __( 'Upload' );
    33         $tabs['featured'] = _x( 'Featured','Plugin Installer' );
    34         $tabs['popular']  = _x( 'Popular','Plugin Installer' );
    35         $tabs['new']      = _x( 'Newest','Plugin Installer' );
     32        $tabs['upload']    = __( 'Upload' );
     33        $tabs['featured']  = _x( 'Featured', 'Plugin Installer' );
     34        $tabs['popular']   = _x( 'Popular', 'Plugin Installer' );
     35        $tabs['new']       = _x( 'Newest', 'Plugin Installer' );
     36        $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' );
    3637
    3738        $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
     
    7071            case 'new':
    7172                $args['browse'] = $tab;
     73                break;
     74
     75            case 'favorites':
     76                $user = isset( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
     77                update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
     78                if ( $user )
     79                    $args['user'] = $user;
     80                else
     81                    $args = false;
     82
     83                add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
    7284                break;
    7385
  • trunk/wp-admin/includes/plugin-install.php

    r21996 r22026  
    156156
    157157/**
     158 * Show a username form for the favorites page
     159 * @since 3.5.0
     160 *
     161 */
     162function install_plugins_favorites_form() {
     163    $user = ! empty( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
     164    ?>
     165    <p class="install-help"><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p>
     166    <form method="get" action="">
     167        <input type="hidden" name="tab" value="favorites" />
     168        <p>
     169            <label for="user"><?php _e( 'Your WordPress.org username:' ); ?></label>
     170            <input type="search" id="user" name="user" value="<?php echo esc_attr( $user ); ?>" />
     171            <input type="submit" class="button" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
     172        </p>
     173    </form>
     174    <?php
     175}
     176
     177/**
    158178 * Display plugin content based on plugin list.
    159179 *
     
    163183    global $wp_list_table;
    164184
     185    if ( current_filter() == 'install_plugins_favorites' && empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) )
     186            return;
     187
    165188    $wp_list_table->display();
    166189}
    167 add_action('install_plugins_search', 'display_plugins_table');
    168 add_action('install_plugins_featured', 'display_plugins_table');
    169 add_action('install_plugins_popular', 'display_plugins_table');
    170 add_action('install_plugins_new', 'display_plugins_table');
     190add_action( 'install_plugins_search',    'display_plugins_table' );
     191add_action( 'install_plugins_featured',  'display_plugins_table' );
     192add_action( 'install_plugins_popular',   'display_plugins_table' );
     193add_action( 'install_plugins_new',       'display_plugins_table' );
     194add_action( 'install_plugins_favorites', 'display_plugins_table' );
    171195
    172196/**
  • trunk/wp-admin/plugin-install.php

    r21196 r22026  
    4646'title'     => __('Adding Plugins'),
    4747'content'   =>
    48     '<p>' . __('If you know what you&#8217;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>' .
     48    '<p>' . __('If you know what you&#8217;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>' .
    4949    '<p>' . __('If you just want to get an idea of what&#8217;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>' .
    50     '<p>' . __('If you want to install a plugin that you&#8217;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>'
     50    '<p>' . __('You can also browse a user&#8217;s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.') . '</p>' .
     51    '<p>' . __('If you want to install a plugin that you&#8217;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>'
    5152) );
    5253
Note: See TracChangeset for help on using the changeset viewer.