<!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>[6421] sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub: Pub: Open-source remaining pub plugins.</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/6421">6421</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/6421","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>obenland</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-01-23 23:36:08 +0000 (Tue, 23 Jan 2018)</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'>Pub: Open-source remaining pub plugins.
See <a href="http://meta.trac.wordpress.org/changeset/5346">[5346]</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgallowmorehtmlincommentsphp">sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-allow-more-html-in-comments.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgsitequerylocalesupportphp">sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-site-query-locale-support.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgtimeshortcodephp">sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-time-shortcode.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubclasso2followphp">sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/class-o2-follow.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgaddexistingusersviausernamephp">sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-add-existing-users-via-username.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgnoadminbarifnoblogsphp">sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-no-adminbar-if-no-blogs.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubclasso2followphp"></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/mu-plugins/pub/class-o2-follow.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/mu-plugins/pub/class-o2-follow.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/class-o2-follow.php 2018-01-23 23:36:08 UTC (rev 6421)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,310 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Plugin Name: Jetpack Follow Link for o2
+ * Description: Easily subscribe to an o2 comment thread without commenting using a "Follow" action link like WordPress.com has.
+ * Author: WordPress.org
+ * Author URI: https://wordpress.org/
+ * Version: 1.0
+ * License: GPLv2 or later
+ *
+ * @package o2
+ */
+
+/**
+ * Class o2_follow.
+ */
+class o2_follow {
+
+ // Use the old p2 meta key, for backwards compatibility.
+ const USER_META_KEY = 'jpflfp2_posts_following';
+
+ /**
+ * Construct the plugin
+ */
+ public function __construct() {
+ add_action( 'init', array( $this, 'action_init' ) );
+ }
+
+ /**
+ * Initialize plugin.
+ */
+ public function action_init() {
+ if ( ! current_theme_supports( 'o2' ) || ! class_exists( 'Jetpack_Subscriptions' ) ) {
+ return;
+ }
+
+ // Only logged in users should be able to subscribe for now because we use the registered email address.
+ if ( ! is_user_logged_in() ) {
+ return;
+ }
+
+ add_action( 'o2_post_form_extras', array( $this, 'subscription_o2_post_form' ) );
+
+ add_action( 'init', array( $this, 'subscribe_o2_register_post_action_states' ) );
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
+
+ add_action( 'o2_writeapi_post_updated', array( $this, 'check_post_for_subscription' ), 10, 2 );
+ add_action( 'o2_writeapi_post_created', array( $this, 'check_post_for_subscription' ), 10, 2 );
+
+ add_action( 'template_redirect', array( $this, 'handle_following_action' ) );
+
+ // Filters.
+ add_filter( 'o2_options', array( $this, 'get_options' ) );
+ add_filter( 'o2_filter_post_actions', array( $this, 'subscription_o2_add_comment_subscriber_link' ), 10, 2 );
+
+ add_filter( 'o2_comment_form_extras', array( $this, 'subscribe_o2_comment_form' ), 10, 2 );
+ add_filter( 'o2_options', array( $this, 'subscribe_add_o2_options' ) );
+ add_filter( 'o2_post_fragment', array( $this, 'subscribe_add_o2_post_fragment' ), 10, 2 );
+
+ $this->subscribe_o2_register_post_action_states();
+ }
+
+ /**
+ * Enqueue scripts.
+ */
+ public function enqueue_scripts() {
+ wp_enqueue_style( 'o2-follow', plugins_url( 'modules/follow/css/style.css', O2__FILE__ ) );
+
+ wp_enqueue_script( 'o2-extend-follow-models-post', plugins_url( 'modules/follow/js/models/post.js', O2__FILE__ ), array( 'o2-cocktail', 'o2-models-post', 'o2-notifications' ) );
+ wp_enqueue_script( 'o2-extend-follow-views-comment', plugins_url( 'modules/follow/js/views/comment.js', O2__FILE__ ), array( 'o2-cocktail', 'o2-views-comment' ) );
+ wp_enqueue_script( 'o2-extend-follow-views-post', plugins_url( 'modules/follow/js/views/post.js', O2__FILE__ ), array( 'o2-cocktail', 'o2-extend-follow-models-post' ) );
+ }
+
+ /**
+ * Add follow strings and options to the o2 options array.
+ *
+ * @param array $options O2 options.
+ * @return array
+ */
+ public function get_options( $options ) {
+ $localizations = array(
+ 'follow' => __( 'Follow', 'o2' ),
+ 'followComments' => __( 'Follow comments', 'o2' ),
+ 'unfollow' => __( 'Unfollow', 'o2' ),
+ 'unfollowComments' => __( 'Unfollow comments', 'o2' ),
+ 'followError' => __( 'There was a problem updating your following preferences.', 'o2' ),
+ 'followingAll' => __( 'Following all', 'o2' ),
+ 'followingAllComments' => __( 'You are already following all comments on this site.', 'o2' ),
+ );
+ $localizations = array_merge( $options['strings'], $localizations );
+ $options['strings'] = $localizations;
+
+ if ( ! isset( $options['options']['followingBlog'] ) ) {
+ $options['options']['followingBlog'] = false;
+ }
+
+ if ( ! isset( $options['options']['followingAllComments'] ) ) {
+ $options['options']['followingAllComments'] = false;
+ }
+
+ return $options;
+ }
+
+ /**
+ * Returns a subscription form.
+ *
+ * @param string $comment_form_extras Comment form extras. Default: Empty string.
+ * @param bool $post_id Post ID. Default: null.
+ * @return string
+ */
+ public function subscribe_o2_comment_form( $comment_form_extras = '', $post_id = null ) {
+ $post = get_post( $post_id );
+ if ( ! $post ) {
+ return $comment_form_extras;
+ }
+
+ $post_id = $post->ID;
+ $subscribed_ids = (array) get_user_meta( wp_get_current_user()->ID, self::USER_META_KEY, true );
+ $checked = in_array( $post_id, $subscribed_ids, true );
+
+ $comment_form_extras .= '<p class="comment-subscription-form">';
+ $comment_form_extras .= '<input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;"' . checked( $checked, true, false ) . '/> ';
+ $comment_form_extras .= '<label class="subscribe-label" id="subscribe-label" for="subscribe" style="display: inline;">' . esc_html__( 'Notify me of new comments via email.', 'o2' ) . '</label>';
+ $comment_form_extras .= '</p>';
+
+ return $comment_form_extras;
+ }
+
+ /**
+ * Adds O2 options.
+ *
+ * @param array $options O2 options.
+ * @return array
+ */
+ public function subscribe_add_o2_options( $options ) {
+ $options['options']['followingBlog'] = false;
+ $options['options']['followingAllComments'] = false;
+
+ return $options;
+ }
+
+ /**
+ * Adds post fragment.
+ *
+ * @param array $fragment Fragments. Default: Empty array.
+ * @param bool $post_id Post ID. Default: null.
+ *
+ * @return array
+ */
+ public function subscribe_add_o2_post_fragment( $fragment = [], $post_id = null ) {
+ $post = get_post( $post_id );
+ if ( ! $post ) {
+ return $fragment;
+ }
+
+ if ( ! array_key_exists( 'postMeta', $fragment ) ) {
+ $fragment['postMeta'] = [];
+ }
+
+ $subscribed_ids = (array) get_user_meta( wp_get_current_user()->ID, self::USER_META_KEY, true );
+ $fragment['postMeta']['isFollowing'] = in_array( $post_id, $subscribed_ids, true );
+
+ return $fragment;
+ }
+
+ /**
+ * Add 'subscribe' checkbox to o2 post form.
+ *
+ * @param string $post_form_extras Comment form extras. Default: Empty string.
+ * @return string
+ **/
+ public function subscription_o2_post_form( $post_form_extras = '' ) {
+ $label = esc_html__( 'Notify me of new comments via email.', 'o2' );
+
+ $post_form_extras .= '<p style="margin-top: 1.5em;" class="comment-subscription-form"><input type="checkbox" name="post_subscribe" id="post_subscribe" value="post_subscribe" style="margin-left: .5em;"/>';
+ $post_form_extras .= '<label style="font-size: 1.2em; margin-bottom: .5em;" id="post_subscribe_label" for="post_subscribe"><small>' . $label . '</small></label>';
+ $post_form_extras .= '</p>';
+
+ return $post_form_extras;
+ }
+
+ /**
+ * Registers post actions.
+ */
+ public function subscribe_o2_register_post_action_states() {
+ if ( ! function_exists( 'o2_register_post_action_states' ) ) {
+ o2_register_post_action_states( 'follow', [
+ 'normal' => [
+ 'shortText' => __( 'Follow', 'o2' ),
+ 'title' => __( 'Follow comments', 'o2' ),
+ 'classes' => [],
+ 'genericon' => 'genericon-subscribe',
+ 'nextState' => 'subscribed',
+ ],
+ 'subscribed' => [
+ 'shortText' => __( 'Following', 'o2' ),
+ 'title' => __( 'Unfollow comments', 'o2' ),
+ 'classes' => [ 'post-comments-subscribed' ],
+ 'genericon' => 'genericon-unsubscribe',
+ 'nextState' => 'normal',
+ ],
+ ] );
+ }
+ }
+
+ /**
+ * Adds a subscriber link.
+ *
+ * @param array $actions Actions.
+ * @param bool $post_id Post ID. Default: null.
+ * @return array
+ */
+ public function subscription_o2_add_comment_subscriber_link( $actions, $post_id = null ) {
+ global $post;
+
+ $post_id = $post_id ?: $post->ID;
+
+ if ( comments_open( $post_id ) ) {
+ $initial_state = 'normal';
+ $query_args = [
+ 'post-id' => $post_id,
+ 'action' => 'post-comment-subscribe',
+ ];
+
+ $subscribed_ids = (array) get_user_meta( wp_get_current_user()->ID, self::USER_META_KEY, true );
+
+ if ( in_array( $post_id, $subscribed_ids, true ) ) {
+ $query_args['action'] = 'post-comment-unsubscribe';
+ $initial_state = 'subscribed';
+ }
+
+ $link = add_query_arg( $query_args, home_url( '', is_ssl() ? 'https' : 'http' ) );
+ $link = wp_nonce_url( $link, 'post-comment-subscribe' );
+
+ $actions[31] = [
+ 'action' => 'follow',
+ 'href' => $link,
+ 'classes' => [ 'subscription-link', 'o2-follow' ],
+ 'rel' => false,
+ 'initialState' => $initial_state,
+ ];
+ }
+
+ return $actions;
+ }
+
+ /**
+ * Checks post for subscription.
+ *
+ * @param int $post_id Post ID..
+ * @param object $message Message.
+ */
+ public function check_post_for_subscription( $post_id, $message ) {
+ if ( $message->isFollowing ) {
+ $this->subscribe_to_comments( $post_id );
+ }
+ }
+
+ /**
+ * Handles action.
+ */
+ public function handle_following_action() {
+ // Bail if the action isn't ours.
+ if ( ! isset( $_GET['post-id'], $_GET['action'], $_GET['_wpnonce'] ) ) {
+ return;
+ }
+
+ $post_id = intval( $_GET['post-id'] );
+
+ $post = get_post( $post_id );
+ if ( ! $post ) {
+ die;
+ }
+
+ if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'post-comment-subscribe' ) ) {
+ die;
+ }
+
+ if ( ! comments_open( $post_id ) ) {
+ die;
+ }
+
+ if ( 'post-comment-subscribe' !== $_GET['action'] ) {
+ die;
+ }
+
+ $this->subscribe_to_comments( $post_id );
+ die;
+ }
+
+ /**
+ * Subscribes the current user to comments.
+ *
+ * @param int $post_id Post ID.
+ */
+ public function subscribe_to_comments( $post_id ) {
+ $current_user = wp_get_current_user();
+ $jetpack_subscriptions = Jetpack_Subscriptions::init();
+
+ $response = $jetpack_subscriptions->subscribe( $current_user->user_email, array( $post_id ), true );
+ if ( is_wp_error( $response ) ) {
+ return;
+ }
+
+ $subscribed_ids = get_user_meta( $current_user->ID, self::USER_META_KEY, true );
+ $subscribed_ids[] = $post_id;
+ $subscribed_ids = array_unique( $subscribed_ids );
+
+ update_user_meta( $current_user->ID, self::USER_META_KEY, $subscribed_ids );
+ }
+}
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgaddexistingusersviausernamephp"></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/mu-plugins/pub/wporg-add-existing-users-via-username.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/mu-plugins/pub/wporg-add-existing-users-via-username.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-add-existing-users-via-username.php 2018-01-23 23:36:08 UTC (rev 6421)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,112 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Plugin Name: Add Existing Users via Username
+ * Description: Allows non-super admins to add existing users via email address or username.
+ * Version: 1.0
+ * Author: WordPress.org
+ * Author URI: https://wordpress.org/
+ * License: GPLv2 or later
+ *
+ * @package WordPressdotorg\AddViaUsername
+ */
+
+namespace WordPressdotorg\AddViaUsername;
+
+/**
+ * Outputs inline scripts in the footer to replace labels and descriptions.
+ */
+function replace_email_label() {
+ if ( is_super_admin() ) {
+ return;
+ }
+ ?>
+ <script>
+ ( function( $ ) {
+ $( 'label[for="adduser-email"]' ).html( '<?php echo esc_js( __( 'E-mail or Username' ) ); ?>' );
+ $( '#adduser-email' ).attr( 'type', 'text' );
+ $( '#add-new-user' ).find( '+ div + p' ).html( "<?php echo esc_js( __( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) ); ?>" );
+ } )( jQuery );
+ </script>
+ <?php
+}
+add_action( 'admin_print_footer_scripts-user-new.php', __NAMESPACE__ . '\replace_email_label' );
+
+/**
+ * Replaces functionality at a single site level for adding an existing network user to a site.
+ *
+ * The majority of this code is from wp-admin/user-new.php.
+ */
+function add_existing_user_to_site() {
+ if ( is_super_admin() ) {
+ return;
+ }
+
+ check_admin_referer( 'add-user', '_wpnonce_add-user' );
+
+ $user_details = null;
+ $user_email = wp_unslash( $_REQUEST['email'] );
+ if ( false !== strpos( $user_email, '@' ) ) {
+ $user_details = get_user_by( 'email', $user_email );
+ } else {
+ $user_details = get_user_by( 'login', $user_email );
+ }
+
+ if ( ! $user_details ) {
+ wp_safe_redirect( add_query_arg( array( 'update' => 'does_not_exist' ), 'user-new.php' ) );
+ exit;
+ }
+
+ if ( ! current_user_can( 'promote_user', $user_details->ID ) ) {
+ wp_die( esc_html__( 'Cheatin’ uh?' ), 403 );
+ }
+
+ // Adding an existing user to this blog.
+ $blog_id = get_current_blog_id();
+ $new_user_email = $user_details->user_email;
+ $username = $user_details->user_login;
+ $user_id = $user_details->ID;
+
+ if ( ( null !== $username && ! is_super_admin( $user_id ) ) && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) {
+ $redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' );
+ } else {
+ $new_user_key = substr( md5( $user_id ), 0, 5 );
+ add_option( 'new_user_' . $new_user_key, array(
+ 'user_id' => $user_id,
+ 'email' => $user_details->user_email,
+ 'role' => $_REQUEST['role'],
+ ) );
+
+ $roles = get_editable_roles();
+ $role = $roles[ $_REQUEST['role'] ];
+ /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */
+ $message = wp_specialchars_decode( esc_html__(
+ 'Hi,
+
+You\'ve been invited to join \'%1$s\' at
+%2$s with the role of %3$s.
+
+Please click the following link to confirm the invite:
+%4$s'
+ ), ENT_QUOTES | ENT_HTML5 );
+
+ wp_mail(
+ $new_user_email, sprintf(
+ /* translators: Blog name. */
+ esc_html__( '[%s] Joining confirmation' ),
+ wp_specialchars_decode( get_option( 'blogname' ) )
+ ),
+ sprintf(
+ $message,
+ get_option( 'blogname' ),
+ home_url(),
+ wp_specialchars_decode( translate_user_role( $role['name'] ) ),
+ home_url( "/newbloguser/$new_user_key/" )
+ )
+ );
+ $redirect = add_query_arg( array( 'update' => 'add' ), 'user-new.php' );
+ }
+
+ wp_safe_redirect( $redirect );
+ exit;
+}
+add_action( 'admin_action_adduser', __NAMESPACE__ . '\add_existing_user_to_site' );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgallowmorehtmlincommentsphp"></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/mu-plugins/pub/wporg-allow-more-html-in-comments.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/mu-plugins/pub/wporg-allow-more-html-in-comments.php 2018-01-23 23:22:26 UTC (rev 6420)
+++ sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-allow-more-html-in-comments.php 2018-01-23 23:36:08 UTC (rev 6421)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,6 +6,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Author: WordPress.org
</span><span class="cx" style="display: block; padding: 0 10px"> * Author URI: https://wordpress.org/
</span><span class="cx" style="display: block; padding: 0 10px"> * License: GPLv2 or later
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @package WordPressdotorg\AllowMoreHtmlInComments
</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"> namespace WordPressdotorg\AllowMoreHtmlInComments;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,6 +56,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $force ) {
</span><span class="cx" style="display: block; padding: 0 10px"> kses_init_filters();
</span><span class="cx" style="display: block; padding: 0 10px"> p2_kses_init();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Don't have core fire kses_init_filters(), we already did.
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgnoadminbarifnoblogsphp"></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/mu-plugins/pub/wporg-no-adminbar-if-no-blogs.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/mu-plugins/pub/wporg-no-adminbar-if-no-blogs.php (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-no-adminbar-if-no-blogs.php 2018-01-23 23:36:08 UTC (rev 6421)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,35 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Plugin Name: No Adminbar If No Blogs
+ * Description: Allow the admin bar to be displayed only if the current user has a blog in this site.
+ * Version: 1.0
+ * Author: WordPress.org, Peter Westwood
+ * Author URI: https://wordpress.org/
+ * License: GPLv2 or later
+ *
+ * @package WordPressdotorg\NoBlogsNoAdminbar
+ */
+
+namespace WordPressdotorg\NoBlogsNoAdminbar;
+
+/**
+ * Filter to determine if adminbar is shown.
+ *
+ * Allow the admin bar to be displayed only if the current user has a blog in this site.
+ * If not we hide it - so if you have no blogs on WP.org you get no bar even if you have make. or learn. blogs.
+ *
+ * @param bool $show Whether to show the admin bar.
+ * @return bool
+ */
+function show_admin_bar( $show ) {
+ $blogs = (array) get_blogs_of_user( get_current_user_id() );
+
+ foreach ( $blogs as $blog ) {
+ if ( get_current_site()->id === $blog->site_id ) {
+ return $show;
+ }
+ }
+
+ return false;
+}
+add_filter( 'show_admin_bar', __NAMESPACE__ . '\show_admin_bar', 1000 );
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgsitequerylocalesupportphp"></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/mu-plugins/pub/wporg-site-query-locale-support.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/mu-plugins/pub/wporg-site-query-locale-support.php 2018-01-23 23:22:26 UTC (rev 6420)
+++ sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-site-query-locale-support.php 2018-01-23 23:36:08 UTC (rev 6421)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,6 +6,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Author: WordPress.org
</span><span class="cx" style="display: block; padding: 0 10px"> * Author URI: https://wordpress.org/
</span><span class="cx" style="display: block; padding: 0 10px"> * License: GPLv2 or later
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @package WordPressdotorg\ExtendedSiteQuery
</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"> namespace WordPressdotorg\ExtendedSiteQuery;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,12 +37,12 @@
</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"> if ( ! empty( $query->query_vars['locale__in'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $sql = LOCALES_TABLES . '.locale IN (' . implode( ',', array_fill( 0, count( $query->query_vars['locale__in'] ), '%s' ) ) . ')';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sql = LOCALES_TABLES . '.locale IN (' . implode( ',', array_fill( 0, count( $query->query_vars['locale__in'] ), '%s' ) ) . ')';
</ins><span class="cx" style="display: block; padding: 0 10px"> $where[] = $wpdb->prepare( $sql, $query->query_vars['locale__in'] );
</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"> if ( ! empty( $query->query_vars['locale__not_in'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $sql = LOCALES_TABLES . '.locale NOT IN (' . implode( ',', array_fill( 0, count( $query->query_vars['locale__not_in'] ), '%s' ) ) . ')';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sql = LOCALES_TABLES . '.locale NOT IN (' . implode( ',', array_fill( 0, count( $query->query_vars['locale__not_in'] ), '%s' ) ) . ')';
</ins><span class="cx" style="display: block; padding: 0 10px"> $where[] = $wpdb->prepare( $sql, $query->query_vars['locale__not_in'] );
</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">@@ -62,15 +64,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param \WP_Site_Query $query The site query.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function add_locale_to_default_query_vars( $query ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $query->query_var_defaults = array_merge( $query->query_var_defaults, [ 'locale' => '', 'locale__in' => '', 'locale__not_in' => '' ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $query->query_var_defaults = array_merge( $query->query_var_defaults, [
+ 'locale' => '',
+ 'locale__in' => '',
+ 'locale__not_in' => '',
+ ] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'parse_site_query', __NAMESPACE__ . '\add_locale_to_default_query_vars' );
</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"> * Adds 'locale' field to site details.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param stdClass $details The site details.
- * @return stdClass Site details.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param \stdClass $details The site details.
+ * @return \stdClass Site details.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function add_locale_to_site_details( $details ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $details->lang_id ) {
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentmupluginspubwporgtimeshortcodephp"></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/mu-plugins/pub/wporg-time-shortcode.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/mu-plugins/pub/wporg-time-shortcode.php 2018-01-23 23:22:26 UTC (rev 6420)
+++ sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-time-shortcode.php 2018-01-23 23:36:08 UTC (rev 6421)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,6 +6,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Author: WordPress.org
</span><span class="cx" style="display: block; padding: 0 10px"> * Author URI: https://wordpress.org/
</span><span class="cx" style="display: block; padding: 0 10px"> * License: GPLv2 or later
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @package WordPressdotorg\TimeShortcode
</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"> namespace WordPressdotorg\TimeShortcode;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,7 +51,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Try to parse the time, relative to the post time. Or current time, if an attr is set.
</span><span class="cx" style="display: block; padding: 0 10px"> $timestamp = ! isset( $attr[0] ) ? get_the_date( 'U' ) : time();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $time = strtotime( $gmtcontent, $timestamp );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $time = strtotime( $gmtcontent, $timestamp );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If that didn't work, give up.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( false === $time || -1 === $time ) {
</span></span></pre>
</div>
</div>
</body>
</html>