Ticket #22002: 22002.8.1.diff

File 22002.8.1.diff, 5.0 KB (added by DrewAPicture, 8 months ago)

Some spaces.

Line 
1Index: wp-admin/includes/plugin-install.php
2===================================================================
3--- wp-admin/includes/plugin-install.php        (revision 22016)
4+++ wp-admin/includes/plugin-install.php        (working copy)
5@@ -155,6 +155,26 @@
6 add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
7 
8 /**
9+ * Show a username form for the favorites page
10+ * @since 3.5.0
11+ *
12+ */
13+function install_plugins_favorites_form() {
14+       $user = isset( $_REQUEST['user'] ) ? stripslashes( $_REQUEST['user'] ) : get_user_option( 'wporg_favorites' );
15+       ?>
16+       <p class="install-help"><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p>
17+       <form method="get" action="">
18+               <input type="hidden" name="tab" value="favorites" />
19+               <p>
20+                       <label for="user"><?php _e( 'Your WordPress.org username:' ); ?></label>
21+                       <input type="search" id="user" name="user" value="<?php echo esc_attr( $user ); ?>" />
22+                       <input type="submit" class="button" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
23+               </p>
24+       </form>
25+       <?php
26+}
27+
28+/**
29  * Display plugin content based on plugin list.
30  *
31  * @since 2.7.0
32@@ -162,12 +182,16 @@
33 function display_plugins_table() {
34        global $wp_list_table;
35 
36+       if ( current_filter() == 'install_plugins_favorites' && ! isset( $_REQUEST['user'] ) && ! get_user_option( 'wporg_favorites' ) )
37+                       return;
38+
39        $wp_list_table->display();
40 }
41-add_action('install_plugins_search', 'display_plugins_table');
42-add_action('install_plugins_featured', 'display_plugins_table');
43-add_action('install_plugins_popular', 'display_plugins_table');
44-add_action('install_plugins_new', 'display_plugins_table');
45+add_action( 'install_plugins_search', 'display_plugins_table' );
46+add_action( 'install_plugins_featured', 'display_plugins_table' );
47+add_action( 'install_plugins_popular', 'display_plugins_table' );
48+add_action( 'install_plugins_new', 'display_plugins_table' );
49+add_action( 'install_plugins_favorites', 'display_plugins_table' );
50 
51 /**
52  * Determine the status we can perform on a plugin.
53Index: wp-admin/includes/class-wp-plugin-install-list-table.php
54===================================================================
55--- wp-admin/includes/class-wp-plugin-install-list-table.php    (revision 22016)
56+++ wp-admin/includes/class-wp-plugin-install-list-table.php    (working copy)
57@@ -33,6 +33,7 @@
58                $tabs['featured'] = _x( 'Featured','Plugin Installer' );
59                $tabs['popular']  = _x( 'Popular','Plugin Installer' );
60                $tabs['new']      = _x( 'Newest','Plugin Installer' );
61+               $tabs['favorites'] = _x( 'Favorites','Plugin Installer' );
62 
63                $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
64 
65@@ -71,6 +72,18 @@
66                                $args['browse'] = $tab;
67                                break;
68 
69+                       case 'favorites':
70+                               $user = isset( $_REQUEST['user'] ) ? stripslashes( $_REQUEST['user'] ) : get_user_option( 'wporg_favorites' );
71+                               if ( $user ) {
72+                                       $args['user'] = $user;
73+                                       update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
74+                               } else {
75+                                       $args = false;
76+                               }
77+
78+                               add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
79+                               break;
80+
81                        default:
82                                $args = false;
83                }
84Index: wp-admin/plugin-install.php
85===================================================================
86--- wp-admin/plugin-install.php (revision 22016)
87+++ wp-admin/plugin-install.php (working copy)
88@@ -45,9 +45,10 @@
89 'id'           => 'adding-plugins',
90 'title'                => __('Adding Plugins'),
91 'content'      =>
92-       '<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>' .
93+       '<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>' .
94        '<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>' .
95-       '<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>'
96+       '<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>' .
97+       '<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>'
98 ) );
99 
100 get_current_screen()->set_help_sidebar(