function twitter_block_linkify in Twitter Block 7
Same name and namespace in other branches
- 6 twitter_block.module \twitter_block_linkify()
Convert nested URLs, account names and hash tags into links.
1 call to twitter_block_linkify()
- twitter_block_preprocess_twitter_block_tweet in ./
twitter_block.module - Implements hook_preprocess().
File
- ./
twitter_block.module, line 323 - A module to provide simple Twitter blocks using the Twitter Search API.
Code
function twitter_block_linkify($status_text) {
// Linkify URLs.
$status_text = preg_replace('/(https?:\\/\\/\\S+)/', '<a href="\\1">\\1</a>', $status_text);
// Linkify twitter users.
$status_text = preg_replace('/(^|\\s)@(\\w+)/', '\\1@<a href="http://twitter.com/\\2">\\2</a>', $status_text);
// Linkify tags.
$status_text = preg_replace('/(^|\\s)#([\\wåäöÅÄÖ]+)/', '\\1#<a href="http://search.twitter.com/search?q=%23\\2">\\2</a>', $status_text);
return $status_text;
}