<!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>[12018] sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier: Profiles: Apply coding standards.</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 { white-space: pre-line; 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/12018">12018</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/12018","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-08-12 21:13:47 +0000 (Fri, 12 Aug 2022)</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'>Profiles: Apply coding standards.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgprofileswpactivitynotifiertestse2ephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/tests/e2e.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgprofileswpactivitynotifierwporgprofileswpactivitynotifierphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/wporg-profiles-wp-activity-notifier.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgprofileswpactivitynotifiertestse2ephp"></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/wporg-profiles-wp-activity-notifier/tests/e2e.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/wporg-profiles-wp-activity-notifier/tests/e2e.php 2022-08-12 21:13:41 UTC (rev 12017)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/tests/e2e.php 2022-08-12 21:13:47 UTC (rev 12018)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,7 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordPressdotorg\Activity_Notifier\Tests;
</span><span class="cx" style="display: block; padding: 0 10px"> use WPOrg_WP_Activity_Notifier, WP_User;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-ini_set( 'display_errors', 'On' ); // won't do anything if fatal errors
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ini_set( 'display_errors', 'On' ); // won't do anything if fatal errors.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'staging' !== wp_get_environment_type() || 'cli' !== php_sapi_name() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> die( 'Error: Wrong environment.' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,9 +23,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function main( string $case ) : void {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch_to_blog( 1056 ); // testing.wordcamp.org/2019
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch_to_blog( 1056 ); // testing.wordcamp.org/2019.
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch_to_blog( 11 ); // make.w.org/test-site
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch_to_blog( 11 ); // make.w.org/test-site.
</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"> require_once dirname( __DIR__ ) . '/wporg-profiles-wp-activity-notifier.php';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,9 +42,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"> function disable_subscribers_plugin( array $plugins ) : array {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach( $plugins as $key => $plugin ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $plugins as $key => $plugin ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'subscribers-only.php' === $plugin ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- unset ( $plugins[ $key ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unset( $plugins[ $key ] );
</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 class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,18 +53,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_new_post( WPOrg_WP_Activity_Notifier $notifier ) : void {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1 ) ); // post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1 ) ); // post.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // These should notify
- $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1802 ) ); // post
- sleep( 1 ); // buddypress doesn't show activity that happens at the exact same time
- $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1826 ) ); // handbook
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // These should notify.
+ $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1802 ) ); // post.
+ sleep( 1 ); // buddypress doesn't show activity that happens at the exact same time.
+ $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1826 ) ); // handbook.
</ins><span class="cx" style="display: block; padding: 0 10px"> sleep( 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1832 ) ); // course
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1832 ) ); // course.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // These should not notify
- $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 722 ) ); // x-post (should not notify, check https://profiles.wordpress.org/jmdodd/)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // These should not notify.
+ $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 722 ) ); // x-post (should not notify, check https://profiles.wordpress.org/jmdodd/).
</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 class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,13 +76,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( $user->ID );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // This should notify
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // This should notify.
</ins><span class="cx" style="display: block; padding: 0 10px"> $handbook = get_post( 1849 );
</span><span class="cx" style="display: block; padding: 0 10px"> $notifier->maybe_notify_updated_post( $handbook->ID, $handbook, $handbook );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- sleep( 1 ); // buddypress doesn't show activity that happens at the exact same time
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sleep( 1 ); // buddypress doesn't show activity that happens at the exact same time.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // This should not notify
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // This should not notify.
</ins><span class="cx" style="display: block; padding: 0 10px"> $regular_post = get_post( 1879 ); // `post` post type.
</span><span class="cx" style="display: block; padding: 0 10px"> $notifier->maybe_notify_updated_post( $regular_post->ID, $regular_post, $regular_post );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgprofileswpactivitynotifierwporgprofileswpactivitynotifierphp"></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/wporg-profiles-wp-activity-notifier/wporg-profiles-wp-activity-notifier.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/wporg-profiles-wp-activity-notifier/wporg-profiles-wp-activity-notifier.php 2022-08-12 21:13:41 UTC (rev 12017)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/wporg-profiles-wp-activity-notifier.php 2022-08-12 21:13:47 UTC (rev 12018)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,6 +27,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return self::$instance;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Initialize class.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> private function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px"> $is_wordcamp = defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK;
</span><span class="cx" style="display: block; padding: 0 10px"> $environment = $is_wordcamp ? get_wordcamp_environment() : wp_get_environment_type();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,6 +52,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', array( $this, 'init' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Register hook callbacks.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> public function init() {
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'transition_post_status', array( $this, 'maybe_notify_new_published_post' ), 10, 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'post_updated', array( $this, 'maybe_notify_updated_post' ), 10, 3 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,7 +61,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'transition_comment_status', array( $this, 'maybe_notify_new_approved_comment' ), 10, 3 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wp_insert_comment', array( $this, 'insert_comment' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // bbPress 2.x topic support
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // bbPress 2.x topic support.
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bbp_new_topic', array( $this, 'notify_forum_new_topic' ), 12 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bbp_spammed_topic', array( $this, 'notify_forum_remove_topic' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bbp_unspammed_topic', array( $this, 'notify_forum_new_topic' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,7 +71,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bbp_unapproved_topic', array( $this, 'notify_forum_remove_topic' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'wporg_bbp_archived_topic', array( $this, 'notify_forum_remove_topic' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // bbPress 2.x reply support
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // bbPress 2.x reply support.
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bbp_new_reply', array( $this, 'notify_forum_new_reply' ), 12 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bbp_spammed_reply', array( $this, 'notify_forum_remove_reply' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bbp_unspammed_reply', array( $this, 'notify_forum_new_reply' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,7 +85,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Indicates whether it is permitted to notify about a post or not.
</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 WP_Post $post The post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post The post.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $action 'publish' for new posts, 'update' for existing posts, 'comment' for new comments.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return boolean True == the post can be notified about.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -106,30 +112,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_plugin_active( 'subscribers-only.php' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $notifiable = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- elseif ( ! in_array( $post->post_type, $notifiable_post_types, true ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( ! in_array( $post->post_type, $notifiable_post_types, true ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $notifiable = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- elseif ( 'publish' != $post->post_status ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( 'publish' != $post->post_status ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $notifiable = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- elseif ( ! empty( $post->post_password ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( ! empty( $post->post_password ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $notifiable = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Some Handbook posts are automatically created and don't have an author.
- elseif ( $post->wporg_markdown_source || ! $post->post_author ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( $post->wporg_markdown_source || ! $post->post_author ) {
+ // Some Handbook posts are automatically created and don't have an author.
</ins><span class="cx" style="display: block; padding: 0 10px"> $notifiable = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- elseif ( $post->_xpost_original_permalink || str_starts_with( $post->post_name, 'xpost-' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( $post->_xpost_original_permalink || str_starts_with( $post->post_name, 'xpost-' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $notifiable = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
</ins><span class="cx" style="display: block; padding: 0 10px"> $notifiable = true;
</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">@@ -139,9 +133,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Only send notification for post getting published.
</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 string $new_status The new status for the post
- * @param string $old_status The old status for the post
- * @param WP_Post $post The post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $new_status The new status for the post.
+ * @param string $old_status The old status for the post.
+ * @param WP_Post $post The post.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function maybe_notify_new_published_post( $new_status, $old_status, $post ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'publish' != $new_status ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,7 +157,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Sends activity notification for new blog post.
</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 WP_Post $post The published post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post The published post.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $type 'new' for new posts, 'update' for existing ones.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function notify_blog_post( $post, $type ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -214,10 +208,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Handler for comment creation.
</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 int $id Comment ID
- * @param WP_Comment $comment Comment
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $id Comment ID.
+ * @param WP_Comment $comment Comment.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function insert_comment( $id, $comment ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function insert_comment( $id, $comment ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 1 == $comment->comment_approved ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->maybe_notify_new_approved_comment( 'approved', '', $comment );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -226,9 +220,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Only send notification for comment getting published on a public post.
</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 string $new_status The new status for the comment
- * @param string $old_status The old status for the comment
- * @param WP_Comment $comment The comment
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $new_status The new status for the comment.
+ * @param string $old_status The old status for the comment.
+ * @param WP_Comment $comment The comment.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function maybe_notify_new_approved_comment( $new_status, $old_status, $comment ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'approved' != $new_status ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -249,8 +243,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Sends activity notification for new comment.
</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 WP_Comment $comment The comment
- * @param WP_Post $post The comment's post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Comment $comment The comment.
+ * @param WP_Post $post The comment's post.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function notify_new_approved_comment( $comment, $post ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -285,8 +279,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</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 string $activity. The activity type. One of: create-topic, remove-topic.
- * @param int $topic_id Topic ID.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $activity The activity type. One of: create-topic, remove-topic.
+ * @param int $topic_id Topic ID.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function _notify_forum_topic_payload( $activity, $topic_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -306,7 +300,7 @@
</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"> $url = bbp_get_topic_permalink( $topic_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove moderator flags
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Remove moderator flags.
</ins><span class="cx" style="display: block; padding: 0 10px"> $url = remove_query_arg( array( 'view' ), $url );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $args = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -350,8 +344,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</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 string $activity. The activity type. One of: create-reply, remove-reply.
- * @param int $reply_id Reply ID.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $activity The activity type. One of: create-reply, remove-reply.
+ * @param int $reply_id Reply ID.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function _notify_forum_reply_payload( $activity, $reply_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -371,7 +365,7 @@
</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"> $url = bbp_get_reply_url( $reply_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove moderator flags
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Remove moderator flags.
</ins><span class="cx" style="display: block; padding: 0 10px"> $url = remove_query_arg( array( 'view' ), $url );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $args = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -450,7 +444,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Remove blockquoted text since the text isn't original.
</span><span class="cx" style="display: block; padding: 0 10px"> $text = preg_replace( '/<blockquote>.+?<\/blockquote>/s', '', $text );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> $text = trim( strip_tags( $text ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( function_exists( 'strip_shortcodes' ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -474,10 +467,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $text .= '…';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Else trim by words.
- else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ // Else trim by words.
</ins><span class="cx" style="display: block; padding: 0 10px"> $text = wp_trim_words( $text, $length );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>