Ticket #22002: 22002.3.diff
File 22002.3.diff, 2.6 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/class-wp-plugin-install-list-table.php
33 33 $tabs['featured'] = _x( 'Featured','Plugin Installer' ); 34 34 $tabs['popular'] = _x( 'Popular','Plugin Installer' ); 35 35 $tabs['new'] = _x( 'Newest','Plugin Installer' ); 36 $tabs['favorites'] = _x( 'Favorites','Plugin Installer' ); 36 37 37 38 $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item. 38 39 … … 71 72 $args['browse'] = $tab; 72 73 break; 73 74 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 break; 84 74 85 default: 75 86 $args = false; 76 87 } -
wp-admin/includes/plugin-install.php
155 155 add_action('install_plugins_upload', 'install_plugins_upload', 10, 1); 156 156 157 157 /** 158 * Show a username form for the favorites page 159 * @since 3.5.0 160 * 161 * @param string $page 162 */ 163 function install_plugins_favorites( $page = 1 ) { 164 $favorites_username = isset( $_REQUEST['user'] ) ? stripslashes( $_REQUEST['user'] ) : get_user_option( 'favorites_username' ); 165 ?> 166 <form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('plugin-install.php?tab=favorites') ?>"> 167 <label for="user"><?php _e('WordPress.org username: '); ?></label> 168 <input type="text" id="user" name="user" value="<?php echo esc_attr($favorites_username); ?>" /> 169 <input type="submit" class="button" value="<?php esc_attr_e('Get Favorites') ?>" /> 170 </form> 171 <?php 172 } 173 add_action('install_plugins_favorites', 'install_plugins_favorites', 10, 1); 174 175 /** 158 176 * Display plugin content based on plugin list. 159 177 * 160 178 * @since 2.7.0 … … 168 186 add_action('install_plugins_featured', 'display_plugins_table'); 169 187 add_action('install_plugins_popular', 'display_plugins_table'); 170 188 add_action('install_plugins_new', 'display_plugins_table'); 189 add_action('install_plugins_favorites', 'display_plugins_table'); 171 190 172 191 /** 173 192 * Determine the status we can perform on a plugin.