<!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>[2611] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: Plugin Directory: Switch to using namespaces instead of implemeting them through classnames.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/2611">2611</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/2611","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-02-25 05:03:19 +0000 (Thu, 25 Feb 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Plugin Directory: Switch to using namespaces instead of implemeting them through classnames.
This change introduces an autoloader and relies upon it for most file inclusions, this should encourage us to keep a standard naming schema and writing more component classes going forward.
See <a href="http://meta.trac.wordpress.org/ticket/1584">#1584</a></pre>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclassadmincustomizationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-admin-customizations.php</a></li>
<li>sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/</li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscommittersphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassautoloaderphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-autoloader.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassplugindirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassplugingeopatternphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstemplatephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstoolsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryplugindirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php</a></li>
<li>sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/</li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassscreenshotsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasswporgplugindirectoryadminmetaboxcommittersphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-wporg-plugin-directory-admin-metabox-committers.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytemplatephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytoolsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugingeopatternphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-geopattern.php</a></li>
<li>sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/</li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesscreenshotsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/screenshots.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectorywporgplugindirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/wporg-plugin-directory.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclassadmincustomizationsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-admin-customizations.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-admin-customizations.php                            (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-admin-customizations.php      2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,34 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\Admin;
+
+/**
+ * All functionality related to the Administration interface.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Admin_Customizations {
+       /**
+        * Fetch the instance of the Plugin_Directory class.
+        */
+       public static function instance() {
+               static $instance = null;
+               return ! is_null( $instance ) ? $instance : $instance = new Admin_Customizations();
+       }
+
+       private function __construct() {
+               add_action( 'add_meta_boxes', array( $this, 'register_admin_metaboxes' ) );
+       }
+
+       /**
+        * Register the Admin metaboxes for the plugin management screens.
+        */
+       public function register_admin_metaboxes() {
+               add_meta_box(
+                       'plugin-committers',
+                       __( 'Plugin Committers', 'wporg-plugins' ),
+                       array( __NAMESPACE__ . '\\Metabox\\Committers', 'display' ),
+                       'plugin'
+               );
+       }
+
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-admin-customizations.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasswporgplugindirectoryadminmetaboxcommittersphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-wporg-plugin-directory-admin-metabox-committers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-wporg-plugin-directory-admin-metabox-committers.php 2016-02-25 01:57:40 UTC (rev 2610)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-wporg-plugin-directory-admin-metabox-committers.php   2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,30 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-class WPorg_Plugin_Directory_Admin_Metabox_Committers {
-       function __construct() {
-               add_action( 'add_meta_boxes', array( $this, 'register' ) );
-       }
-
-       function register() {
-               add_meta_box( 'plugin-committers', __( 'Plugin Committers', 'wporg-plugins' ), array( $this, 'display' ), 'plugin' );
-       }
-
-       function display() {
-               $plugin_slug = get_post()->post_name;
-               $existing_committers = WPorg_Plugin_Directory_Tools::get_plugin_committers( $plugin_slug );
-               $existing_committers = array_map( function( $user ) { return new WP_User( $user ); }, $existing_committers );
-
-               $output = '';
-               foreach ( $existing_committers as $committer ) {
-                       $output .= sprintf(
-                               '<li title="%s"><span class="avatar">%s</span> %s</li>',
-                               esc_attr( $committer->user_login ),
-                               get_avatar( $committer, '24' ),
-                               esc_html( $committer->display_name )
-                       );
-               }
-               echo '<ul class="committers">' . $output . '</ul>';
-       }
-
-}
-new WPorg_Plugin_Directory_Admin_Metabox_Committers();
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscommittersphpfromrev2562sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasswporgplugindirectoryadminmetaboxcommittersphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php (from rev 2562, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-wporg-plugin-directory-admin-metabox-committers.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php                              (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-committers.php        2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,27 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\Admin\Metabox;
+use WordPressdotorg\Plugin_Directory\Tools;
+
+/**
+ * The Plugin Committers admin metabox.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Committers {
+       static function display() {
+               $plugin_slug = get_post()->post_name;
+               $existing_committers = Tools::get_plugin_committers( $plugin_slug );
+               $existing_committers = array_map( function( $user ) { return new \WP_User( $user ); }, $existing_committers );
+
+               $output = '';
+               foreach ( $existing_committers as $committer ) {
+                       $output .= sprintf(
+                               '<li title="%s"><span class="avatar">%s</span> %s</li>',
+                               esc_attr( $committer->user_login ),
+                               get_avatar( $committer, '24' ),
+                               esc_html( $committer->display_name )
+                       );
+               }
+               echo '<ul class="committers">' . $output . '</ul>';
+       }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassautoloaderphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-autoloader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-autoloader.php                            (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-autoloader.php      2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,51 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\Autoloader;
+
+/**
+ * An Autoloader which respects WordPress's filename standards.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Autoloader {
+       const NS_SEPARATOR = '\\';
+       protected $prefix;
+       protected $prefix_length;
+       protected $path;
+
+       public function __construct( $prefix, $path ) {
+               $this->prefix        = $prefix;
+               $this->prefix_length = strlen( $prefix );
+               $this->path          = trailingslashit( $path );
+       }
+
+       public function load( $class ) {
+               if ( strpos( $class, $this->prefix . self::NS_SEPARATOR ) !== 0 ) {
+                       return;
+               }
+
+               // Strip prefix from the start (ala PSR-4)
+               $class = substr( $class, $this->prefix_length + 1 );
+               $class = strtolower( $class );
+               $file = '';
+
+               if ( false !== ( $last_ns_pos = strripos( $class, self::NS_SEPARATOR ) ) ) {
+                       $namespace = substr( $class, 0, $last_ns_pos );
+                       $class     = substr( $class, $last_ns_pos + 1 );
+                       $file      = str_replace( self::NS_SEPARATOR, DIRECTORY_SEPARATOR, $namespace ) . DIRECTORY_SEPARATOR;
+               }
+
+               $file .= 'class-' . str_replace( '_', '-', $class ) . '.php';
+
+               $path = $this->path . $file;
+
+               if ( file_exists( $path ) ) {
+                       require $path;
+               }
+       }
+
+}
+
+function register_class_path( $prefix, $path ) {
+       $loader = new Autoloader( $prefix, $path );
+       spl_autoload_register( array( $loader, 'load' ) );
+}
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><span class="cx" style="display: block; padding: 0 10px">Property changes on: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-autoloader.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassplugindirectoryphpfromrev2561sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectoryphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php (from rev 2561, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php                              (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php        2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,382 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory;
+
+/**
+ * The main Plugin Directory class, it handles most of the bootstrap and basic operations of the plugin.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Plugin_Directory {
+
+       /**
+        * Fetch the instance of the Plugin_Directory class.
+        */
+       public static function instance( $plugin_file = null ) {
+               static $instance = null;
+               return ! is_null( $instance ) ? $instance : $instance = new Plugin_Directory( $plugin_file );
+       }
+
+       private function __construct( $plugin_file ) {
+               add_action( 'init', array( $this, 'init' ) );
+               add_action( 'init', array( $this, 'register_shortcodes' ) );
+               add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 );
+               add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ) );
+               add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
+               add_filter( 'the_content', array( $this, 'filter_post_content_to_correct_page' ), 1 );
+
+               // Load all Admin-specific items
+               add_action( 'admin_init', array( __NAMESPACE__ . '\\Admin\\Admin_Customizations', 'instance' ) );
+
+               register_activation_hook( $plugin_file, array( $this, 'activate' ) );
+               register_deactivation_hook( $plugin_file, array( $this, 'deactivate' ) );
+       }
+
+       /**
+        * Set up the Plugin Directory.
+        */
+       public function init() {
+               load_plugin_textdomain( 'wporg-plugins' );
+
+               register_post_type( 'plugin', array(
+                       'labels'      => array(
+                               'name'               => __( 'Plugins',          'wporg-plugins' ),
+                               'singular_name'      => __( 'Plugin',           'wporg-plugins' ),
+                               'menu_name'          => __( 'My Plugins',       'wporg-plugins' ),
+                               'add_new'            => __( 'Add New',          'wporg-plugins' ),
+                               'add_new_item'       => __( 'Add New Plugin',   'wporg-plugins' ),
+                               'edit_item'          => __( 'Edit Plugin',      'wporg-plugins' ),
+                               'new_item'           => __( 'New Plugin',       'wporg-plugins' ),
+                               'view_item'          => __( 'View Plugin',      'wporg-plugins' ),
+                               'search_items'       => __( 'Search Plugins',   'wporg-plugins' ),
+                               'not_found'          => __( 'No plugins found', 'wporg-plugins' ),
+                               'not_found_in_trash' => __( 'No plugins found in Trash', 'wporg-plugins' ),
+                       ),
+                       'description' => __( 'A Repo Plugin', 'wporg-plugins' ),
+                       'supports'    => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
+                       'taxonomies'  => array( 'post_tag', 'category' ),
+                       'public'      => true,
+                       'show_ui'     => true,
+                       'has_archive' => true,
+                       'rewrite'     => false,
+                       'menu_icon'   => 'dashicons-admin-plugins',
+               ) );
+
+               register_post_status( 'pending', array(
+                       'label'                     => _x( 'Pending', 'plugin status', 'wporg-plugins' ),
+                       'public'                    => false,
+                       'show_in_admin_status_list' => true,
+                       'label_count'               => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'wporg-plugins' ),
+               ) );
+               register_post_status( 'disabled', array(
+                       'label'                     => _x( 'Disabled', 'plugin status', 'wporg-plugins' ),
+                       'public'                    => false,
+                       'show_in_admin_status_list' => true,
+                       'label_count'               => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ),
+               ) );
+               register_post_status( 'closed', array(
+                       'label'                     => _x( 'Closed', 'plugin status', 'wporg-plugins' ),
+                       'public'                    => false,
+                       'show_in_admin_status_list' => true,
+                       'label_count'               => _n_noop( 'Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'wporg-plugins' ),
+               ) );
+
+               // Add the browse/* views.
+               add_rewrite_tag( '%browse%', '(featured|popular|beta|new|favorites)' );
+               add_permastruct( 'browse', 'browse/%browse%' );
+
+               add_rewrite_endpoint( 'installation', EP_PERMALINK );
+               add_rewrite_endpoint( 'faq',          EP_PERMALINK );
+               add_rewrite_endpoint( 'screenshots',  EP_PERMALINK );
+               add_rewrite_endpoint( 'changelog',    EP_PERMALINK );
+               add_rewrite_endpoint( 'stats',        EP_PERMALINK );
+               add_rewrite_endpoint( 'developers',   EP_PERMALINK );
+               add_rewrite_endpoint( 'other_notes',  EP_PERMALINK );
+
+               // When this plugin is used in the context of a Rosetta site, handle it gracefully
+               if ( 'wordpress.org' != $_SERVER['HTTP_HOST'] && defined( 'WPORG_PLUGIN_DIRECTORY_BLOGID' ) ) {
+                       $this->add_rosetta_network_filters();        
+               }
+       }
+
+       /**
+        * Register the Shortcodes used within the content.
+        */
+       public function register_shortcodes() {
+               add_shortcode( 'wporg-plugins-screenshots', array( __NAMESPACE__ . '\\Shortcodes\\Screenshots', 'display' ) );
+       //      add_shortcode( 'wporg-plugins-stats',       array( __NAMESPACE__ . '\\Shortcodes\\Stats',       'display' ) );
+       //      add_shortcode( 'wporg-plugins-developer',   array( __NAMESPACE__ . '\\Shortcodes\\Developer',   'display' ) );
+       }
+
+       /**
+        * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
+        */
+       public function activate() {
+               global $wp_rewrite;
+
+               // Setup the environment.
+               $this->init();
+
+               // %postname% is required.
+               $wp_rewrite->set_permalink_structure( '/%postname%/' );
+
+               // /tags/%slug% is required for tags.
+               $wp_rewrite->set_tag_base( '/tags' );
+
+               // We require the WordPress.org Ratings plugin also be active.
+               if ( ! is_plugin_active( 'wporg-ratings/wporg-ratings.php' ) ) {
+                       activate_plugin( 'wporg-ratings/wporg-ratings.php' );
+               }
+
+               // Enable the WordPress.org Plugin Repo Theme.
+               foreach ( wp_get_themes() as $theme ) {
+                       if ( $theme->get( 'Name' ) === 'WordPress.org Plugins' ) {
+                               switch_theme( $theme->get_stylesheet() );
+                               break;
+                       }
+               }
+
+               flush_rewrite_rules();
+
+               do_action( 'wporg_plugins_activation' );
+       }
+
+       /**
+        *
+        */
+       public function deactivate() {
+               flush_rewrite_rules();
+
+               do_action( 'wporg_plugins_deactivation' );
+       }
+
+       /**
+        * The Plugin Directory is available at multiple URLs (internationalised domains), this method allows
+        * for the one blog (a single blog_id) to be presented at multiple URLs yet have correct localised links.
+        */
+       public function add_rosetta_network_filters() {
+               // Filter the URLs to use the current localised domain name, rather than WordPress.org.
+               foreach ( array( 'option_home', 'option_siteurl' ) as $filter ) {
+                       add_filter( $filter, function( $url ) {
+                               static $localized_url = null;
+                               if ( is_null( $localized_url ) ) {
+                                       $localized_url = 'https://' . preg_replace( '![^a-z.-]+!', '', $_SERVER['HTTP_HOST'] );
+                               }
+
+                               return preg_replace( '!^[https]+://wordpress\.org!i', $localized_url, $url );
+                       } );
+               }
+
+               /*
+               // This method works in conjuction with a filter in sunrise.php, duplicated here for transparency:
+
+               // Make the Plugin Directory available at /plugins/ on all rosetta sites.
+               function wporg_plugins_on_rosetta_domains( $site, $domain, $path, $segments ) {
+                       // All non-rosetta networks define DOMAIN_CURRENT_SITE in wp-config.php
+                       if ( ! defined( 'DOMAIN_CURRENT_SITE' ) && 'wordpress.org' != $domain && '/plugins/' == substr( $path . '/', 0, 9 ) ) {
+                               $site = get_blog_details( WPORG_PLUGIN_DIRECTORY_BLOGID );
+                               if ( $site ) {
+                                       $site = clone $site;
+                                       // 6 = The Rosetta network, this causes the site to be loaded as part of the Rosetta network
+                                       $site->site_id = 6;
+                                       return $site;
+                               }
+                       }
+               
+                       return $site;
+               }
+               add_filter( 'pre_get_site_by_path', 'wporg_plugins_on_rosetta_domains', 10, 4 );
+               */
+       }
+
+       /**
+        * Filter the permalink for the Plugins to be /plugin-name/.
+        *
+        * @param string  $link The generated permalink.
+        * @param WP_Post $post The Plugin post object.
+        * @return string
+        */
+       public function package_link( $link, $post ) {
+               if ( 'plugin' !== $post->post_type ) {
+                       return $link;
+               }
+
+               return trailingslashit( home_url( $post->post_name ) );
+       }
+
+       /**
+        * Checks if the current users is a super admin before allowing terms to be added.
+        *
+        * @param string $term The term to add or update.
+        * @return string|WP_Error The term to add or update or WP_Error on failure.
+        */
+       public function pre_insert_term_prevent( $term ) {
+               if ( ! is_super_admin() ) {
+                       $term = new WP_Error( 'not-allowed', __( 'You are not allowed to add terms.', 'wporg-plugins' ) );
+               }
+
+               return $term;
+       }
+
+       /**
+        * @param WP_Query $wp_query The WordPress Query object.
+        */
+       public function use_plugins_in_query( $wp_query ) {
+               if ( ! $wp_query->is_main_query() ) {
+                       return;
+               }
+
+               if ( empty( $wp_query->query_vars['pagename'] ) && ( empty( $wp_query->query_vars['post_type'] ) || 'posts' == $wp_query->query_vars['post_type'] ) ) {
+                       $wp_query->query_vars['post_type'] = array( 'plugin' );
+               }
+
+               if ( empty( $wp_query->query ) ) {
+                       $wp_query->query_vars['browse'] = 'featured';
+               }
+
+               switch ( get_query_var( 'browse' ) ) {
+                       case 'beta':
+                               $wp_query->query_vars['category_name'] = 'beta';
+                               break;
+
+                       case 'featured':
+                               $wp_query->query_vars['category_name'] = 'featured';
+                               break;
+
+                       case 'favorites':
+                               break;
+
+                       case 'popular':
+                               break;
+               }
+
+               // Re-route the Endpoints to the `content_page` query var.
+               if ( ! empty( $wp_query->query['name'] ) ) {
+                       $plugin_fields = array(
+                               'installation',
+                               'faq',
+                               'screenshots',
+                               'changelog',
+                               'stats',
+                               'developers',
+                               'other_notes'
+                       );
+
+                       foreach ( $plugin_fields as $plugin_field ) {
+                               if ( isset( $wp_query->query[ $plugin_field ] ) ) {
+                                       $wp_query->query['content_page'] = $wp_query->query_vars['content_page'] = $plugin_field;
+                                       unset( $wp_query->query[ $plugin_field ], $wp_query->query_vars[ $plugin_field ] );
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Returns the requested page's content.
+        *
+        * @param string $content
+        * @return string
+        */
+       public function filter_post_content_to_correct_page( $content ) {
+               if ( 'plugin' === get_post()->post_type ) {
+                       $page = get_query_var( 'content_page' );
+
+                       $content_pages = $this->split_post_content_into_pages( $content );
+                       if ( ! isset( $content_pages[ $page ] ) ) {
+                               $page = 'description';
+                       }
+
+                       $content = $content_pages[ $page ];
+               }
+
+               return $content;
+       }
+
+       /**
+        * Returns an array of pages based on section comments in the content.
+        *
+        * @param string $content
+        * @return array
+        */
+       public function split_post_content_into_pages( $content ) {
+               $_pages = preg_split( "#<!--section=(.+?)-->#", $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
+               $content_pages = array(
+                       'screenshots' => '[wporg-plugins-screenshots]',
+                       'stats'       => '[wporg-plugins-stats]',
+                       'developers'  => '[wporg-plugins-developer]',
+               );
+
+               for ( $i = 0; $i < count( $_pages ); $i += 2 ) {
+
+                       // Don't overwrite existing tabs.
+                       if ( ! isset( $content_pages[ $_pages[ $i ] ] ) ) {
+                               $content_pages[ $_pages[ $i ] ] = $_pages[ $i + 1 ];
+                       }
+               }
+
+               return $content_pages;
+       }
+
+       /**
+        * Retrieve the WP_Post object representing a given plugin.
+        *
+        * @param $plugin_slug string|WP_Post The slug of the plugin to retrieve.
+        * @return WP_Post|WP_Error
+        */
+       public function get_plugin_post( $plugin_slug ) {
+               if ( $plugin_slug instanceof \WP_Post ) {
+                       return $plugin_slug;
+               }
+
+               // get_post_by_slug();
+               $posts = get_posts( array(
+                       'post_type'   => 'plugin',
+                       'name'        => $plugin_slug,
+                       'post_status' => 'any'
+               ) );
+               if ( ! $posts ) {
+                       return false;
+               }
+
+               $plugin = reset( $posts );
+               return $plugin;
+       }
+
+       /**
+        * Create a new post entry for a given plugin slug.
+        *
+        * @param array $plugin_info {
+        *     Array of initial plugin post data, all fields are optional.
+        *
+        *     @type string $title       The title of the plugin.
+        *     @type string $slug        The slug of the plugin.
+        *     @type string $status      The status of the plugin ( 'publish', 'pending', 'disabled', 'closed' ).
+        *     @type int    $author      The ID of the plugin author.
+        *     @type string $description The short description of the plugin.
+        * }
+        * @return WP_Post|WP_Error
+        */
+       public function create_plugin_post( array $plugin_info ) {
+               $title  = !empty( $plugin_info['title'] )       ? $plugin_info['title']       : '';
+               $slug   = !empty( $plugin_info['slug'] )        ? $plugin_info['slug']        : sanitize_title( $title );
+               $status = !empty( $plugin_info['status'] )      ? $plugin_info['status']      : 'pending';
+               $author = !empty( $plugin_info['author'] )      ? $plugin_info['author']      : 0;
+               $desc   = !empty( $plugin_info['description'] ) ? $plugin_info['description'] : '';
+
+               $id = wp_insert_post( array(
+                       'post_type'    => 'plugin',
+                       'post_status'  => $status,
+                       'post_name'    => $slug,
+                       'post_title'   => $title ?: $slug,
+                       'post_author'  => $author,
+                       'post_content' => '',
+                       'post_excerpt' => $desc,
+               ), true );
+
+               if ( is_wp_error( $id ) ) {
+                       return $id;
+               }
+
+               $plugin = get_post( $id );
+               return $plugin;
+       }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassplugingeopatternphpfromrev2560sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugingeopatternphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern.php (from rev 2560, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-geopattern.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern.php                             (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern.php       2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,133 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory;
+
+require __DIR__ . '/libs/geopattern-1.1.0/geopattern_loader.php';
+
+/**
+ * Generates Geopattern icons for Plugins.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Plugin_Geopattern extends \RedeyeVentures\GeoPattern\GeoPattern {
+
+       var $slug; // Hashed to generate pattern
+       var $text; // Text to be overlaid
+       var $textcolor = 'black';
+
+       function __construct($options=array()) {
+               parent::__construct( $options );
+
+               if ( isset( $options['text'] ) )
+                       $this->text = $options['text'];
+
+               if ( isset( $options['textcolor'] ) )
+                       $this->textcolor = $options['textcolor'];
+
+               // Replace the base SVG object with our own, so the dimensions are gettable.
+               $this->svg = new Plugin_Geopattern_SVG();
+       }
+
+       function setText( $text ) {
+               $this->text = $text;
+       }
+
+       function setTextColor( $color ) {
+               $this->textcolor = $color;
+       }
+
+       function generateText() {
+               $size = min( $this->svg->getHeight(), $this->svg->getWidth() );
+               $text_height = floor( $size * 0.8 ) . 'px';
+
+               $this->svg->addText( $this->text, '50%', $text_height, 'middle', "font-family: Times New Roman, serif; font-size: {$text_height}; font-weight: normal; fill: {$this->textcolor};" );
+       }
+
+       public function toSVG( $width = 128, $height = 128 ) {
+               $this->svg = new Plugin_Geopattern_SVG();
+               $this->generateBackground();
+
+               // Work around a bug in 1.1.0: the hash-based pattern selection doesn't account for the size of the pattern array and can choose a null result.
+               $this->setGenerator( $this->patterns[$this->hexVal(20, 1) % count( $this->patterns )] );
+
+               $this->generatePattern();
+
+               #if ( $this->svg->getWidth() < $width || $this->svg->getHeight() < $height ) {
+                       $this->svg->setViewBox( 0, 0, $this->svg->getWidth(), $this->svg->getHeight() );
+               #}
+
+               if ( $this->text ) {
+                       $inner = $this->svg;
+
+                       // Outer SVG, containing the text and nested inner SVG.
+                       // Needed because of aspect ratio problems with the background pattern. The outer is square, inner may be a different shape.
+                       $this->svg = new PluginSVG();
+                       $this->svg->setWidth( $width );
+                       $this->svg->setHeight( $height );
+                       $this->svg->addNested( $inner );
+                       $this->generateText();
+               }
+
+               return $this->svg->getString();
+
+    }
+
+}
+
+// The base SVG class doesn't provide functions for getting dimensions, so..
+class Plugin_Geopattern_SVG extends \RedeyeVentures\GeoPattern\SVG {
+
+       protected $viewbox;
+
+       function getWidth() {
+               return $this->width;
+       }
+
+       function getHeight() {
+               return $this->height;
+       }
+
+    protected function getSvgHeader() {
+               if ( $this->viewbox )
+                       return "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{$this->width}\" height=\"{$this->height}\" viewbox=\"{$this->viewbox}\" preserveAspectRatio=\"none\">";
+               else
+                       return "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{$this->width}\" height=\"{$this->height}\">";
+    }
+
+    public function addText( $text, $x, $y, $text_anchor, $style, $args=array() ) {
+        $element = new Plugin_Geopattern_SVGText($text, $x, $y, $text_anchor, $style, $args);
+        $this->svgString .= $element;
+        return $this;
+       }
+
+       public function addNested( $svg ) {
+               if ( method_exists( $svg, 'getString' ) )
+                       $this->svgString .= $svg->getString();
+       }
+
+       public function setViewBox( $x, $y, $w, $h ) {
+               $this->viewbox = esc_attr( "$x $y $w $h" );
+       }
+
+}
+
+// Nor does it support text.
+class Plugin_Geopattern_SVGText extends \RedeyeVentures\GeoPattern\SVGElements\Base {
+       protected $tag = 'text';
+       protected $text;
+
+       function __construct($text, $x, $y, $text_anchor, $style, $args=array()) {
+               $this->elements = array( 
+                       'x' => $x,
+                       'y' => $y,
+                       'text-anchor' => $text_anchor,
+                       'style' => $style,
+                       );
+               $this->text = esc_html( $text );
+               parent::__construct($args);
+       }
+
+       public function getString() {
+               return "<{$this->tag}{$this->elementsToString()}{$this->argsToString()}>{$this->text}</{$this->tag}>";
+       }
+}
+
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstemplatephpfromrev2561sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytemplatephp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php (from rev 2561, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php                              (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php        2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,264 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory;
+
+/**
+ * Various helpers to retrieve data not stored within WordPress.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Template {
+
+       /**
+        * @param string $plugin_slug
+        * @return int
+        */
+       static function get_active_installs_count( $plugin_slug ) {
+               if ( false === ( $count = wp_cache_get( $plugin_slug, 'plugin_active_installs' ) ) ) {
+                       global $wpdb;
+
+                       $count = (int) $wpdb->get_var( $wpdb->prepare(
+                               "SELECT count FROM rev2_daily_stat_summary WHERE type = 'plugin' AND type_name = %s AND stat = 'active_installs' LIMIT 1",
+                               $plugin_slug
+                       ) );
+                       wp_cache_add( $plugin_slug, $count, 'plugin_active_installs', 1200 );
+               }
+
+               if ( $count < 10 ) {
+                       return 0;
+               }
+
+               if ( $count >= 1000000 ) {
+                       return 1000000;
+               }
+
+               return strval( $count )[0] * pow( 10, floor( log10( $count ) ) );
+       }
+
+       /**
+        * @return int
+        */
+       static function get_total_downloads() {
+               if ( false === ( $count = wp_cache_get( 'plugin_download_count', 'plugin_download_count' ) ) ) {
+                       global $wpdb;
+
+                       $count = $wpdb->get_var( "SELECT SUM(downloads) FROM `plugin_2_stats`" );
+                       wp_cache_add( 'plugin_download_count', $count, 'plugin_download_count', DAY_IN_SECONDS );
+               }
+
+               return (int) $count;
+       }
+
+       /**
+        * @return array
+        */
+       static function get_plugin_sections() {
+               $plugin       = get_post();
+               $plugin_slug  = $plugin->post_name;
+
+               $default_sections = array(
+                       'description',
+                       'screenshots',
+                       'stats',
+                       'support',
+                       'reviews',
+                       'developers',
+               );
+               if ( ! get_post_meta( $plugin->ID, 'screenshots', true ) && ! get_post_meta( $plugin->ID, 'assets_screenshots', true ) ) {
+                       unset( $default_sections[ array_search( 'screenshots', $default_sections ) ] );
+               }
+
+               $raw_sections = get_post_meta( $plugin->ID, 'sections', true );
+               $raw_sections = array_unique( array_merge( $raw_sections, $default_sections ) );
+
+               $sections  = array();
+               $title     = '';
+               $permalink = get_permalink();
+
+               foreach ( $raw_sections as $section_slug ) {
+                       switch ( $section_slug ) {
+
+                               case 'description':
+                                       $title = _x( 'Description', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = $permalink;
+                                       break;
+
+                               case 'installation':
+                                       $title = _x( 'Installation', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
+                                       break;
+
+                               case 'faq':
+                                       $title = _x( 'FAQ', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
+                                       break;
+
+                               case 'screenshots':
+                                       $title = _x( 'Screenshots', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
+                                       break;
+
+                               case 'changelog':
+                                       $title = _x( 'Changelog', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
+                                       break;
+
+                               case 'stats':
+                                       $title = _x( 'Stats', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
+                                       break;
+
+                               case 'support':
+                                       $title = _x( 'Support', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = 'https://wordpress.org/support/plugin/' . $plugin_slug;
+                                       break;
+
+                               case 'reviews':
+                                       $title = _x( 'Reviews', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = 'https://wordpress.org/support/view/plugin-reviews/' . $plugin_slug;
+                                       break;
+
+                               case 'developers':
+                                       $title = _x( 'Developers', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $permalink ) . '/' . $section_slug . '/';
+                                       break;
+
+                               case 'other_notes':
+                                       $title = _x( 'Other Notes', 'plugin tab title', 'wporg-plugins' );
+                                       $url   = trailingslashit( $permalink ) . '/' . $section_slug . '/';
+                                       break;
+
+                               default:
+                                       continue;
+                       }
+
+                       $sections[] = array(
+                               'slug'  => $section_slug,
+                               'url'   => $url,
+                               'title' => $title,
+                       );
+               }
+
+               return $sections;
+       }
+
+       /**
+        * Retrieve the Plugin Icon details for a plugin.
+        *
+        * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
+        * @return mixed
+        */
+       static function get_plugin_icon( $plugin, $output = 'raw' ) {
+               $plugin = Plugin_Directory::instance()->get_plugin_post( $plugin );
+               if ( ! $plugin ) {
+                       return false;
+               }
+               $plugin_slug = $plugin->post_name;
+
+               $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true );
+
+               $icon = $icon_2x = $vector = $generated = false;
+               foreach ( $raw_icons as $file => $info ) {
+                       switch ( $info['resolution'] ) {
+                               case '256x256':
+                                       $icon_2x = self::get_asset_url( $plugin_slug, $info );
+                                       break;
+                               case '128x128':
+                                       $icon = self::get_asset_url( $plugin_slug, $info );
+                                       break;
+                               case false && 'icon.svg' == $file:
+                                       $icon = self::get_asset_url( $plugin_slug, $info );
+                                       $vector = true;
+                                       break;
+                       }
+               }
+
+               if ( ! $icon ) {
+                       $generated = true;
+
+                       $icon = new Plugin_Geopattern;
+                       $icon->setString( $plugin->post_name );
+
+                       // Use the average color of the first known banner as the icon background color
+                       if ( $color = get_post_meta( $plugin->ID, 'assets_banners_color', true ) ) {
+                               if ( strlen( $color ) == 6 && strspn( $color, 'abcdef0123456789' ) == 6 ) {
+                                       $icon->setColor( '#' . $color );
+                               }
+                       }
+
+                       $icon = $icon->toDataURI();
+               }
+
+               switch ( $output ) {
+                       case 'html':
+                               $id = "plugin-icon-{$plugin_slug}";
+                               $html = "<style type='text/css'>";
+                               $html .= "#{$id} { width:128px; height:128px; background-image: url('{$icon}'); background-size:128px 128px; }";
+                               if ( ! empty( $icon_2x ) && ! $generated ) {
+                                       $html .= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5) { #{$id} { background-image: url('{$icon_2x}'); } }";
+                               }
+                               $html .= "</style>";
+                               $html .= "<div class='plugin-icon' id='{$id}'></div>";
+
+                               return $html;
+                               break;
+                       case 'raw':
+                       default:
+                               return compact( 'icon', 'icon_2x', 'vector', 'generated' );
+               }
+       }
+
+       /**
+        * Retrieve the Plugin Icon details for a plugin.
+        *
+        * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
+        * @return mixed
+        */
+       static function get_plugin_banner( $plugin, $output = 'raw' ) {
+               $plugin = Plugin_Directory::instance()->get_plugin_post( $plugin );
+               if ( ! $plugin ) {
+                       return false;
+               }
+               $plugin_slug = $plugin->post_name;
+
+               $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true );
+
+               $banner = $banner_2x = false;
+               foreach ( $raw_banners as $file => $info ) {
+                       switch ( $info['resolution'] ) {
+                               case '1544x500':
+                                       $banner_2x = self::get_asset_url( $plugin_slug, $info );
+                                       break;
+                               case '772x250':
+                                       $banner = self::get_asset_url( $plugin_slug, $info );
+                                       break;
+                       }
+               }
+
+               if ( ! $banner ) {
+                       return false;
+               }
+
+               switch ( $output ) {
+                       case 'raw':
+                       default:
+                               return compact( 'banner', 'banner_2x' );
+               }
+       }
+
+       static function get_asset_url( $plugin, $asset ) {
+               if ( ! empty( $asset['location'] ) && 'plugin' == $asset['location'] ) {
+                       // Screenshots in the plugin folder - /plugins/plugin-name/screenshot-1.png
+                       $format = 'https://s.w.org/plugins/%s/%s?rev=%s';
+               } else {
+                       // Images in the assets folder - /plugin-name/assets/screenshot-1.png
+                       $format = 'https://ps.w.org/%s/assets/%s?rev=%s';
+               }
+
+               return esc_url( sprintf(
+                       $format,
+                       $plugin,
+                       $asset['filename'],
+                       $asset['revision']
+               ) );
+       }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasstoolsphpfromrev2562sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytoolsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php (from rev 2562, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php                         (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php   2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,129 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory;
+
+/**
+ * Various functions used by other processes, will make sense to move to specific classes.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Tools {
+
+       /**
+        * @param string $readme
+        * @return object
+        */
+       static function get_readme_data( $readme ) {
+
+               // Uses https://github.com/rmccue/WordPress-Readme-Parser (with modifications)
+               include_once __DIR__ . '/readme-parser/markdown.php';
+               include_once __DIR__ . '/readme-parser/compat.php';
+
+               $data = (object) \WPorg_Readme::parse_readme( $readme );
+
+               unset( $data->sections['screenshots'] ); // Useless.
+
+               // Sanitize contributors.
+               foreach ( $data->contributors as $i => $name ) {
+                       if ( get_user_by( 'login', $name ) ) {
+                               continue;
+                       } elseif ( false !== ( $user = get_user_by( 'slug', $name ) ) ) {
+                               $data->contributors[] = $user->user_login;
+                               unset( $data->contributors[ $i ] );
+                       } else {
+                               unset( $data->contributors[ $i ] );
+                       }
+               }
+
+               return $data;
+       }
+
+       /**
+        * Retrieve the average color of a specified image.
+        * This currently relies upon the Jetpack libraries.
+        *
+        * @param $file_location string URL or filepath of image
+        * @return string|bool Average color as a hex value, False on failure
+        */
+       static function get_image_average_color( $file_location ) {
+               if ( ! class_exists( 'Tonesque' ) && function_exists( 'jetpack_require_lib' ) ) {
+                       jetpack_require_lib( 'tonesque' );
+               }
+               if ( ! class_exists( 'Tonesque' ) ) {
+                       return false;
+               }
+
+               $tonesque = new \Tonesque( $file_location );
+               return $tonesque->color();
+       }
+
+       /**
+        * Retrieve a list of users who have commit to a specific plugin.
+        *
+        * @param string $plugin_slug The plugin slug.
+        * @return array The list of user_login's which have commit.
+        */
+       public static function get_plugin_committers( $plugin_slug ) {
+               global $wpdb;
+
+               return $wpdb->get_col( $wpdb->prepare( 'SELECT user FROM `' . PLUGINS_TABLE_PREFIX . 'svn_access' . '` WHERE path = %s', "/{$plugin_slug}" ) );
+       }
+
+       /**
+        * Grant a user RW access to a plugin.
+        *
+        * @param string         $plugin_slug The plugin slug.
+        * @param string|WP_User $user        The user to grant access to.
+        */
+       public static function grant_plugin_committer( $plugin_slug, $user ) {
+               global $wpdb;
+               if ( ! $user instanceof \WP_User ) {
+                       $user = new \WP_User( $user );
+               }
+
+               if ( ! $user->exists() || ! Plugin_Directory::instance()->get_plugin_post( $plugin_slug ) ) {
+                       return false;
+               }
+
+               $existing_committers = wp_list_pluck( self::get_plugin_committers( $plugin_slug ), 'user_login' );
+               if ( in_array( $user->user_login, $existing_committers, true ) ) {
+                       // User already has write access
+                       return true;
+               }
+
+               return (bool)$wpdb->insert(
+                       PLUGINS_TABLE_PREFIX . 'svn_access',
+                       array(
+                               'path'   => "/{$plugin_slug}",
+                               'user'   => $user->user_login,
+                               'access' => 'rw'
+                       )
+               );
+       }
+
+       /**
+        * Revoke a users RW access to a plugin.
+        *
+        * @param string         $plugin_slug The plugin slug.
+        * @param string|WP_User $user        The user to revoke access of.
+        */
+       public static function revoke_plugin_committer( $plugin_slug, $user ) {
+               global $wpdb;
+               if ( ! $user instanceof \WP_User ) {
+                       $user = new \WP_User( $user );
+               }
+
+               if ( ! $user->exists() || ! Plugin_Directory::instance()->get_plugin_post( $plugin_slug ) ) {
+                       return false;
+               }
+
+               return $wpdb->delete(
+                       PLUGINS_TABLE_PREFIX . 'svn_access',
+                       array(
+                               'path'   => "/{$plugin_slug}",
+                               'user'   => $user->user_login
+                       )
+               );
+       }
+
+
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytemplatephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php       2016-02-25 01:57:40 UTC (rev 2610)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-template.php 2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,260 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * @package WPorg_Plugin_Directory
- */
-
-/**
- * Various helpers to retrieve data not stored within WordPress.
- */
-class WPorg_Plugin_Directory_Template {
-
-       /**
-        * @param string $plugin_slug
-        * @return int
-        */
-       static function get_active_installs_count( $plugin_slug ) {
-               if ( false === ( $count = wp_cache_get( $plugin_slug, 'plugin_active_installs' ) ) ) {
-                       global $wpdb;
-
-                       $count = (int) $wpdb->get_var( $wpdb->prepare(
-                               "SELECT count FROM rev2_daily_stat_summary WHERE type = 'plugin' AND type_name = %s AND stat = 'active_installs' LIMIT 1",
-                               $plugin_slug
-                       ) );
-                       wp_cache_add( $plugin_slug, $count, 'plugin_active_installs', 1200 );
-               }
-
-               if ( $count < 10 ) {
-                       return 0;
-               }
-
-               if ( $count >= 1000000 ) {
-                       return 1000000;
-               }
-
-               return strval( $count )[0] * pow( 10, floor( log10( $count ) ) );
-       }
-
-       /**
-        * @return int
-        */
-       static function get_total_downloads() {
-               if ( false === ( $count = wp_cache_get( 'plugin_download_count', 'plugin_download_count' ) ) ) {
-                       global $wpdb;
-
-                       $count = $wpdb->get_var( "SELECT SUM(downloads) FROM `plugin_2_stats`" );
-                       wp_cache_add( 'plugin_download_count', $count, 'plugin_download_count', DAY_IN_SECONDS );
-               }
-
-               return (int) $count;
-       }
-
-       /**
-        * @return array
-        */
-       static function get_plugin_sections() {
-               $plugin       = get_post();
-               $plugin_slug  = $plugin->post_name;
-
-               $default_sections = array(
-                       'description',
-                       'screenshots',
-                       'stats',
-                       'support',
-                       'reviews',
-                       'developers',
-               );
-               if ( ! get_post_meta( $plugin->ID, 'screenshots', true ) && ! get_post_meta( $plugin->ID, 'assets_screenshots', true ) ) {
-                       unset( $default_sections[ array_search( 'screenshots', $default_sections ) ] );
-               }
-
-               $raw_sections = get_post_meta( $plugin->ID, 'sections', true );
-               $raw_sections = array_unique( array_merge( $raw_sections, $default_sections ) );
-
-               $sections  = array();
-               $title     = '';
-               $permalink = get_permalink();
-
-               foreach ( $raw_sections as $section_slug ) {
-                       switch ( $section_slug ) {
-
-                               case 'description':
-                                       $title = _x( 'Description', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = $permalink;
-                                       break;
-
-                               case 'installation':
-                                       $title = _x( 'Installation', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
-                                       break;
-
-                               case 'faq':
-                                       $title = _x( 'FAQ', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
-                                       break;
-
-                               case 'screenshots':
-                                       $title = _x( 'Screenshots', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
-                                       break;
-
-                               case 'changelog':
-                                       $title = _x( 'Changelog', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
-                                       break;
-
-                               case 'stats':
-                                       $title = _x( 'Stats', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = trailingslashit( $permalink ) . $section_slug . '/';
-                                       break;
-
-                               case 'support':
-                                       $title = _x( 'Support', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = 'https://wordpress.org/support/plugin/' . $plugin_slug;
-                                       break;
-
-                               case 'reviews':
-                                       $title = _x( 'Reviews', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = 'https://wordpress.org/support/view/plugin-reviews/' . $plugin_slug;
-                                       break;
-
-                               case 'developers':
-                                       $title = _x( 'Developers', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = trailingslashit( $permalink ) . '/' . $section_slug . '/';
-                                       break;
-
-                               case 'other_notes':
-                                       $title = _x( 'Other Notes', 'plugin tab title', 'wporg-plugins' );
-                                       $url   = trailingslashit( $permalink ) . '/' . $section_slug . '/';
-                                       break;
-
-                               default:
-                                       continue;
-                       }
-
-                       $sections[] = array(
-                               'slug'  => $section_slug,
-                               'url'   => $url,
-                               'title' => $title,
-                       );
-               }
-
-               return $sections;
-       }
-
-       /**
-        * Retrieve the Plugin Icon details for a plugin.
-        *
-        * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
-        * @return mixed
-        */
-       static function get_plugin_icon( $plugin, $output = 'raw' ) {
-               global $wporg_plugin_directory;
-               $plugin = $wporg_plugin_directory->get_plugin_post( $plugin );
-               if ( ! $plugin ) {
-                       return false;
-               }
-               $plugin_slug = $plugin->post_name;
-
-               $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true );
-
-               $icon = $icon_2x = $vector = $generated = false;
-               foreach ( $raw_icons as $file => $info ) {
-                       switch ( $info['resolution'] ) {
-                               case '256x256':
-                                       $icon_2x = self::get_asset_url( $plugin_slug, $info );
-                                       break;
-                               case '128x128':
-                                       $icon = self::get_asset_url( $plugin_slug, $info );
-                                       break;
-                               case false && 'icon.svg' == $file:
-                                       $icon = self::get_asset_url( $plugin_slug, $info );
-                                       $vector = true;
-                                       break;
-                       }
-               }
-
-               if ( ! $icon ) {
-                       $generated = true;
-                       if ( ! class_exists( 'WPorg_Plugin_Geopattern' ) ) {
-                               include __DIR__ . '/class-wporg-plugin-geopattern.php';
-                       }
-                       $icon = new WPorg_Plugin_Geopattern;
-                       $icon->setString( $plugin->post_name );
-
-                       // Use the average color of the first known banner as the icon background color
-                       if ( $color = get_post_meta( $plugin->ID, 'assets_banners_color', true ) ) {
-                               if ( strlen( $color ) == 6 && strspn( $color, 'abcdef0123456789' ) == 6 ) {
-                                       $icon->setColor( '#' . $color );
-                               }
-                       }
-
-                       $icon = $icon->toDataURI();
-               }
-
-               switch ( $output ) {
-                       case 'html':
-                               $id = "plugin-icon-{$plugin_slug}";
-                               $html = "<style type='text/css'>";
-                               $html .= "#{$id} { width:128px; height:128px; background-image: url('{$icon}'); background-size:128px 128px; }";
-                               if ( ! empty( $icon_2x ) && ! $generated ) {
-                                       $html .= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5) { #{$id} { background-image: url('{$icon_2x}'); } }";
-                               }
-                               $html .= "</style>";
-                               $html .= "<div class='plugin-icon' id='{$id}'></div>";
-
-                               return $html;
-                               break;
-                       case 'raw':
-                       default:
-                               return compact( 'icon', 'icon_2x', 'vector', 'generated' );
-               }
-       }
-
-       /**
-        * Retrieve the Plugin Icon details for a plugin.
-        *
-        * @param WP_Post|string $plugin An instance of a Plugin post, or the plugin slug.
-        * @return mixed
-        */
-       static function get_plugin_banner( $plugin, $output = 'raw' ) {
-               global $wporg_plugin_directory;
-               $plugin = $wporg_plugin_directory->get_plugin_post( $plugin );
-               if ( ! $plugin ) {
-                       return false;
-               }
-               $plugin_slug = $plugin->post_name;
-
-               $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true );
-
-               $banner = $banner_2x = false;
-               foreach ( $raw_banners as $file => $info ) {
-                       switch ( $info['resolution'] ) {
-                               case '1544x500':
-                                       $banner_2x = self::get_asset_url( $plugin_slug, $info );
-                                       break;
-                               case '772x250':
-                                       $banner = self::get_asset_url( $plugin_slug, $info );
-                                       break;
-                       }
-               }
-
-               if ( ! $banner ) {
-                       return false;
-               }
-
-               switch ( $output ) {
-                       case 'raw':
-                       default:
-                               return compact( 'banner', 'banner_2x' );
-               }
-       }
-
-       static function get_asset_url( $plugin, $asset ) {
-               return esc_url( sprintf(
-                       'https://ps.w.org/%s/assets/%s?rev=%s',
-                       $plugin,
-                       $asset['filename'],
-                       $asset['revision']
-               ) );
-       }
-}
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectorytoolsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php  2016-02-25 01:57:40 UTC (rev 2610)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php    2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,129 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * @package WPorg_Plugin_Directory
- */
-
-/**
- * Various functions used by other processes, will make sense to move to specific classes.
- */
-class WPorg_Plugin_Directory_Tools {
-
-       /**
-        * @param string $readme
-        * @return object
-        */
-       static function get_readme_data( $readme ) {
-
-               // Uses https://github.com/rmccue/WordPress-Readme-Parser (with modifications)
-               include_once __DIR__ . '/readme-parser/markdown.php';
-               include_once __DIR__ . '/readme-parser/compat.php';
-
-               $data = (object) WPorg_Readme::parse_readme( $readme );
-
-               unset( $data->sections['screenshots'] ); // Useless.
-
-               // Sanitize contributors.
-               foreach ( $data->contributors as $i => $name ) {
-                       if ( get_user_by( 'login', $name ) ) {
-                               continue;
-                       } elseif ( false !== ( $user = get_user_by( 'slug', $name ) ) ) {
-                               $data->contributors[] = $user->user_login;
-                               unset( $data->contributors[ $i ] );
-                       } else {
-                               unset( $data->contributors[ $i ] );
-                       }
-               }
-
-               return $data;
-       }
-
-       /**
-        * Retrieve the average color of a specified image.
-        * This currently relies upon the Jetpack libraries.
-        *
-        * @param $file_location string URL or filepath of image
-        * @return string|bool Average color as a hex value, False on failure
-        */
-       static function get_image_average_color( $file_location ) {
-               if ( ! class_exists( 'Tonesque' ) && function_exists( 'jetpack_require_lib' ) ) {
-                       jetpack_require_lib( 'tonesque' );
-               }
-               if ( ! class_exists( 'Tonesque' ) ) {
-                       return false;
-               }
-
-               $tonesque = new Tonesque( $file_location );
-               return $tonesque->color();
-       }
-
-       /**
-        * Retrieve a list of users who have commit to a specific plugin.
-        *
-        * @param string $plugin_slug The plugin slug.
-        * @return array The list of user_login's which have commit.
-        */
-       public static function get_plugin_committers( $plugin_slug ) {
-               global $wpdb;
-
-               return $wpdb->get_col( $wpdb->prepare( 'SELECT user FROM `' . PLUGINS_TABLE_PREFIX . 'svn_access' . '` WHERE path = %s', "/{$plugin_slug}" ) );
-       }
-
-       /**
-        * Grant a user RW access to a plugin.
-        *
-        * @param string         $plugin_slug The plugin slug.
-        * @param string|WP_User $user        The user to grant access to.
-        */
-       public static function grant_plugin_committer( $plugin_slug, $user ) {
-               global $wpdb, $wporg_plugin_directory;
-               if ( ! $user instanceof WP_User ) {
-                       $user = new WP_User( $user );
-               }
-
-               if ( ! $user->exists() || ! $wporg_plugin_directory->get_plugin_post( $plugin_slug ) ) {
-                       return false;
-               }
-
-               $existing_committers = wp_list_pluck( self::get_plugin_committers( $plugin_slug ), 'user_login' );
-               if ( in_array( $user->user_login, $existing_committers, true ) ) {
-                       // User already has write access
-                       return true;
-               }
-
-               return (bool)$wpdb->insert(
-                       PLUGINS_TABLE_PREFIX . 'svn_access',
-                       array(
-                               'path'   => "/{$plugin_slug}",
-                               'user'   => $user->user_login,
-                               'access' => 'rw'
-                       )
-               );
-       }
-
-       /**
-        * Revoke a users RW access to a plugin.
-        *
-        * @param string         $plugin_slug The plugin slug.
-        * @param string|WP_User $user        The user to revoke access of.
-        */
-       public static function revoke_plugin_committer( $plugin_slug, $user ) {
-               global $wpdb, $wporg_plugin_directory;
-               if ( ! $user instanceof WP_User ) {
-                       $user = new WP_User( $user );
-               }
-
-               if ( ! $user->exists() || ! $wporg_plugin_directory->get_plugin_post( $plugin_slug ) ) {
-                       return false;
-               }
-
-               return $wpdb->delete(
-                       PLUGINS_TABLE_PREFIX . 'svn_access',
-                       array(
-                               'path'   => "/{$plugin_slug}",
-                               'user'   => $user->user_login
-                       )
-               );
-       }
-
-
-}
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugindirectoryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php        2016-02-25 01:57:40 UTC (rev 2610)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory.php  2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,361 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * @package WPorg_Plugin_Directory
- */
-
-/**
- * Class WPorg_Plugin_Directory
- */
-class WPorg_Plugin_Directory {
-
-       /**
-        * Constructor.
-        */
-       public function __construct() {
-               add_action( 'init', array( $this, 'init' ) );
-               add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 );
-               add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ) );
-               add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
-               add_filter( 'the_content', array( $this, 'filter_post_content_to_correct_page' ), 1 );
-       }
-
-       /**
-        * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
-        */
-       public function activate() {
-               global $wp_rewrite;
-
-               // Setup the environment.
-               $this->init();
-
-               // %postname% is required.
-               $wp_rewrite->set_permalink_structure( '/%postname%/' );
-
-               // /tags/%slug% is required for tags.
-               $wp_rewrite->set_tag_base( '/tags' );
-
-               // We require the WordPress.org Ratings plugin also be active.
-               if ( ! is_plugin_active( 'wporg-ratings/wporg-ratings.php' ) ) {
-                       activate_plugin( 'wporg-ratings/wporg-ratings.php' );
-               }
-
-               // Enable the WordPress.org Plugin Repo Theme.
-               foreach ( wp_get_themes() as $theme ) {
-                       if ( $theme->get( 'Name' ) === 'WordPress.org Plugins' ) {
-                               switch_theme( $theme->get_stylesheet() );
-                               break;
-                       }
-               }
-
-               flush_rewrite_rules();
-
-               do_action( 'wporg_plugins_activation' );
-       }
-
-       /**
-        *
-        */
-       public function deactivate() {
-               flush_rewrite_rules();
-
-               do_action( 'wporg_plugins_deactivation' );
-       }
-
-       /**
-        * Set up the Plugin Directory.
-        */
-       public function init() {
-               load_plugin_textdomain( 'wporg-plugins' );
-
-               register_post_type( 'plugin', array(
-                       'labels'      => array(
-                               'name'               => __( 'Plugins',          'wporg-plugins' ),
-                               'singular_name'      => __( 'Plugin',           'wporg-plugins' ),
-                               'menu_name'          => __( 'My Plugins',       'wporg-plugins' ),
-                               'add_new'            => __( 'Add New',          'wporg-plugins' ),
-                               'add_new_item'       => __( 'Add New Plugin',   'wporg-plugins' ),
-                               'edit_item'          => __( 'Edit Plugin',      'wporg-plugins' ),
-                               'new_item'           => __( 'New Plugin',       'wporg-plugins' ),
-                               'view_item'          => __( 'View Plugin',      'wporg-plugins' ),
-                               'search_items'       => __( 'Search Plugins',   'wporg-plugins' ),
-                               'not_found'          => __( 'No plugins found', 'wporg-plugins' ),
-                               'not_found_in_trash' => __( 'No plugins found in Trash', 'wporg-plugins' ),
-                       ),
-                       'description' => __( 'A Repo Plugin', 'wporg-plugins' ),
-                       'supports'    => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
-                       'taxonomies'  => array( 'post_tag', 'category' ),
-                       'public'      => true,
-                       'show_ui'     => true,
-                       'has_archive' => true,
-                       'rewrite'     => false,
-                       'menu_icon'   => 'dashicons-admin-plugins',
-               ) );
-
-               register_post_status( 'pending', array(
-                       'label'                     => _x( 'Pending', 'plugin status', 'wporg-plugins' ),
-                       'public'                    => false,
-                       'show_in_admin_status_list' => true,
-                       'label_count'               => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'wporg-plugins' ),
-               ) );
-               register_post_status( 'disabled', array(
-                       'label'                     => _x( 'Disabled', 'plugin status', 'wporg-plugins' ),
-                       'public'                    => false,
-                       'show_in_admin_status_list' => true,
-                       'label_count'               => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ),
-               ) );
-               register_post_status( 'closed', array(
-                       'label'                     => _x( 'Closed', 'plugin status', 'wporg-plugins' ),
-                       'public'                    => false,
-                       'show_in_admin_status_list' => true,
-                       'label_count'               => _n_noop( 'Closed <span class="count">(%s)</span>', 'Closed <span class="count">(%s)</span>', 'wporg-plugins' ),
-               ) );
-
-               // Add the browse/* views.
-               add_rewrite_tag( '%browse%', '(featured|popular|beta|new|favorites)' );
-               add_permastruct( 'browse', 'browse/%browse%' );
-
-               add_rewrite_endpoint( 'installation', EP_PERMALINK );
-               add_rewrite_endpoint( 'faq',          EP_PERMALINK );
-               add_rewrite_endpoint( 'screenshots',  EP_PERMALINK );
-               add_rewrite_endpoint( 'changelog',    EP_PERMALINK );
-               add_rewrite_endpoint( 'stats',        EP_PERMALINK );
-               add_rewrite_endpoint( 'developers',   EP_PERMALINK );
-               add_rewrite_endpoint( 'other_notes',  EP_PERMALINK );
-
-               // When this plugin is used in the context of a Rosetta site, handle it gracefully
-               if ( 'wordpress.org' != $_SERVER['HTTP_HOST'] && defined( 'WPORG_PLUGIN_DIRECTORY_BLOGID' ) ) {
-                       $this->add_rosetta_network_filters();        
-               }
-       }
-
-       /**
-        * The Plugin Directory is available at multiple URLs (internationalised domains), this method allows
-        * for the one blog (a single blog_id) to be presented at multiple URLs yet have correct localised links.
-        */
-       public function add_rosetta_network_filters() {
-               // Filter the URLs to use the current localised domain name, rather than WordPress.org.
-               foreach ( array( 'option_home', 'option_siteurl' ) as $filter ) {
-                       add_filter( $filter, function( $url ) {
-                               static $localized_url = null;
-                               if ( is_null( $localized_url ) ) {
-                                       $localized_url = 'https://' . preg_replace( '![^a-z.-]+!', '', $_SERVER['HTTP_HOST'] );
-                               }
-
-                               return preg_replace( '!^[https]+://wordpress\.org!i', $localized_url, $url );
-                       } );
-               }
-
-               /*
-               // This method works in conjuction with a filter in sunrise.php, duplicated here for transparency:
-
-               // Make the Plugin Directory available at /plugins/ on all rosetta sites.
-               function wporg_plugins_on_rosetta_domains( $site, $domain, $path, $segments ) {
-                       // All non-rosetta networks define DOMAIN_CURRENT_SITE in wp-config.php
-                       if ( ! defined( 'DOMAIN_CURRENT_SITE' ) && 'wordpress.org' != $domain && '/plugins/' == substr( $path . '/', 0, 9 ) ) {
-                               $site = get_blog_details( WPORG_PLUGIN_DIRECTORY_BLOGID );
-                               if ( $site ) {
-                                       $site = clone $site;
-                                       // 6 = The Rosetta network, this causes the site to be loaded as part of the Rosetta network
-                                       $site->site_id = 6;
-                                       return $site;
-                               }
-                       }
-               
-                       return $site;
-               }
-               add_filter( 'pre_get_site_by_path', 'wporg_plugins_on_rosetta_domains', 10, 4 );
-               */
-       }
-
-       /**
-        * Filter the permalink for the Plugins to be /plugin-name/.
-        *
-        * @param string  $link The generated permalink.
-        * @param WP_Post $post The Plugin post object.
-        * @return string
-        */
-       public function package_link( $link, $post ) {
-               if ( 'plugin' !== $post->post_type ) {
-                       return $link;
-               }
-
-               return trailingslashit( home_url( $post->post_name ) );
-       }
-
-       /**
-        * Checks if the current users is a super admin before allowing terms to be added.
-        *
-        * @param string $term The term to add or update.
-        * @return string|WP_Error The term to add or update or WP_Error on failure.
-        */
-       public function pre_insert_term_prevent( $term ) {
-               if ( ! is_super_admin() ) {
-                       $term = new WP_Error( 'not-allowed', __( 'You are not allowed to add terms.', 'wporg-plugins' ) );
-               }
-
-               return $term;
-       }
-
-       /**
-        * @param WP_Query $wp_query The WordPress Query object.
-        */
-       public function use_plugins_in_query( $wp_query ) {
-               if ( ! $wp_query->is_main_query() ) {
-                       return;
-               }
-
-               if ( empty( $wp_query->query_vars['pagename'] ) && ( empty( $wp_query->query_vars['post_type'] ) || 'posts' == $wp_query->query_vars['post_type'] ) ) {
-                       $wp_query->query_vars['post_type'] = array( 'plugin' );
-               }
-
-               if ( empty( $wp_query->query ) ) {
-                       $wp_query->query_vars['browse'] = 'featured';
-               }
-
-               switch ( get_query_var( 'browse' ) ) {
-                       case 'beta':
-                               $wp_query->query_vars['category_name'] = 'beta';
-                               break;
-
-                       case 'featured':
-                               $wp_query->query_vars['category_name'] = 'featured';
-                               break;
-
-                       case 'favorites':
-                               break;
-
-                       case 'popular':
-                               break;
-               }
-
-               // Re-route the Endpoints to the `content_page` query var.
-               if ( ! empty( $wp_query->query['name'] ) ) {
-                       $plugin_fields = array(
-                               'installation',
-                               'faq',
-                               'screenshots',
-                               'changelog',
-                               'stats',
-                               'developers',
-                               'other_notes'
-                       );
-
-                       foreach ( $plugin_fields as $plugin_field ) {
-                               if ( isset( $wp_query->query[ $plugin_field ] ) ) {
-                                       $wp_query->query['content_page'] = $wp_query->query_vars['content_page'] = $plugin_field;
-                                       unset( $wp_query->query[ $plugin_field ], $wp_query->query_vars[ $plugin_field ] );
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Returns the requested page's content.
-        *
-        * @param string $content
-        * @return string
-        */
-       public function filter_post_content_to_correct_page( $content ) {
-               if ( 'plugin' === get_post()->post_type ) {
-                       $page = get_query_var( 'content_page' );
-
-                       $content_pages = $this->split_post_content_into_pages( $content );
-                       if ( ! isset( $content_pages[ $page ] ) ) {
-                               $page = 'description';
-                       }
-
-                       $content = $content_pages[ $page ];
-               }
-
-               return $content;
-       }
-
-       /**
-        * Returns an array of pages based on section comments in the content.
-        *
-        * @param string $content
-        * @return array
-        */
-       public function split_post_content_into_pages( $content ) {
-               $_pages = preg_split( "#<!--section=(.+?)-->#", $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
-               $content_pages = array(
-                       'screenshots' => '[wporg-plugins-screenshots]',
-                       'stats'       => '[wporg-plugins-stats]',
-                       'developers'  => '[wporg-plugins-developer]',
-               );
-
-               for ( $i = 0; $i < count( $_pages ); $i += 2 ) {
-
-                       // Don't overwrite existing tabs.
-                       if ( ! isset( $content_pages[ $_pages[ $i ] ] ) ) {
-                               $content_pages[ $_pages[ $i ] ] = $_pages[ $i + 1 ];
-                       }
-               }
-
-               return $content_pages;
-       }
-
-       /**
-        * Retrieve the WP_Post object representing a given plugin.
-        *
-        * @param $plugin_slug string|WP_Post The slug of the plugin to retrieve.
-        * @return WP_Post|WP_Error
-        */
-       public function get_plugin_post( $plugin_slug ) {
-               if ( $plugin_slug instanceof WP_Post ) {
-                       return $plugin_slug;
-               }
-
-               // get_post_by_slug();
-               $posts = get_posts( array(
-                       'post_type'   => 'plugin',
-                       'name'        => $plugin_slug,
-                       'post_status' => 'any'
-               ) );
-               if ( ! $posts ) {
-                       return false;
-               }
-
-               $plugin = reset( $posts );
-               return $plugin;
-       }
-
-       /**
-        * Create a new post entry for a given plugin slug.
-        *
-        * @param array $plugin_info {
-        *     Array of initial plugin post data, all fields are optional.
-        *
-        *     @type string $title       The title of the plugin.
-        *     @type string $slug        The slug of the plugin.
-        *     @type string $status      The status of the plugin ( 'publish', 'pending', 'disabled', 'closed' ).
-        *     @type int    $author      The ID of the plugin author.
-        *     @type string $description The short description of the plugin.
-        * }
-        * @return WP_Post|WP_Error
-        */
-       public function create_plugin_post( array $plugin_info ) {
-               $title  = !empty( $plugin_info['title'] )       ? $plugin_info['title']       : '';
-               $slug   = !empty( $plugin_info['slug'] )        ? $plugin_info['slug']        : sanitize_title( $title );
-               $status = !empty( $plugin_info['status'] )      ? $plugin_info['status']      : 'pending';
-               $author = !empty( $plugin_info['author'] )      ? $plugin_info['author']      : 0;
-               $desc   = !empty( $plugin_info['description'] ) ? $plugin_info['description'] : '';
-
-               $id = wp_insert_post( array(
-                       'post_type'    => 'plugin',
-                       'post_status'  => $status,
-                       'post_name'    => $slug,
-                       'post_title'   => $title ?: $slug,
-                       'post_author'  => $author,
-                       'post_content' => '',
-                       'post_excerpt' => $desc,
-               ), true );
-
-               if ( is_wp_error( $id ) ) {
-                       return $id;
-               }
-
-               $plugin = get_post( $id );
-               return $plugin;
-       }
-}
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasswporgplugingeopatternphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-geopattern.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-geopattern.php       2016-02-25 01:57:40 UTC (rev 2610)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-geopattern.php 2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,127 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-require __DIR__ . '/libs/geopattern-1.1.0/geopattern_loader.php';
-
-class WPorg_Plugin_Geopattern extends \RedeyeVentures\GeoPattern\GeoPattern {
-
-       var $slug; // Hashed to generate pattern
-       var $text; // Text to be overlaid
-       var $textcolor = 'black';
-
-       function __construct($options=array()) {
-               parent::__construct( $options );
-
-               if ( isset( $options['text'] ) )
-                       $this->text = $options['text'];
-
-               if ( isset( $options['textcolor'] ) )
-                       $this->textcolor = $options['textcolor'];
-
-               // Replace the base SVG object with our own, so the dimensions are gettable.
-               $this->svg = new WPorg_Plugin_Geopattern_SVG();
-       }
-
-       function setText( $text ) {
-               $this->text = $text;
-       }
-
-       function setTextColor( $color ) {
-               $this->textcolor = $color;
-       }
-
-       function generateText() {
-               $size = min( $this->svg->getHeight(), $this->svg->getWidth() );
-               $text_height = floor( $size * 0.8 ) . 'px';
-
-               $this->svg->addText( $this->text, '50%', $text_height, 'middle', "font-family: Times New Roman, serif; font-size: {$text_height}; font-weight: normal; fill: {$this->textcolor};" );
-       }
-
-       public function toSVG( $width = 128, $height = 128 ) {
-               $this->svg = new WPorg_Plugin_Geopattern_SVG();
-               $this->generateBackground();
-
-               // Work around a bug in 1.1.0: the hash-based pattern selection doesn't account for the size of the pattern array and can choose a null result.
-               $this->setGenerator( $this->patterns[$this->hexVal(20, 1) % count( $this->patterns )] );
-
-               $this->generatePattern();
-
-               #if ( $this->svg->getWidth() < $width || $this->svg->getHeight() < $height ) {
-                       $this->svg->setViewBox( 0, 0, $this->svg->getWidth(), $this->svg->getHeight() );
-               #}
-
-               if ( $this->text ) {
-                       $inner = $this->svg;
-
-                       // Outer SVG, containing the text and nested inner SVG.
-                       // Needed because of aspect ratio problems with the background pattern. The outer is square, inner may be a different shape.
-                       $this->svg = new PluginSVG();
-                       $this->svg->setWidth( $width );
-                       $this->svg->setHeight( $height );
-                       $this->svg->addNested( $inner );
-                       $this->generateText();
-               }
-
-               return $this->svg->getString();
-
-    }
-
-}
-
-// The base SVG class doesn't provide functions for getting dimensions, so..
-class WPorg_Plugin_Geopattern_SVG extends \RedeyeVentures\GeoPattern\SVG {
-
-       protected $viewbox;
-
-       function getWidth() {
-               return $this->width;
-       }
-
-       function getHeight() {
-               return $this->height;
-       }
-
-    protected function getSvgHeader() {
-               if ( $this->viewbox )
-                       return "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{$this->width}\" height=\"{$this->height}\" viewbox=\"{$this->viewbox}\" preserveAspectRatio=\"none\">";
-               else
-                       return "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"{$this->width}\" height=\"{$this->height}\">";
-    }
-
-    public function addText( $text, $x, $y, $text_anchor, $style, $args=array() ) {
-        $element = new WPorg_Plugin_Geopattern_SVGText($text, $x, $y, $text_anchor, $style, $args);
-        $this->svgString .= $element;
-        return $this;
-       }
-
-       public function addNested( $svg ) {
-               if ( method_exists( $svg, 'getString' ) )
-                       $this->svgString .= $svg->getString();
-       }
-
-       public function setViewBox( $x, $y, $w, $h ) {
-               $this->viewbox = esc_attr( "$x $y $w $h" );
-       }
-
-}
-
-// Nor does it support text.
-class WPorg_Plugin_Geopattern_SVGText extends \RedeyeVentures\GeoPattern\SVGElements\Base {
-       protected $tag = 'text';
-       protected $text;
-
-       function __construct($text, $x, $y, $text_anchor, $style, $args=array()) {
-               $this->elements = array( 
-                       'x' => $x,
-                       'y' => $y,
-                       'text-anchor' => $text_anchor,
-                       'style' => $style,
-                       );
-               $this->text = esc_html( $text );
-               parent::__construct($args);
-       }
-
-       public function getString() {
-               return "<{$this->tag}{$this->elementsToString()}{$this->argsToString()}>{$this->text}</{$this->tag}>";
-       }
-}
-
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryplugindirectoryphpfromrev2602sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectorywporgplugindirectoryphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php (from rev 2602, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/wporg-plugin-directory.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php                            (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/plugin-directory.php      2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory;
+/**
+ * Plugin Name: Plugin Directory
+ * Plugin URI: http://wordpress.org/plugins/
+ * Description: Transforms a WordPress site in The Official Plugin Directory.
+ * Version: 0.1
+ * Author: the WordPress team
+ * Author URI: https://wordpress.org/
+ * Text Domain: wporg-plugins
+ * License: GPLv2
+ * License URI: http://opensource.org/licenses/gpl-2.0.php
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+
+// Register an Autoloader for all files
+include __DIR__ . '/class-autoloader.php';
+Autoloader\register_class_path( __NAMESPACE__, __DIR__ );
+
+// Create the instance of the plugin, passing __FILE__ for actions that need it.
+include __DIR__ . '/class-plugin-directory.php';
+Plugin_Directory::instance( __FILE__ );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesclassscreenshotsphpfromrev2560sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesscreenshotsphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php (from rev 2560, sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/screenshots.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php                                (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php  2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,50 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+namespace WordPressdotorg\Plugin_Directory\Shortcodes;
+use WordPressdotorg\Plugin_Directory\Template;
+
+/**
+ * The [wporg-plugins-screenshots] shortcode handler to display a plugins screenshots.
+ *
+ * @package WordPressdotorg_Plugin_Directory
+ */
+class Screenshots {
+       static function display() {
+               $plugin = get_post();
+
+               // All indexed from 1
+               $screenshot_descriptions = get_post_meta( $plugin->ID, 'screenshots', true );
+               $assets_screenshots = get_post_meta( $plugin->ID, 'assets_screenshots', true );
+
+               $output = '';
+               foreach ( $screenshot_descriptions as $index => $description ) {
+                       // Find the image that corresponds with the text.
+                       // The image numbers are stored within the 'resolution' key.
+                       $found = false;
+                       foreach ( $assets_screenshots as $image ) {
+                               if ( $index == $image['resolution'] ) {
+                                       $found = true;
+                                       break;
+                               }
+                       }
+                       if ( ! $found ) {
+                               continue;
+                       }
+
+                       $url = Template::get_asset_url( $plugin->post_name, $image );
+
+                       $output .= sprintf(
+                               '<li>
+                                       <a href="%1$s" rel="nofollow">
+                                               <img class="screenshot" src="%1$s">
+                                       </a>
+                                       <p>%2$s</p>
+                               </li>',
+                               $url,
+                               $description
+                       );
+               }
+
+               return '<ol class="screenshots">' . $output . '</ol>';
+
+       }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryshortcodesscreenshotsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/screenshots.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/screenshots.php      2016-02-23 17:15:28 UTC (rev 2560)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/screenshots.php        2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,58 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-add_shortcode( 'wporg-plugins-screenshots', 'wporg_plugins_screenshots' );
-
-function wporg_plugins_screenshots() {
-       $plugin = get_post();
-
-       // All indexed from 1
-       $screenshot_descriptions = get_post_meta( $plugin->ID, 'screenshots', true );
-       $assets_screenshots = get_post_meta( $plugin->ID, 'assets_screenshots', true );
-
-       $output = '';
-       foreach ( $screenshot_descriptions as $index => $description ) {
-               // Find the image that corresponds with the text.
-               // The image numbers are stored within the 'resolution' key.
-               $found = false;
-               foreach ( $assets_screenshots as $image ) {
-                       if ( $index == $image['resolution'] ) {
-                               $found = true;
-                               break;
-                       }
-               }
-               if ( ! $found ) {
-                       continue;
-               }
-
-               if ( ! empty( $image['location'] ) && 'plugin' == $image['location'] ) {
-                       // Screenshot is within the plugin folder
-                       $url = sprintf(
-                               'https://s.w.org/plugins/%s/%s?rev=%s',
-                               $plugin->post_name,
-                               $image['filename'],
-                               $image['revision']
-                       );
-               } else {
-                       // In the /assets/ folder
-                       $url = sprintf(
-                               'https://ps.w.org/%s/assets/%s?rev=%s',
-                               $plugin->post_name,
-                               $image['filename'],
-                               $image['revision']
-                       );
-               }
-
-               $output .= sprintf(
-                       '<li>
-                               <a href="%1$s" rel="nofollow">
-                                       <img class="screenshot" src="%1$s">
-                               </a>
-                               <p>%2$s</p>
-                       </li>',
-                       $url,
-                       $description
-               );
-       }
-
-       return '<ol class="screenshots">' . $output . '</ol>';
-
-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectorywporgplugindirectoryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/wporg-plugin-directory.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/wporg-plugin-directory.php      2016-02-25 01:57:40 UTC (rev 2610)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/wporg-plugin-directory.php        2016-02-25 05:03:19 UTC (rev 2611)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,28 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Plugin Name: Plugin Directory
- * Plugin URI: http://wordpress.org/plugins/
- * Description: Transforms a WordPress site in The Official Plugin Directory.
- * Version: 0.1
- * Author: the WordPress team
- * Author URI: https://wordpress.org/
- * Text Domain: wporg-plugins
- * License: GPLv2
- * License URI: http://opensource.org/licenses/gpl-2.0.php
- *
- * @package WPorg_Plugin_Directory
- */
-
-include __DIR__ . '/class-wporg-plugin-directory.php';
-include __DIR__ . '/class-wporg-plugin-directory-template.php';
-include __DIR__ . '/class-wporg-plugin-directory-tools.php';
-
-include __DIR__ . '/shortcodes/screenshots.php';
-
-if ( is_admin() ) {
-       include __DIR__ . '/admin/class-wporg-plugin-directory-admin-metabox-committers.php';
-}
-
-$wporg_plugin_directory = new WPorg_Plugin_Directory();
-register_activation_hook( __FILE__, array( $wporg_plugin_directory, 'activate' ) );
-register_deactivation_hook( __FILE__, array( $wporg_plugin_directory, 'deactivate' ) );
</del></span></pre>
</div>
</div>

</body>
</html>