function twitter_filter_message in Twitter 6.5
Same name and namespace in other branches
- 7.6 twitter.module \twitter_filter_message()
- 7.5 twitter.module \twitter_filter_message()
Convert embedded URLs, hashtags and usernames in a tweet to links.
Parameters
string $message: The tweet's text.
bool $usernames: Whether or not to convert usernames to links. Defaults to TRUE.
bool $hashtags: Whether or not to convert hashtags to links. Defaults to TRUE.
bool $attributes: Whether or not to add extra attributes to links. Defaults to TRUE.
bool $urls: Whether or not to convert other URLs to links. Defaults to TRUE.
Return value
string The filtered tweet text.
1 call to twitter_filter_message()
- twitter_views_handler_field_xss::render in ./
twitter_views_field_handlers.inc - Processes the message through the selected options.
File
- ./
twitter.module, line 377 - Provides API integration with the Twitter microblogging service.
Code
function twitter_filter_message($message, $usernames = TRUE, $hashtags = TRUE, $attributes = TRUE, $urls = TRUE) {
// Link usernames with their profiles.
if ($usernames) {
$message = _twitter_filter_username($message);
}
// Link hashtags.
if ($hashtags) {
$message = _twitter_filter_hashtag($message);
}
// Add extra attributes to links.
if ($attributes) {
$message = _twitter_filter_link($message);
}
// Standard URLs.
if ($urls) {
$message = _filter_url($message, FILTER_DEFAULT);
}
// Avoid XSS within the message.
return filter_xss($message);
}