<!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>[BuddyPress][12067] trunk/src: BP Nouveau: restrict the allowed HTML tags for Messages.</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://buddypress.trac.wordpress.org/changeset/12067">12067</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/12067","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-05-06 10:47:08 +0000 (Sun, 06 May 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'>BP Nouveau: restrict the allowed HTML tags for Messages.
BP Nouveau is using the WP Editor to improve the user experience of the Messages component when people are writing a new message or replying to a thread. So far allowed HTML tags for the messages content *when BP Nouveau is the active template pack* were the same than WordPress Posts. When BP Nouveau is not the active template pack, the allowed tags are those of the WordPress global .
This commit is introducing a new function that is used to filter the allowed HTML tags for activity content and message content. It extends the with new tags (img, span, ul, ol & li) and leaves specific functions to the 2 components to include filters so that it is possible to restrict/extend allowed HTML tags for both content types or one of them. It also restricts the WP Editor available buttons when used into the BP Nouveau Messages UI so that they are consistent with the allowed HTML tags.
Props DJPaul
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/7795">#7795</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpactivitybpactivityfiltersphp">trunk/src/bp-activity/bp-activity-filters.php</a></li>
<li><a href="#trunksrcbpcorebpcorefunctionsphp">trunk/src/bp-core/bp-core-functions.php</a></li>
<li><a href="#trunksrcbpmessagesbpmessagesfiltersphp">trunk/src/bp-messages/bp-messages-filters.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypresscommonjstemplatesmessagesindexphp">trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaucssbuddypressrtlcss">trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaucssbuddypresscss">trunk/src/bp-templates/bp-nouveau/css/buddypress.css</a></li>
<li><a href="#trunksrcbptemplatesbpnouveauincludesmessagesfunctionsphp">trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveauincludesmessagesloaderphp">trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveausass_nouveau_messagesscss">trunk/src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpactivitybpactivityfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-activity/bp-activity-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-activity/bp-activity-filters.php 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-activity/bp-activity-filters.php 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,36 +202,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string $content Filtered activity content.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_activity_filter_kses( $content ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- global $allowedtags;
-
- $activity_allowedtags = $allowedtags;
- $activity_allowedtags['a']['aria-label'] = array();
- $activity_allowedtags['a']['class'] = array();
- $activity_allowedtags['a']['data-bp-tooltip'] = array();
- $activity_allowedtags['a']['id'] = array();
- $activity_allowedtags['a']['rel'] = array();
- $activity_allowedtags['a']['title'] = array();
-
- $activity_allowedtags['b'] = array();
- $activity_allowedtags['code'] = array();
- $activity_allowedtags['i'] = array();
-
- $activity_allowedtags['img'] = array();
- $activity_allowedtags['img']['src'] = array();
- $activity_allowedtags['img']['alt'] = array();
- $activity_allowedtags['img']['width'] = array();
- $activity_allowedtags['img']['height'] = array();
- $activity_allowedtags['img']['class'] = array();
- $activity_allowedtags['img']['id'] = array();
-
- $activity_allowedtags['span'] = array();
- $activity_allowedtags['span']['class'] = array();
- $activity_allowedtags['span']['data-livestamp'] = array();
-
- $activity_allowedtags['ul'] = array();
- $activity_allowedtags['ol'] = array();
- $activity_allowedtags['li'] = array();
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the allowed HTML tags for BuddyPress Activity content.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -239,7 +209,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $value Array of allowed HTML tags and attributes.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', $activity_allowedtags );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $activity_allowedtags = apply_filters( 'bp_activity_allowed_tags', bp_get_allowedtags() );
</ins><span class="cx" style="display: block; padding: 0 10px"> return wp_kses( $content, $activity_allowedtags );
</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="trunksrcbpcorebpcorefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-functions.php 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-core/bp-core-functions.php 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3803,3 +3803,40 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> return (array) apply_filters( 'bp_email_get_unsubscribe_type_schema', $emails );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Get BuddyPress content allowed tags.
+ *
+ * @since 3.0.0
+ *
+ * @global array $allowedtags KSES allowed HTML elements.
+ * @return array BuddyPress content allowed tags.
+ */
+function bp_get_allowedtags() {
+ global $allowedtags;
+
+ return array_merge_recursive( $allowedtags, array(
+ 'a' => array(
+ 'aria-label' => array(),
+ 'class' => array(),
+ 'data-bp-tooltip' => array(),
+ 'id' => array(),
+ 'rel' => array(),
+ ),
+ 'img' => array(
+ 'src' => array(),
+ 'alt' => array(),
+ 'width' => array(),
+ 'height' => array(),
+ 'class' => array(),
+ 'id' => array(),
+ ),
+ 'span'=> array(
+ 'class' => array(),
+ 'data-livestamp' => array(),
+ ),
+ 'ul' => array(),
+ 'ol' => array(),
+ 'li' => array(),
+ ) );
+}
</ins></span></pre></div>
<a id="trunksrcbpmessagesbpmessagesfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-messages/bp-messages-filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/bp-messages-filters.php 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-messages/bp-messages-filters.php 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,16 +18,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_thread_excerpt', 'wp_filter_kses', 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_messages_subject_value', 'wp_filter_kses', 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_messages_content_value', 'wp_filter_kses', 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 );
-
-add_filter( 'messages_message_content_before_save', 'wp_filter_kses', 1 );
</del><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'messages_message_subject_before_save', 'wp_filter_kses', 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_filter( 'messages_notice_message_before_save', 'wp_filter_kses', 1 );
</del><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'messages_notice_subject_before_save', 'wp_filter_kses', 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-add_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 );
</del><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_the_thread_subject', 'wp_filter_kses', 1 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'bp_get_the_thread_message_content', 'bp_messages_filter_kses', 1 );
+add_filter( 'messages_message_content_before_save', 'bp_messages_filter_kses', 1 );
+add_filter( 'messages_notice_message_before_save', 'bp_messages_filter_kses', 1 );
+add_filter( 'bp_get_message_thread_content', 'bp_messages_filter_kses', 1 );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'messages_message_content_before_save', 'force_balance_tags' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'messages_message_subject_before_save', 'force_balance_tags' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'messages_notice_message_before_save', 'force_balance_tags' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,6 +44,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_thread_subject', 'wptexturize' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_thread_excerpt', 'wptexturize' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_the_thread_message_content', 'wptexturize' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'bp_get_message_thread_content', 'wptexturize' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_notice_subject', 'convert_smilies', 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_notice_text', 'convert_smilies', 2 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,6 +51,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_thread_subject', 'convert_smilies', 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_thread_excerpt', 'convert_smilies', 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_the_thread_message_content', 'convert_smilies', 2 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'bp_get_message_thread_content', 'convert_smilies', 2 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_notice_subject', 'convert_chars' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_notice_text', 'convert_chars' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,22 +58,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_thread_subject', 'convert_chars' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_thread_excerpt', 'convert_chars' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_the_thread_message_content', 'convert_chars' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'bp_get_message_thread_content', 'convert_chars' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_notice_text', 'make_clickable', 9 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_the_thread_message_content', 'make_clickable', 9 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'bp_get_message_thread_content', 'make_clickable', 9 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_message_notice_text', 'wpautop' );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_get_the_thread_message_content', 'wpautop' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'bp_get_message_thread_content', 'wpautop' );
</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_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' );
-add_filter( 'bp_get_message_notice_text', 'stripslashes_deep' );
-add_filter( 'bp_get_message_thread_subject', 'stripslashes_deep' );
-add_filter( 'bp_get_message_thread_excerpt', 'stripslashes_deep' );
-add_filter( 'bp_get_message_get_recipient_usernames', 'stripslashes_deep' );
-add_filter( 'bp_get_messages_subject_value', 'stripslashes_deep' );
-add_filter( 'bp_get_messages_content_value', 'stripslashes_deep' );
-add_filter( 'bp_get_the_thread_message_content', 'stripslashes_deep' );
-add_filter( 'bp_get_the_thread_subject', 'stripslashes_deep' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_filter( 'bp_get_message_notice_subject', 'stripslashes_deep' );
+add_filter( 'bp_get_message_notice_text', 'stripslashes_deep' );
+add_filter( 'bp_get_message_thread_subject', 'stripslashes_deep' );
+add_filter( 'bp_get_message_thread_excerpt', 'stripslashes_deep' );
+add_filter( 'bp_get_message_get_recipient_usernames', 'stripslashes_deep' );
+add_filter( 'bp_get_messages_subject_value', 'stripslashes_deep' );
+add_filter( 'bp_get_messages_content_value', 'stripslashes_deep' );
+add_filter( 'bp_get_the_thread_message_content', 'stripslashes_deep' );
+add_filter( 'bp_get_the_thread_subject', 'stripslashes_deep' );
+add_filter( 'bp_get_message_thread_content', 'stripslashes_deep', 1 );
</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"> * Enforce limitations on viewing private message contents
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -98,3 +103,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $args;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_after_has_message_threads_parse_args', 'bp_messages_enforce_current_user', 5 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Custom kses filtering for message content.
+ *
+ * @since 3.0.0
+ *
+ * @param string $content The message content.
+ * @return string The filtered message content.
+ */
+function bp_messages_filter_kses( $content ) {
+ $messages_allowedtags = bp_get_allowedtags();
+ $messages_allowedtags['p'] = array();
+
+ /**
+ * Filters the allowed HTML tags for BuddyPress Messages content.
+ *
+ * @since 3.0.0
+ *
+ * @param array $value Array of allowed HTML tags and attributes.
+ */
+ $messages_allowedtags = apply_filters( 'bp_messages_allowed_tags', $messages_allowedtags );
+ return wp_kses( $content, $messages_allowedtags );
+}
</ins></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaubuddypresscommonjstemplatesmessagesindexphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,8 +41,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <script type="text/html" id="tmpl-bp-messages-editor">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Temporarily filter the editor
- add_filter( 'mce_buttons', 'bp_nouveau_mce_buttons', 10, 1 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Add a temporary filter on editor buttons
+ add_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> wp_editor(
</span><span class="cx" style="display: block; padding: 0 10px"> '',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,8 +58,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'textarea_rows' => 5,
</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">- // Temporarily filter the editor
- remove_filter( 'mce_buttons', 'bp_nouveau_mce_buttons', 10, 1 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Remove the temporary filter on editor buttons
+ remove_filter( 'mce_buttons', 'bp_nouveau_messages_mce_buttons', 10, 1 );
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </script>
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaucssbuddypressrtlcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3069,7 +3069,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"> .bp-messages-content #thread-preview .preview-message {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clear: both;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ overflow: hidden;
</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"> .bp-messages-content #thread-preview .preview-content {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3138,7 +3138,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"> .bp-messages-content #bp-message-thread-list .message-content {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clear: both;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ overflow: hidden;
</ins><span class="cx" style="display: block; padding: 0 10px"> margin: 1em auto 0;
</span><span class="cx" style="display: block; padding: 0 10px"> width: 90%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaucssbuddypresscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/css/buddypress.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/css/buddypress.css 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-templates/bp-nouveau/css/buddypress.css 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3069,7 +3069,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"> .bp-messages-content #thread-preview .preview-message {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clear: both;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ overflow: hidden;
</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"> .bp-messages-content #thread-preview .preview-content {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3138,7 +3138,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"> .bp-messages-content #bp-message-thread-list .message-content {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clear: both;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ overflow: hidden;
</ins><span class="cx" style="display: block; padding: 0 10px"> margin: 1em auto 0;
</span><span class="cx" style="display: block; padding: 0 10px"> width: 90%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludesmessagesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -299,14 +299,23 @@
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Disable the WP Editor buttons not allowed in messages content.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @param array $buttons The WP Editor buttons list.
+ * @param array The filtered WP Editor buttons list.
</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 bp_nouveau_mce_buttons( $buttons = array() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function bp_nouveau_messages_mce_buttons( $buttons = array() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $remove_buttons = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp_more',
</span><span class="cx" style="display: block; padding: 0 10px"> 'spellchecker',
</span><span class="cx" style="display: block; padding: 0 10px"> 'wp_adv',
</span><span class="cx" style="display: block; padding: 0 10px"> 'fullscreen',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'alignleft',
+ 'alignright',
+ 'aligncenter',
+ 'formatselect',
</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 unused buttons
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludesmessagesloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,21 +102,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Messages
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_messages_admin_nav', 'bp_nouveau_messages_adjust_admin_nav', 10, 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- remove_filter( 'messages_notice_message_before_save', 'wp_filter_kses', 1 );
- remove_filter( 'messages_message_content_before_save', 'wp_filter_kses', 1 );
- remove_filter( 'bp_get_the_thread_message_content', 'wp_filter_kses', 1 );
-
- add_filter( 'messages_notice_message_before_save', 'wp_filter_post_kses', 1 );
- add_filter( 'messages_message_content_before_save', 'wp_filter_post_kses', 1 );
- add_filter( 'bp_get_the_thread_message_content', 'wp_filter_post_kses', 1 );
- add_filter( 'bp_get_message_thread_content', 'wp_filter_post_kses', 1 );
- add_filter( 'bp_get_message_thread_content', 'wptexturize' );
- add_filter( 'bp_get_message_thread_content', 'stripslashes_deep', 1 );
- add_filter( 'bp_get_message_thread_content', 'convert_smilies', 2 );
- add_filter( 'bp_get_message_thread_content', 'convert_chars' );
- add_filter( 'bp_get_message_thread_content', 'make_clickable', 9 );
- add_filter( 'bp_get_message_thread_content', 'wpautop' );
</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></pre></div>
<a id="trunksrcbptemplatesbpnouveausass_nouveau_messagesscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss 2018-05-05 13:15:05 UTC (rev 12066)
+++ trunk/src/bp-templates/bp-nouveau/sass/_nouveau_messages.scss 2018-05-06 10:47:08 UTC (rev 12067)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -192,7 +192,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> margin-top: $marg-lrg;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .preview-message {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clear: both;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ overflow: hidden;
</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"> .preview-content {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -263,7 +263,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"> .message-content {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clear: both;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ overflow: hidden;
</ins><span class="cx" style="display: block; padding: 0 10px"> margin: 1em auto 0;
</span><span class="cx" style="display: block; padding: 0 10px"> width: 90%;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>