WordPress.org

Make WordPress Core

Ticket #22002: favorites-updated.diff

File favorites-updated.diff, 2.5 KB (added by griffinjt, 19 months ago)
Line 
1Index: wp-admin/includes/class-wp-plugin-install-list-table.php
2===================================================================
3--- wp-admin/includes/class-wp-plugin-install-list-table.php    (revision 22011)
4+++ wp-admin/includes/class-wp-plugin-install-list-table.php    (working copy)
5@@ -33,6 +33,7 @@
6                $tabs['featured'] = _x( 'Featured','Plugin Installer' );
7                $tabs['popular']  = _x( 'Popular','Plugin Installer' );
8                $tabs['new']      = _x( 'Newest','Plugin Installer' );
9+               $tabs['favorites'] = _x( 'Favorites','Plugin Installer' );
10 
11                $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
12 
13@@ -71,6 +72,14 @@
14                                $args['browse'] = $tab;
15                                break;
16 
17+                       case 'favorites':
18+                               if ( isset( $_REQUEST['user'] ) )
19+                                       $args['user'] = stripslashes( $_REQUEST['user'] );
20+                               else
21+                                       $args = false;
22+                               break;
23+
24                        default:
25                                $args = false;
26                }
27Index: wp-admin/includes/plugin-install.php
28===================================================================
29--- wp-admin/includes/plugin-install.php        (revision 22011)
30+++ wp-admin/includes/plugin-install.php        (working copy)
31@@ -155,6 +155,25 @@
32 add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
33 
34 /**
35+ * Show a username form for the favorites page.
36+ *
37+ * @since 3.5.0
38+ *
39+ * @param int $page The current paged number in the display table
40+ */
41+function install_plugins_favories( $page = 1 ) {
42+       $value = isset( $_REQUEST['user'] ) ? stripslashes( $_REQUEST['user'] ) : '';
43+?>
44+       <h4><?php _e('Find Favorite Plugins for a WordPress.org username:') ?></h4>
45+       <form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('plugin-install.php?tab=favorites') ?>">
46+               <label class="screen-reader-text" for="user"><?php _e('WordPress.org username'); ?></label>
47+               <input type="text" id="user" name="user" value="<?php echo esc_attr($value); ?>" />
48+               <input type="submit" class="button" value="<?php esc_attr_e('Find Favorites') ?>" />
49+       </form>
50+<?php
51+}
52+add_action('install_plugins_favorites', 'install_plugins_favorites', 10, 1);
53+
54+/**
55  * Display plugin content based on plugin list.
56  *
57  * @since 2.7.0
58@@ -168,6 +187,7 @@
59 add_action('install_plugins_featured', 'display_plugins_table');
60 add_action('install_plugins_popular', 'display_plugins_table');
61 add_action('install_plugins_new', 'display_plugins_table');
62+add_action('install_plugins_favorites', 'display_plugins_table');
63 
64 /**
65  * Determine the status we can perform on a plugin.