function tweet_feed_format_output in Tweet Feed 6
Same name and namespace in other branches
- 8.3 tweet_feed.module \tweet_feed_format_output()
- 7.3 tweet_feed.module \tweet_feed_format_output()
- 7 tweet_feed.module \tweet_feed_format_output()
- 7.2 tweet_feed.module \tweet_feed_format_output()
- 4.x tweet_feed.module \tweet_feed_format_output()
tweet_feed_format_output($tweet) makes links, hash tags, and usernames clickable.
1 call to tweet_feed_format_output()
- tweet_feed_process_tweets in ./
tweet_feed.module - process tweet data from what we have retrieved from the Twitter API
File
- ./
tweet_feed.module, line 273
Code
function tweet_feed_format_output($tweet) {
/* based on our preference, assign all links to new windows or to the same window */
$target = variable_get('tweet_feed_new_window', 0) == 1 ? '_blank' : '_self';
/* look for links and make them clickable */
$tweet = preg_replace('/(((f|ht){1}tp:\\/\\/)[-a-zA-Z0-9@:%_\\+.~#?&\\/\\/=]+)/i', '<a target="' . $target . '" href="\\1">\\1</a>', $tweet);
$tweet = preg_replace('/(((f|ht){1}tps:\\/\\/)[-a-zA-Z0-9@:%_\\+.~#?&\\/\\/=]+)/i', '<a target="' . $target . '" href="\\1">\\1</a>', $tweet);
$tweet = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\\+.~#?&\\/\\/=]+)/i', '\\1<a target="' . $target . '" href="http:\\/\\/\\2">\\2</a>', $tweet);
$tweet = preg_replace('/([_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,3})/i', '<a href="mailto:\\1">\\1</a>', $tweet);
return $tweet;
}