extractMentionedUsernames() public method

A mention is an occurrence of a username anywhere in a tweet.
public extractMentionedUsernames ( ) : array
return array The usernames elements in the tweet.
Exemplo n.º 1
0
 /**
  * Extracts mentions from a Tweet.
  *
  * @param str $post_text The post text to search.
  * @return array $matches All mentions in this tweet.
  */
 public static function extractMentions($post_text)
 {
     if (!class_exists('Twitter_Extractor')) {
         Loader::addSpecialClass('Twitter_Extractor', 'plugins/twitter/extlib/twitter-text-php/lib/Twitter/Extractor.php');
     }
     $tweet = new Twitter_Extractor($post_text);
     $mentions = $tweet->extractMentionedUsernames();
     foreach ($mentions as $k => $v) {
         $mentions[$k] = '@' . $v;
     }
     return $mentions;
 }