192 | | if ( 'string' === $format ) { |
193 | | if ( ! empty( $link ) ) { |
194 | | $retval = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>'; |
| 192 | if ( 'string' === $format ) { |
| 193 | if ( ! empty( $link ) ) { |
| 194 | $retval = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>'; |
| 195 | } else { |
| 196 | $retval = esc_html( $text ); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Filters the new message notification text before the notification is created. |
| 201 | * |
| 202 | * This is a dynamic filter. Possible filter names are: |
| 203 | * - 'bp_messages_multiple_new_message_notification'. |
| 204 | * - 'bp_messages_single_new_message_notification'. |
| 205 | * |
| 206 | * @param string $retval Notification text. |
| 207 | * @param int $total_items Number of messages referred to by the notification. |
| 208 | * @param string $text The raw notification test (ie, not wrapped in a link). |
| 209 | * @param int $item_id ID of the associated item. |
| 210 | * @param int $secondary_item_id ID of the secondary associated item. |
| 211 | */ |
| 212 | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', $retval, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
196 | | $retval = esc_html( $text ); |
| 214 | /** This filter is documented in bp-messages/bp-messages-notifications.php */ |
| 215 | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', array( |
| 216 | 'text' => $text, |
| 217 | 'link' => $link |
| 218 | ), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| 219 | } |
| 220 | |
| 221 | // Custom notification action for the Messages component |
| 222 | } else { |
| 223 | $return_array = array( |
| 224 | 'text' => $text, |
| 225 | 'link' => $link |
| 226 | ); |
| 227 | |
| 228 | /** |
| 229 | * Backcompat for plugins that used to filter bp_messages_single_new_message_notification |
| 230 | * for their custom actions. These plugins should now use 'bp_messages_' . $action . '_notification' |
| 231 | */ |
| 232 | if ( 'new_message' !== $action && has_filter( 'bp_messages_single_new_message_notification' ) ) { |
| 233 | $return_array = apply_filters( 'bp_messages_single_new_message_notification', $return_array, $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
212 | | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', $retval, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
213 | | } else { |
214 | | /** This filter is documented in bp-messages/bp-messages-notifications.php */ |
215 | | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', array( |
216 | | 'text' => $text, |
217 | | 'link' => $link |
218 | | ), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| 248 | $return = apply_filters( 'bp_messages_' . $action . '_notification', $return_array, $item_id, $secondary_item_id, $total_items, $format ); |