Changeset 4998
- Timestamp:
- 06/24/2013 04:19:41 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/includes/core/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/core/functions.php
r4995 r4998 285 285 286 286 /** 287 * Set the pattern used for matching usernames for mentions. 288 * 289 * Moved into its own function to allow filtering of the regex pattern 290 * anywhere mentions might be used. 291 * 292 * @since bbPress (r4997) 293 * @return string Pattern to match usernames with 294 */ 295 function bbp_find_mentions_pattern() { 296 return apply_filters( 'bbp_find_mentions_pattern', '/[@]+([A-Za-z0-9-_\.@]+)\b/' ); 297 } 298 299 /** 287 300 * Searches through the content to locate usernames, designated by an @ sign. 288 301 * … … 293 306 */ 294 307 function bbp_find_mentions( $content = '' ) { 295 $pattern = '/[@]+([A-Za-z0-9-_\.@]+)\b/';308 $pattern = bbp_find_mentions_pattern(); 296 309 preg_match_all( $pattern, $content, $usernames ); 297 310 $usernames = array_unique( array_filter( $usernames[1] ) ); 298 311 299 312 // Bail if no usernames 300 if ( empty( $usernames ) ) 301 return false; 302 303 return $usernames; 313 if ( empty( $usernames ) ) { 314 $usernames = false; 315 } 316 317 return apply_filters( 'bbp_find_mentions', $usernames, $pattern, $content ); 304 318 } 305 319
Note: See TracChangeset
for help on using the changeset viewer.