WordPress.org

Make WordPress Core

Ticket #22002: 22002.7.diff

File 22002.7.diff, 4.4 KB (added by Japh, 6 years ago)

Removed enctype attribute from the form, as per @nacin's recommendation

  • wp-admin/includes/plugin-install.php

     
    155155add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
    156156
    157157/**
     158 * Show a username form for the favorites page
     159 * @since 3.5.0
     160 *
     161 */
     162function install_plugins_favorites_form( ) {
     163        $favorites_username = isset( $_REQUEST['user'] ) ? stripslashes( $_REQUEST['user'] ) : get_user_option( 'favorites_username' );
     164        ?>
     165        <form method="post" action="<?php echo self_admin_url('plugin-install.php?tab=favorites') ?>">
     166                <label for="user"><?php _e('WordPress.org username: '); ?></label>
     167                <input type="search" id="user" name="user" value="<?php echo esc_attr($favorites_username); ?>" />
     168                <input type="submit" class="button" value="<?php esc_attr_e('Get Favorites') ?>" />
     169        </form>
     170        <?php
     171}
     172
     173/**
    158174 * Display plugin content based on plugin list.
    159175 *
    160176 * @since 2.7.0
     
    168184add_action('install_plugins_featured', 'display_plugins_table');
    169185add_action('install_plugins_popular', 'display_plugins_table');
    170186add_action('install_plugins_new', 'display_plugins_table');
     187add_action('install_plugins_favorites', 'display_plugins_table');
    171188
    172189/**
    173190 * Determine the status we can perform on a plugin.
  • wp-admin/includes/class-wp-plugin-install-list-table.php

     
    3333                $tabs['featured'] = _x( 'Featured','Plugin Installer' );
    3434                $tabs['popular']  = _x( 'Popular','Plugin Installer' );
    3535                $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.
    3839
     
    7172                                $args['browse'] = $tab;
    7273                                break;
    7374
     75                        case 'favorites':
     76                                $favorites_username = isset( $_REQUEST['user'] ) ? stripslashes( $_REQUEST['user'] ) : get_user_option( 'favorites_username' );
     77                                if ( ! empty( $favorites_username ) ) {
     78                                        $args['user'] = $favorites_username;
     79                                        update_user_meta( get_current_user_id(), 'favorites_username', $favorites_username );
     80                                } else {
     81                                        $args = false;
     82                                }
     83                               
     84                                add_action( 'install_plugins_table_header', 'install_plugins_favorites_form', 10, 0 );
     85                                break;
     86
    7487                        default:
    7588                                $args = false;
    7689                }
  • wp-admin/plugin-install.php

     
    4545'id'            => 'adding-plugins',
    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
    5354get_current_screen()->set_help_sidebar(