function twitter_views_handler_field_xss::render in Twitter 7.4
Same name and namespace in other branches
- 6.5 twitter_views_field_handlers.inc \twitter_views_handler_field_xss::render()
- 6.2 twitter_views_field_handlers.inc \twitter_views_handler_field_xss::render()
- 6.3 twitter_views_field_handlers.inc \twitter_views_handler_field_xss::render()
- 6.4 twitter_views_field_handlers.inc \twitter_views_handler_field_xss::render()
- 7.6 twitter_views_field_handlers.inc \twitter_views_handler_field_xss::render()
- 7.3 twitter_views_field_handlers.inc \twitter_views_handler_field_xss::render()
- 7.5 twitter_views_field_handlers.inc \twitter_views_handler_field_xss::render()
Processes the message through the selected options.
Overrides views_handler_field::render
File
- ./
twitter_views_field_handlers.inc, line 54 - Views handlers for Twitter module.
Class
- twitter_views_handler_field_xss
- Process Twitter-style @usernames and URLs before filtering XSS.
Code
function render($values) {
$value = $values->{$this->field_alias};
if (!empty($this->options['link_urls'])) {
$filter = new stdClass();
$filter->settings = array(
'filter_url_length' => 496,
);
$value = _filter_url($value, $filter);
}
// Link usernames with their profiles.
if (!empty($this->options['link_usernames'])) {
$value = _twitter_filter_text($value, '@', variable_get('twitter_host', TWITTER_HOST) . '/');
}
// Link hashtags.
if (!empty($this->options['link_hashtags']) && valid_url($this->options['hashtags_url'])) {
$value = _twitter_filter_text($value, '#', url($this->options['hashtags_url']));
}
// Add extra attributes to links.
if (!empty($this->options['link_attributes'])) {
$value = _twitter_filter_link($value, NULL);
}
// Avoid XSS within the message.
return filter_xss($value);
}