extractMentionedUsernames() 공개 메소드

A mention is an occurrence of a username anywhere in a tweet.
public extractMentionedUsernames ( ) : array
리턴 array The usernames elements in the tweet.
예제 #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;
 }