| 132 | | if ( 'string' === $format ) { |
| 133 | | if ( ! empty( $link ) ) { |
| 134 | | $retval = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>'; |
| | 131 | if ( 'string' === $format ) { |
| | 132 | if ( ! empty( $link ) ) { |
| | 133 | $return = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>'; |
| | 134 | } else { |
| | 135 | $return = esc_html( $text ); |
| | 136 | } |
| | 137 | |
| | 138 | /** |
| | 139 | * Filters the new message notification text before the notification is created. |
| | 140 | * |
| | 141 | * This is a dynamic filter. Possible filter names are: |
| | 142 | * - 'bp_messages_multiple_new_message_notification'. |
| | 143 | * - 'bp_messages_single_new_message_notification'. |
| | 144 | * |
| | 145 | * @param string $return Notification text. |
| | 146 | * @param int $total_items Number of messages referred to by the notification. |
| | 147 | * @param string $text The raw notification test (ie, not wrapped in a link). |
| | 148 | * @param int $item_id ID of the associated item. |
| | 149 | * @param int $secondary_item_id ID of the secondary associated item. |
| | 150 | */ |
| | 151 | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| | 152 | } else { |
| | 153 | /** This filter is documented in bp-messages/bp-messages-notifications.php */ |
| | 154 | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', array( |
| | 155 | 'text' => $text, |
| | 156 | 'link' => $link |
| | 157 | ), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| | 158 | } |
| | 159 | |
| | 160 | // Custom notification action for the Messages component |
| | 161 | } else { |
| | 162 | if ( 'string' === $format ) { |
| | 163 | $return = $text; |
| 140 | | * Filters the new message notification text before the notification is created. |
| | 172 | * Backcompat for plugins that used to filter bp_messages_single_new_message_notification |
| | 173 | * for their custom actions. These plugins should now use 'bp_messages_' . $action . '_notification' |
| | 174 | */ |
| | 175 | if ( 'new_message' !== $action && has_filter( 'bp_messages_single_new_message_notification' ) ) { |
| | 176 | if ( 'string' === $format ) { |
| | 177 | /** This filter is documented in bp-messages/bp-messages-notifications.php */ |
| | 178 | $return = apply_filters( 'bp_messages_single_new_message_notification', $return, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| | 179 | |
| | 180 | // Notice that there are seven parameters instead of six? Ugh... |
| | 181 | } else { |
| | 182 | /** This filter is documented in bp-messages/bp-messages-notifications.php */ |
| | 183 | $return = apply_filters( 'bp_messages_single_new_message_notification', $return, $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| | 184 | } |
| | 185 | } |
| | 186 | |
| | 187 | /** |
| | 188 | * Filters the custom action notification text before the notification is created. |
| 152 | | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', $retval, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| 153 | | } else { |
| 154 | | /** This filter is documented in bp-messages/bp-messages-notifications.php */ |
| 155 | | $return = apply_filters( 'bp_messages_' . $amount . '_new_message_notification', array( |
| 156 | | 'text' => $text, |
| 157 | | 'link' => $link |
| 158 | | ), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id ); |
| | 199 | $return = apply_filters( 'bp_messages_' . $action . '_notification', $return, $item_id, $secondary_item_id, $total_items, $format ); |