<!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][13812] trunk/src/bp-notifications/bp-notifications-template.php: Notifications component: improve PHP code standards using WPCS</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/13812">13812</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/13812","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>2024-04-27 09:27:26 +0000 (Sat, 27 Apr 2024)</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'>Notifications component: improve PHP code standards using WPCS
See <a href="http://buddypress.trac.wordpress.org/ticket/7228">#7228</a> (trunk)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpnotificationsbpnotificationstemplatephp">trunk/src/bp-notifications/bp-notifications-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpnotificationsbpnotificationstemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-notifications/bp-notifications-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-notifications/bp-notifications-template.php 2024-04-27 01:50:48 UTC (rev 13811)
+++ trunk/src/bp-notifications/bp-notifications-template.php 2024-04-27 09:27:26 UTC (rev 13812)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,7 +16,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_notifications_slug() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_notifications_slug();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_url( bp_get_notifications_slug() );
</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"> * Return the notifications component slug.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -46,7 +46,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $user_id The user ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_notifications_permalink( $user_id = 0 ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_notifications_permalink( $user_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_url( bp_get_notifications_permalink( $user_id ) );
</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"> * Return the notifications permalink.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,7 +88,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $user_id The user ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_notifications_unread_permalink( $user_id = 0 ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_notifications_unread_permalink( $user_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_url( bp_get_notifications_unread_permalink( $user_id ) );
</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"> * Return the unread notifications permalink.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -129,7 +129,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $user_id The user ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_notifications_read_permalink( $user_id = 0 ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_notifications_read_permalink( $user_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_url( bp_get_notifications_read_permalink( $user_id ) );
</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"> * Return the read notifications permalink.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -293,7 +293,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_id() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_id();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo intval( bp_get_the_notification_id() );
</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"> * Return the ID of the notification currently being iterated on.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -320,7 +320,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_item_id() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_item_id();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo intval( bp_get_the_notification_item_id() );
</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"> * Return the associated item ID of the notification currently being iterated on.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -347,7 +347,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_secondary_item_id() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_secondary_item_id();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo intval( bp_get_the_notification_secondary_item_id() );
</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"> * Return the secondary associated item ID of the notification currently being iterated on.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -374,7 +374,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_component_name() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_component_name();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_html( bp_get_the_notification_component_name() );
</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"> * Return the name of the component associated with the notification currently being iterated on.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -401,7 +401,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_component_action() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_component_action();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_html( bp_get_the_notification_component_action() );
</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"> * Return the name of the action associated with the notification currently being iterated on.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -408,7 +408,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return int Name of the action associated with the current notification.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string Name of the action associated with the current notification.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_get_the_notification_component_action() {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -417,7 +417,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</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 $component_action Name of the action associated with the current notification.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $component_action Name of the action associated with the current notification.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> return apply_filters( 'bp_get_the_notification_component_action', buddypress()->notifications->query_loop->notification->component_action );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -428,7 +428,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_date_notified() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_date_notified();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_html( bp_get_the_notification_date_notified() );
</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"> * Return the timestamp of the current notification.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -455,7 +455,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_time_since() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_time_since();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_html( bp_get_the_notification_time_since() );
</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"> * Return the timestamp of the current notification.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -494,7 +494,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_description() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_the_notification_description();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo wp_kses(
+ bp_get_the_notification_description(),
+ array(
+ 'a' => array(
+ 'href' => true,
+ 'class' => true,
+ ),
+ )
+ );
</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"> * Get full-text description for a specific notification.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -543,6 +551,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $user_id The user ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_mark_read_link( $user_id = 0 ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Escaping is made in `bp_get_the_notification_mark_read_link()`.
+ // phpcs:ignore WordPress.Security.EscapeOutput
</ins><span class="cx" style="display: block; padding: 0 10px"> echo bp_get_the_notification_mark_read_link( $user_id );
</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">@@ -558,7 +568,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set default user ID to use.
</span><span class="cx" style="display: block; padding: 0 10px"> $user_id = 0 === $user_id ? bp_displayed_user_id() : $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">- $retval = sprintf( '<a href="%1$s" class="mark-read primary">%2$s</a>', esc_url( bp_get_the_notification_mark_read_url( $user_id ) ), __( 'Read', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $retval = sprintf( '<a href="%1$s" class="mark-read primary">%2$s</a>', esc_url( bp_get_the_notification_mark_read_url( $user_id ) ), esc_html__( 'Read', 'buddypress' ) );
</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"> * Filters the mark read link for the current notification.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -597,7 +607,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_get_the_notification_mark_read_url( $user_id = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Get the notification ID.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $id = bp_get_the_notification_id();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $id = bp_get_the_notification_id();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Get the args to add to the URL.
</span><span class="cx" style="display: block; padding: 0 10px"> $args = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -635,6 +645,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $user_id The user ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_mark_unread_link( $user_id = 0 ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Escaping is done in `bp_get_the_notification_mark_unread_link()`.
+ // phpcs:ignore WordPress.Security.EscapeOutput
</ins><span class="cx" style="display: block; padding: 0 10px"> echo bp_get_the_notification_mark_unread_link( $user_id );
</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">@@ -650,7 +662,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set default user ID to use.
</span><span class="cx" style="display: block; padding: 0 10px"> $user_id = 0 === $user_id ? bp_displayed_user_id() : $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">- $retval = sprintf( '<a href="%1$s" class="mark-unread primary bp-tooltip">%2$s</a>', esc_url( bp_get_the_notification_mark_unread_url( $user_id ) ), __( 'Unread', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $retval = sprintf( '<a href="%1$s" class="mark-unread primary bp-tooltip">%2$s</a>', esc_url( bp_get_the_notification_mark_unread_url( $user_id ) ), esc_html__( 'Unread', 'buddypress' ) );
</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"> * Filters the link used for marking a single notification as unread.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -727,6 +739,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $user_id The user ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_mark_link( $user_id = 0 ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Escaping is made in `bp_get_the_notification_mark_read_link()` & `bp_get_the_notification_mark_unread_link()`.
+ // phpcs:ignore WordPress.Security.EscapeOutput
</ins><span class="cx" style="display: block; padding: 0 10px"> echo bp_get_the_notification_mark_link( $user_id );
</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">@@ -769,6 +783,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $user_id The user ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_delete_link( $user_id = 0 ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Escaping is made in `bp_get_the_notification_delete_link()`.
+ // phpcs:ignore WordPress.Security.EscapeOutput
</ins><span class="cx" style="display: block; padding: 0 10px"> echo bp_get_the_notification_delete_link( $user_id );
</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">@@ -784,7 +800,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set default user ID to use.
</span><span class="cx" style="display: block; padding: 0 10px"> $user_id = 0 === $user_id ? bp_displayed_user_id() : $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">- $retval = sprintf( '<a href="%1$s" class="delete secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_notification_delete_url( $user_id ) ), __( 'Delete', 'buddypress' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $retval = sprintf( '<a href="%1$s" class="delete secondary confirm bp-tooltip">%2$s</a>', esc_url( bp_get_the_notification_delete_url( $user_id ) ), esc_html__( 'Delete', 'buddypress' ) );
</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"> * Filters the delete link for the current notification.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -867,6 +883,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array|string $args Array of arguments.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_the_notification_action_links( $args = '' ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // phpcs:ignore WordPress.Security.EscapeOutput
</ins><span class="cx" style="display: block; padding: 0 10px"> echo bp_get_the_notification_action_links( $args );
</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">@@ -923,7 +940,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_notifications_pagination_count() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo bp_get_notifications_pagination_count();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo esc_html( bp_get_notifications_pagination_count() );
</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"> * Return the pagination count for the current notification loop.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -962,6 +979,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.9.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_notifications_pagination_links() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Escaping is done in WordPress's `paginate_links()` function.
+ // phpcs:ignore WordPress.Security.EscapeOutput
</ins><span class="cx" style="display: block; padding: 0 10px"> echo bp_get_notifications_pagination_links();
</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">@@ -1007,8 +1026,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <label for="notifications-sort-order-list"><?php esc_html_e( 'Order By:', 'buddypress' ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <select id="notifications-sort-order-list" name="sort_order" onchange="this.form.submit();">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <option value="DESC" <?php selected( $selected, 'DESC' ); ?>><?php _e( 'Newest First', 'buddypress' ); ?></option>
- <option value="ASC" <?php selected( $selected, 'ASC' ); ?>><?php _e( 'Oldest First', 'buddypress' ); ?></option>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <option value="DESC" <?php selected( $selected, 'DESC' ); ?>><?php esc_html_e( 'Newest First', 'buddypress' ); ?></option>
+ <option value="ASC" <?php selected( $selected, 'ASC' ); ?>><?php esc_html_e( 'Oldest First', 'buddypress' ); ?></option>
</ins><span class="cx" style="display: block; padding: 0 10px"> </select>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <noscript>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1028,17 +1047,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <label class="bp-screen-reader-text" for="notification-select"><?php
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: accessibility text */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _e( 'Select Bulk Action', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ esc_html_e( 'Select Bulk Action', 'buddypress' );
</ins><span class="cx" style="display: block; padding: 0 10px"> ?></label>
</span><span class="cx" style="display: block; padding: 0 10px"> <select name="notification_bulk_action" id="notification-select">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <option value="" selected="selected"><?php _e( 'Bulk Actions', 'buddypress' ); ?></option>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <option value="" selected="selected"><?php esc_html_e( 'Bulk Actions', 'buddypress' ); ?></option>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( bp_is_current_action( 'unread' ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <option value="read"><?php _e( 'Mark read', 'buddypress' ); ?></option>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <option value="read"><?php esc_html_e( 'Mark read', 'buddypress' ); ?></option>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php elseif ( bp_is_current_action( 'read' ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <option value="unread"><?php _e( 'Mark unread', 'buddypress' ); ?></option>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <option value="unread"><?php esc_html_e( 'Mark unread', 'buddypress' ); ?></option>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <option value="delete"><?php _e( 'Delete', 'buddypress' ); ?></option>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <option value="delete"><?php esc_html_e( 'Delete', 'buddypress' ); ?></option>
</ins><span class="cx" style="display: block; padding: 0 10px"> </select>
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="submit" id="notification-bulk-manage" class="button action" value="<?php esc_attr_e( 'Apply', 'buddypress' ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span></span></pre>
</div>
</div>
</body>
</html>