function twitter_filter in Twitter 6.5
Same name and namespace in other branches
- 6.2 twitter.module \twitter_filter()
- 6.3 twitter.module \twitter_filter()
- 6.4 twitter.module \twitter_filter()
Implementation of hook_filter().
0 - Twitter @username converter: Converts Twitter-style @usernames into links to Twitter account pages. 1 - Twitter #hashtag converter: Converts Twitter-style #hashtags into links to hashtags.org. 2 - Twitter link converter: Makes links to be opened in new pages and adds nofollow attribute.
File
- ./
twitter.module, line 231 - Provides API integration with the Twitter microblogging service.
Code
function twitter_filter($op, $delta = 0, $format = -1, $text = '') {
switch ($op) {
case 'list':
return array(
0 => t('Twitter @username converter'),
1 => t('Twitter #hashtag converter'),
2 => t('Twitter link converter'),
3 => t('Embed Tweets'),
);
case 'description':
switch ($delta) {
case 0:
return t('Converts Twitter-style @usernames into links to Twitter account pages.');
case 1:
return t('Converts Twitter-style #hashtags into links to twitter.com. Note: this converts all text prefixed by a "#" symbol into a hashtag link, so it can cause problems with other text.');
case 2:
return t('Makes links in Twitter messages to be opened in new windows and adds rel="nofollow" so these links do not penalize SEO.');
case 3:
return t('Converts URLs for Twitter status updates into embedded Tweets. Should be sorted after the "Limit allowed HTML tags" filter, if used.');
default:
return;
}
case 'process':
switch ($delta) {
case 0:
return _twitter_filter_username($text);
case 1:
return _twitter_filter_hashtag($text);
case 2:
return _twitter_filter_link($text);
case 3:
return _twitter_filter_embed_tweet($text);
default:
return $text;
}
default:
return $text;
}
}