<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[22026] trunk/wp-admin: Browse and install your wordpress.org plugin favorites from the plugin installer.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/22026">22026</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-09-27 00:47:01 +0000 (Thu, 27 Sep 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Browse and install your wordpress.org plugin favorites from the plugin installer. props Otto42, Japh, DrewAPicture. fixes <a href="http://core.trac.wordpress.org/ticket/22002">#22002</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswpplugininstalllisttablephp">trunk/wp-admin/includes/class-wp-plugin-install-list-table.php</a></li>
<li><a href="#trunkwpadminincludesplugininstallphp">trunk/wp-admin/includes/plugin-install.php</a></li>
<li><a href="#trunkwpadminplugininstallphp">trunk/wp-admin/plugin-install.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswpplugininstalllisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-plugin-install-list-table.php (22025 => 22026)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-plugin-install-list-table.php        2012-09-27 00:41:49 UTC (rev 22025)
+++ trunk/wp-admin/includes/class-wp-plugin-install-list-table.php        2012-09-27 00:47:01 UTC (rev 22026)
</span><span class="lines">@@ -29,10 +29,11 @@
</span><span class="cx">                 $tabs['dashboard'] = __( 'Search' );
</span><span class="cx">                 if ( 'search' == $tab )
</span><span class="cx">                         $tabs['search']        = __( 'Search Results' );
</span><del>-                $tabs['upload'] = __( 'Upload' );
-                $tabs['featured'] = _x( 'Featured','Plugin Installer' );
-                $tabs['popular']  = _x( 'Popular','Plugin Installer' );
-                $tabs['new']      = _x( 'Newest','Plugin Installer' );
</del><ins>+                $tabs['upload']    = __( 'Upload' );
+                $tabs['featured']  = _x( 'Featured', 'Plugin Installer' );
+                $tabs['popular']   = _x( 'Popular', 'Plugin Installer' );
+                $tabs['new']       = _x( 'Newest', 'Plugin Installer' );
+                $tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' );
</ins><span class="cx"> 
</span><span class="cx">                 $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
</span><span class="cx"> 
</span><span class="lines">@@ -71,6 +72,17 @@
</span><span class="cx">                                 $args['browse'] = $tab;
</span><span class="cx">                                 break;
</span><span class="cx"> 
</span><ins>+                        case 'favorites':
+                                $user = isset( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
+                                update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
+                                if ( $user )
+                                        $args['user'] = $user;
+                                else
+                                        $args = false;
+
+                                add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
+                                break;
+
</ins><span class="cx">                         default:
</span><span class="cx">                                 $args = false;
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkwpadminincludesplugininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin-install.php (22025 => 22026)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin-install.php        2012-09-27 00:41:49 UTC (rev 22025)
+++ trunk/wp-admin/includes/plugin-install.php        2012-09-27 00:47:01 UTC (rev 22026)
</span><span class="lines">@@ -155,6 +155,26 @@
</span><span class="cx"> add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Show a username form for the favorites page
+ * @since 3.5.0
+ *
+ */
+function install_plugins_favorites_form() {
+        $user = ! empty( $_GET['user'] ) ? stripslashes( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
+        ?&gt;
+        &lt;p class=&quot;install-help&quot;&gt;&lt;?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?&gt;&lt;/p&gt;
+        &lt;form method=&quot;get&quot; action=&quot;&quot;&gt;
+                &lt;input type=&quot;hidden&quot; name=&quot;tab&quot; value=&quot;favorites&quot; /&gt;
+                &lt;p&gt;
+                        &lt;label for=&quot;user&quot;&gt;&lt;?php _e( 'Your WordPress.org username:' ); ?&gt;&lt;/label&gt;
+                        &lt;input type=&quot;search&quot; id=&quot;user&quot; name=&quot;user&quot; value=&quot;&lt;?php echo esc_attr( $user ); ?&gt;&quot; /&gt;
+                        &lt;input type=&quot;submit&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e( 'Get Favorites' ); ?&gt;&quot; /&gt;
+                &lt;/p&gt;
+        &lt;/form&gt;
+        &lt;?php
+}
+
+/**
</ins><span class="cx">  * Display plugin content based on plugin list.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.7.0
</span><span class="lines">@@ -162,12 +182,16 @@
</span><span class="cx"> function display_plugins_table() {
</span><span class="cx">         global $wp_list_table;
</span><span class="cx"> 
</span><ins>+        if ( current_filter() == 'install_plugins_favorites' &amp;&amp; empty( $_GET['user'] ) &amp;&amp; ! get_user_option( 'wporg_favorites' ) )
+                        return;
+
</ins><span class="cx">         $wp_list_table-&gt;display();
</span><span class="cx"> }
</span><del>-add_action('install_plugins_search', 'display_plugins_table');
-add_action('install_plugins_featured', 'display_plugins_table');
-add_action('install_plugins_popular', 'display_plugins_table');
-add_action('install_plugins_new', 'display_plugins_table');
</del><ins>+add_action( 'install_plugins_search',    'display_plugins_table' );
+add_action( 'install_plugins_featured',  'display_plugins_table' );
+add_action( 'install_plugins_popular',   'display_plugins_table' );
+add_action( 'install_plugins_new',       'display_plugins_table' );
+add_action( 'install_plugins_favorites', 'display_plugins_table' );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Determine the status we can perform on a plugin.
</span></span></pre></div>
<a id="trunkwpadminplugininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugin-install.php (22025 => 22026)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugin-install.php        2012-09-27 00:41:49 UTC (rev 22025)
+++ trunk/wp-admin/plugin-install.php        2012-09-27 00:47:01 UTC (rev 22026)
</span><span class="lines">@@ -45,9 +45,10 @@
</span><span class="cx"> 'id'                =&gt; 'adding-plugins',
</span><span class="cx"> 'title'                =&gt; __('Adding Plugins'),
</span><span class="cx"> 'content'        =&gt;
</span><del>-        '&lt;p&gt;' . __('If you know what you&amp;#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.') . '&lt;/p&gt;' .
</del><ins>+        '&lt;p&gt;' . __('If you know what you&amp;#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.') . '&lt;/p&gt;' .
</ins><span class="cx">         '&lt;p&gt;' . __('If you just want to get an idea of what&amp;#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.') . '&lt;/p&gt;' .
</span><del>-        '&lt;p&gt;' . __('If you want to install a plugin that you&amp;#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.') . '&lt;/p&gt;'
</del><ins>+        '&lt;p&gt;' . __('You can also browse a user&amp;#8217;s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.') . '&lt;/p&gt;' . 
+        '&lt;p&gt;' . __('If you want to install a plugin that you&amp;#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.') . '&lt;/p&gt;'
</ins><span class="cx"> ) );
</span><span class="cx"> 
</span><span class="cx"> get_current_screen()-&gt;set_help_sidebar(
</span></span></pre>
</div>
</div>

</body>
</html>