<!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>[4212] sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory: Plugin Directory: Remove wp-admin access and a bunch of code that's no longer needed.</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/4212">4212</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/4212","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-10-11 06:27:26 +0000 (Tue, 11 Oct 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: Remove wp-admin access and a bunch of code that's no longer needed.
See <a href="http://meta.trac.wordpress.org/ticket/2111">#2111</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscustomizationsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscontrolsphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasscapabilitiesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-capabilities.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_htmlwpcontentpluginsplugindirectorycliclassimportphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassplugincategoriesphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-plugin-categories.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminclasscustomizationsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-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-customizations.php 2016-10-10 20:23:04 UTC (rev 4211)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php 2016-10-11 06:27:26 UTC (rev 4212)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,7 +28,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'dashboard_glance_items', array( $this, 'plugin_glance_items' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'save_post_plugin', array( $this, 'save_plugin_post' ) );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'load-edit.php', array( $this, 'bulk_reject_plugins' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,10 +50,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_ajax_delete-committer', array( __NAMESPACE__ . '\Metabox\Committers', 'remove_committer' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_ajax_plugin-author-lookup', array( __NAMESPACE__ . '\Metabox\Author', 'lookup_author' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Page access within wp-admin.
- add_action( 'admin_menu', array( $this, 'admin_menu' ) );
- add_action( 'load-index.php', array( $this, 'disable_admin_page' ) );
- add_action( 'load-profile.php', array( $this, 'disable_admin_page' ) );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -127,44 +122,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Customizes the admin menu according to the current user's privileges.
- */
- public function admin_menu() {
-
- /*
- * WordPress requires that the plugin post_type have at least one submenu accessible *other* than itself.
- * If it doesn't have at least one submenu then users who cannot also publish posts will not be able to access the post type.
- */
- add_submenu_page( 'edit.php?post_type=plugin', 'Plugin Handbook', 'Plugin Handbook', 'read', 'handbook', function() {} );
-
- $readme_validator = Validator::instance();
- add_submenu_page( 'edit.php?post_type=plugin', 'Readme Validator', 'Readme Validator', 'read', 'readme_validator', array( $readme_validator, 'display' ) );
-
- if ( ! current_user_can( 'manage_options' ) ) {
- remove_menu_page( 'index.php' );
- remove_menu_page( 'profile.php' );
- }
- }
-
- /**
- * Disables admin pages.
- */
- public function disable_admin_page() {
- if ( ! current_user_can( 'manage_options' ) ) {
-
- // Dashboard is plugin dashboard.
- if ( 'load-index.php' === current_action() ) {
- wp_safe_redirect( admin_url( 'edit.php?post_type=plugin' ) );
- exit;
- }
-
- wp_die( __( 'You do not have permission to access this page.', 'wporg-plugins' ), '', array(
- 'back_link' => true,
- ) );
- }
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Filter the query in wp-admin to list only plugins relevant to the current user.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param \WP_Query $query
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -189,47 +146,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $user = wp_get_current_user();
-
- if ( ! current_user_can( 'plugin_approve' ) && empty( $query->query['post_status']) || ( isset( $query->query['author'] ) && $query->query['author'] == $user->ID ) ) {
- $query->query_vars['author'] = $user->ID;
-
- $plugins = Tools::get_users_write_access_plugins( $user );
- if ( $plugins ) {
- $query->query_vars['post_name__in'] = $plugins;
- $query->query_vars['post_status'] = 'any';
-
- add_filter( 'posts_where', array( $this, 'pre_get_posts_sql_name_or_user' ) );
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Custom callback for pre_get_posts to use an OR query between post_name & post_author
- *
- * @ignore
- *
- * @param string $where WHERE clause.
- * @return string
- */
- public function pre_get_posts_sql_name_or_user( $where ) {
- global $wpdb;
-
- remove_filter( 'posts_where', array( $this, 'pre_get_posts_sql_name_or_user' ) );
-
- // Replace `post_name IN(..) AND post_author IN (..)`
- // With `( post_name IN() OR post_author IN() )`
- $where = preg_replace( "!\s(\S+\.post_name IN .+?)\s*AND\s*(\s\S+\.post_author.+?)AND!i", ' ( $1 OR $2 ) AND', $where );
-
- // Allow reviewers to also see all pending plugins.
- if ( current_user_can( 'plugin_edit_pending' ) && ( ! isset( $_GET['author'] ) || ( isset( $_GET['post_status'] ) && in_array( $_GET['post_status'], array( 'draft', 'pending' ) ) ) ) ) {
- $where .= " OR {$wpdb->posts}.post_status IN ('draft', 'pending')";
- }
-
- return $where;
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Replaces the WP_Posts_List_Table object with the extended Plugin_Posts list table object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string $post_type The current post type.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -404,29 +323,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Only plugin reviewers/admins need review-related meta boxes.
- if ( current_user_can( 'plugin_approve' ) ) {
- add_meta_box(
- 'internal-notes',
- __( 'Internal Notes', 'wporg-plugins' ),
- array( __NAMESPACE__ . '\Metabox\Internal_Notes', 'display' ),
- 'plugin', 'normal', 'high'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_meta_box(
+ 'internal-notes',
+ __( 'Internal Notes', 'wporg-plugins' ),
+ array( __NAMESPACE__ . '\Metabox\Internal_Notes', 'display' ),
+ 'plugin', 'normal', 'high'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_meta_box(
- 'plugin-review',
- __( 'Plugin Review Tools', 'wporg-plugins' ),
- array( __NAMESPACE__ . '\Metabox\Review_Tools', 'display' ),
- 'plugin', 'normal', 'high'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_meta_box(
+ 'plugin-review',
+ __( 'Plugin Review Tools', 'wporg-plugins' ),
+ array( __NAMESPACE__ . '\Metabox\Review_Tools', 'display' ),
+ 'plugin', 'normal', 'high'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_meta_box(
- 'plugin-author',
- __( 'Author Card', 'wporg-plugins' ),
- array( __NAMESPACE__ . '\Metabox\Author_Card', 'display' ),
- 'plugin', 'side'
- );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_meta_box(
+ 'plugin-author',
+ __( 'Author Card', 'wporg-plugins' ),
+ array( __NAMESPACE__ . '\Metabox\Author_Card', 'display' ),
+ 'plugin', 'side'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_meta_box(
</span><span class="cx" style="display: block; padding: 0 10px"> 'authordiv',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -459,14 +375,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'plugin', 'side'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( current_user_can( 'plugin_add_committer', $post ) ) {
- add_meta_box(
- 'plugin-stats',
- __( 'Plugin Stats', 'wporg-plugins' ),
- array( __NAMESPACE__ . '\Metabox\Stats', 'display' ),
- 'plugin', 'normal'
- );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_meta_box(
+ 'plugin-stats',
+ __( 'Plugin Stats', 'wporg-plugins' ),
+ array( __NAMESPACE__ . '\Metabox\Stats', 'display' ),
+ 'plugin', 'normal'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove unnecessary metaboxes.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -480,20 +394,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Hook into the save process for the plugin post_type to save extra metadata.
- *
- * Currently saves the tested_with value.
- *
- * @param int $post_id The post_id being updated.
- */
- public function save_plugin_post( $post_id ) {
- // Save meta information
- if ( isset( $_POST['tested_with'] ) && isset( $_POST['hidden_tested_with'] ) && $_POST['tested_with'] != $_POST['hidden_tested_with'] ) {
- update_post_meta( $post_id, 'tested', wp_slash( wp_unslash( $_POST['tested_with'] ) ) );
- }
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Filter the action links displayed for each comment.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Actions for internal notes can be limited to replying for plugin reviewers.
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclasscontrolsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.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-controls.php 2016-10-10 20:23:04 UTC (rev 4211)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php 2016-10-11 06:27:26 UTC (rev 4212)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,81 +86,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function display_tested_up_to() {
</span><span class="cx" style="display: block; padding: 0 10px"> $post = get_post();
</span><span class="cx" style="display: block; padding: 0 10px"> $tested_up_to = (string) get_post_meta( $post->ID, 'tested', true );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $versions = self::get_tested_up_to_versions( $tested_up_to );
- $tested_up_to = $versions['tested_up_to'];
</del><span class="cx" style="display: block; padding: 0 10px"> $unknown_string = _x( 'Unknown', 'unknown version', 'wporg-plugins' );
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="misc-pub-section misc-pub-tested">
</span><span class="cx" style="display: block; padding: 0 10px"> <label for="tested_with"><?php _e( 'Tested With:', 'wporg-plugins' ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px"> <strong id="tested-with-display"><?php echo ( $tested_up_to ? sprintf( 'WordPress %s', $tested_up_to ) : $unknown_string ); ?></strong>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <button type="button" class="button-link edit-tested-with hide-if-no-js">
- <span aria-hidden="true"><?php _e( 'Edit', 'wporg-plugins' ); ?></span>
- <span class="screen-reader-text"><?php _e( 'Edit tested with version', 'wporg-plugins' ); ?></span>
- </button>
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div id="tested-with-select" class="plugin-control-select hide-if-js">
- <input type="hidden" name="hidden_tested_with" id="hidden-tested-with" value="<?php echo esc_attr( $tested_up_to ); ?>">
- <label class="screen-reader-text" for="tested-with"><?php _e( 'Version of WordPress it was tested with', 'wporg-plugins' ); ?></label>
- <select name="tested_with" id="tested-with">
- <?php
- foreach ( $versions['versions'] as $ver ) {
- printf(
- '<option value="%s" %s>%s</option>',
- esc_attr( $ver ),
- selected( $tested_up_to, $ver, true ),
- esc_html( $ver ? sprintf( 'WordPress %s', $ver ) : $unknown_string )
- );
- }
- ?>
- </select>
- <button type="button" class="save-tested-with hide-if-no-js button"><?php _e( 'OK', 'wporg-plugins' ); ?></button>
- <button type="button" class="cancel-tested-with hide-if-no-js button-link"><?php _e( 'Cancel', 'wporg-plugins' ); ?></button>
- </div>
-
</del><span class="cx" style="display: block; padding: 0 10px"> </div><!-- .misc-pub-section --><?php
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Fetch all versions which an author can set their plugin as tested with.
- *
- * This returns the latest release in the previous 4 branches, trunk, and
- * the current version the plugin is marked as tested with.
- *
- * @global string $wp_version The WordPress version string.
- *
- * @param string $tested_up_to The version which the plugin is currently specified as compatible to.
- * @return array An array containing 'versions' an array of versions for display, and 'tested_up_to'
- * the sanitized/most recent version of the $tested_up_to parameter.
- */
- protected static function get_tested_up_to_versions( $tested_up_to ) {
- global $wp_version;
-
- // Fetch all "compatible" versions, this array is in the form of [ '4.4.2' => [ '4.4.1', '4.4' ], ...]
- if ( function_exists( 'wporg_get_version_equivalents' ) ) {
-
- // This function is a global WordPress.org function.
- $all_versions = wporg_get_version_equivalents();
- } else {
- $all_versions = array( (string)(float) $wp_version => array( $wp_version ) );
- }
-
- $versions = array_slice( array_keys( $all_versions ), 0, 4 );
-
- foreach( $versions as $version ) {
- if ( in_array( $tested_up_to, $all_versions[ $version ] ) ) {
- $tested_up_to = $version;
- break;
- }
- }
-
- // If the version specified isn't going to display, insert it into the list.
- if ( ! in_array( $tested_up_to, $versions ) ) {
- $versions[] = $tested_up_to;
- }
-
- // WordPress.org runs trunk, this keeps the highest version selectable as trunk.
- $versions[] = preg_replace( '!-\d{4,}$!', '', $wp_version );
-
- return compact( 'versions', 'tested_up_to' );
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryadminmetaboxclassplugincategoriesphp"></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/metabox/class-plugin-categories.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-plugin-categories.php 2016-10-10 20:23:04 UTC (rev 4211)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-plugin-categories.php 2016-10-11 06:27:26 UTC (rev 4212)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,34 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-namespace WordPressdotorg\Plugin_Directory\Admin\Metabox;
-
-/**
- * The Plugin Categories metabox
- *
- * @package WordPressdotorg\Plugin_Directory\Admin\Metabox
- */
-class Plugin_Categories {
-
- /**
- * Displays the categories metabox for plugins.
- * The HTML here matches what Core uses.
- *
- * @param \WP_Post $post
- */
- static function display( $post ) {
- ?>
- <div id="taxonomy-plugin_category" class="categorydiv">
- <div class="notice notice-info inline">
- <p><?php _e( 'You can assign up to 3 categories.', 'wporg-plugins' ); ?></p>
- </div>
-
- <div id="plugin_category-all" class="tabs-panel">
- <?php // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. ?>
- <input type='hidden' name='tax_input[plugin_category][]' value='0' />
- <ul id="plugin_tagchecklist" data-wp-lists="list:plugin_category" class="categorychecklist form-no-clear">
- <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => 'plugin_category' ) ); ?>
- </ul>
- </div>
- </div>
- <?php
- }
-}
</del></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclasscapabilitiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-capabilities.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-capabilities.php 2016-10-10 20:23:04 UTC (rev 4211)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-capabilities.php 2016-10-11 06:27:26 UTC (rev 4212)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,12 +23,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public static function map_meta_cap( $required_caps, $cap, $user_id, $context ) {
</span><span class="cx" style="display: block; padding: 0 10px"> switch( $cap ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // TODO: Map these for the users
</ins><span class="cx" style="display: block; padding: 0 10px"> case 'plugin_edit':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'plugin_add_committer':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'plugin_remove_committer':
</span><span class="cx" style="display: block; padding: 0 10px"> $required_caps = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $post = get_post( $context[0] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! $post instanceof \WP_Post ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $post ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $required_caps[] = 'do_not_allow';
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -80,21 +81,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @static
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function add_roles() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $committer = array(
- 'read' => true,
- 'plugin_dashboard_access' => true,
- 'plugin_edit_own' => true,
- 'plugin_set_category' => true,
- 'plugin_add_committer' => true,
- 'plugin_edit_others' => true,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $reviewer = array(
+ 'read' => true,
+ 'plugin_edit_own' => true,
+ 'plugin_set_category' => true,
+ 'plugin_add_committer' => true,
+ 'plugin_edit_others' => true,
+ 'moderate_comments' => true,
+ 'plugin_edit_pending' => true,
+ 'plugin_review' => true,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $reviewer = array_merge( $committer, array(
- 'moderate_comments' => true,
- 'plugin_edit_pending' => true,
- 'plugin_review' => true,
- ) );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $admin = array_merge( $reviewer, array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'plugin_approve' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'plugin_reject' => true,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,32 +103,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove the roles first, incase we've changed the permission set.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_role( 'plugin_committer' );
- remove_role( 'plugin_reviewer' );
- remove_role( 'plugin_admin' );
- add_role( 'plugin_committer', 'Plugin Committer', $committer );
- add_role( 'plugin_reviewer', 'Plugin Reviewer', $reviewer );
- add_role( 'plugin_admin', 'Plugin Admin', $admin );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ remove_role( 'plugin_reviewer' );
+ remove_role( 'plugin_admin' );
+ add_role( 'plugin_reviewer', 'Plugin Reviewer', $reviewer );
+ add_role( 'plugin_admin', 'Plugin Admin', $admin );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( array( 'contributor', 'author', 'editor', 'administrator' ) as $role ) {
- $wp_role = get_role( $role );
-
- if ( ! $wp_role ) {
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_admin_role = get_role( 'administrator' );
+ if ( $wp_admin_role ) {
+ foreach ( $admin as $admin_cap => $value ) {
+ $wp_admin_role->add_cap( $admin_cap );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- foreach ( $committer as $committer_cap => $value ) {
- $wp_role->add_cap( $committer_cap );
- }
-
- if ( in_array( $role, array( 'editor', 'administrator' ) ) ) {
- foreach ( $admin as $admin_cap => $value ) {
- $wp_role->add_cap( $admin_cap );
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'default_role', 'plugin_committer' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ update_option( 'default_role', 'subscriber' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectoryclassplugindirectoryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-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 2016-10-10 20:23:04 UTC (rev 4211)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php 2016-10-11 06:27:26 UTC (rev 4212)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,8 +41,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'widgets_init', array( $this, 'register_widgets' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'term_link', array( $this, 'term_link' ), 10, 2 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ), 10, 2 );
- add_filter( 'tax_input_pre', array( $this, 'filter_tax_input' ) );
</del><span class="cx" style="display: block; padding: 0 10px"> add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'rest_api_allowed_post_types', array( $this, 'filter_allowed_post_types' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -128,7 +126,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'public' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_ui' => current_user_can( 'plugin_set_section' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_admin_column' => current_user_can( 'plugin_set_section' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'meta_box_cb' => false, // 'post_categories_meta_box',
</del><span class="cx" style="display: block; padding: 0 10px"> 'capabilities' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'assign_terms' => 'plugin_set_section',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -158,7 +155,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'public' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_ui' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_admin_column' => true,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'meta_box_cb' => array( __NAMESPACE__ . '\Admin\Metabox\Plugin_Categories', 'display' ),
</del><span class="cx" style="display: block; padding: 0 10px"> 'capabilities' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'assign_terms' => 'plugin_set_category',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -174,7 +170,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'public' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_ui' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_admin_column' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'meta_box_cb' => false, // array( __NAMESPACE__ . '\Admin\Metabox\Plugin_Categories', 'display' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'meta_box_cb' => false,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'capabilities' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'assign_terms' => 'plugin_set_category',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -190,7 +186,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'public' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_ui' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_admin_column' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'meta_box_cb' => false, // array( __NAMESPACE__ . '\Admin\Metabox\Plugin_Categories', 'display' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'meta_box_cb' => false,
</ins><span class="cx" style="display: block; padding: 0 10px"> 'capabilities' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'assign_terms' => 'plugin_set_category',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -453,7 +449,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'plugin_built_for' == $term->taxonomy ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> // Term slug = Post Slug = /%postname%/
</span><span class="cx" style="display: block; padding: 0 10px"> return trailingslashit( home_url( $term->slug ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -462,23 +457,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Checks if the current users is a super admin before allowing terms to be added.
- *
- * @param string $term The term to add or update.
- * @param string $taxonomy The taxonomy of the term.
- * @return string|\WP_Error The term to add or update or WP_Error on failure.
- */
- public function pre_insert_term_prevent( $term, $taxonomy ) {
- $allowed_taxonomies = array( 'plugin_tags', 'plugin_contributors' );
-
- if ( ! in_array( $taxonomy, $allowed_taxonomies ) && ! is_super_admin() ) {
- $term = new \WP_Error( 'not-allowed', __( 'You are not allowed to add terms.', 'wporg-plugins' ) );
- }
-
- return $term;
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * @param \WP_Query $wp_query The WordPress Query object.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function use_plugins_in_query( $wp_query ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -772,12 +750,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $path = explode( '/', $_SERVER['REQUEST_URI'] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'tags' === $path[2] ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( Tag_To_Category::$map[ $path[3] ] ) ) {
- wp_safe_redirect( home_url( '/category/' . Tag_To_Category::$map[ $path[3] ] . '/' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $path[3] ) ) {
+ wp_safe_redirect( home_url( '/search/' . urlencode( $path[3] ) . '/' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> die();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if ( isset( $path[3] ) ) {
- wp_safe_redirect( home_url( '/search/' . $path[3] . '/' ) );
- die();
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_safe_redirect( home_url( '/' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> die();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -792,17 +767,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Otherwise, handle a plugin redirect.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $plugin = self::get_plugin_post( $path[2] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $is_disabled = in_array( $plugin->post_status, array( 'disabled', 'closed' ), true );
-
- if ( $is_disabled && current_user_can( 'edit_post', $plugin ) ) {
- wp_safe_redirect( add_query_arg( array(
- 'post' => $plugin->ID,
- 'action' => 'edit',
- ), admin_url( 'post.php' ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $permalink = get_permalink( $plugin->ID );
+ if ( parse_url( $permalink, PHP_URL_PATH ) != $_SERVER['REQUEST_URI'] ) {
+ wp_safe_redirect( $permalink );
</ins><span class="cx" style="display: block; padding: 0 10px"> die();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if ( ! $is_disabled ) {
- wp_safe_redirect( get_permalink( $plugin->ID ) );
- die();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -968,24 +936,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Filters the value of tax_inputs before saving.
- *
- * Used both in the admin and the uploader.
- *
- * @param array $tax_input Array of taxonomies with selected terms.
- * @return array
- */
- public function filter_tax_input( $tax_input ) {
-
- // Limit the amount of assignable categories to 3.
- if ( isset( $tax_input['plugin_category'] ) ) {
- $tax_input['plugin_category'] = array_slice( array_filter( $tax_input['plugin_category'] ), 0, 3 );
- }
-
- return $tax_input;
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Retrieve the WP_Post object representing a given plugin.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @static
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsplugindirectorycliclassimportphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.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/cli/class-import.php 2016-10-10 20:23:04 UTC (rev 4211)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php 2016-10-11 06:27:26 UTC (rev 4212)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -182,15 +182,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> update_post_meta( $plugin->ID, 'assets_banners_color', wp_slash( $banner_average_color ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Give committers a role on this site.
- foreach ( Tools::get_plugin_committers( $plugin_slug ) as $committer ) {
- $user = get_user_by( 'login', $committer );
-
- if ( $user && ! user_can( $user, 'plugin_dashboard_access' ) ) {
- $user->add_role( 'plugin_committer' );
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $current_stable_tag = get_post_meta( $plugin->ID, 'stable_tag', true );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->rebuild_invalidate_zips( $plugin_slug, $stable_tag, $current_stable_tag, $svn_changed_tags );
</span></span></pre>
</div>
</div>
</body>
</html>