class twitter_views_handler_field_xss in Twitter 6.5
Same name and namespace in other branches
- 6.2 twitter_views_field_handlers.inc \twitter_views_handler_field_xss
- 6.3 twitter_views_field_handlers.inc \twitter_views_handler_field_xss
- 6.4 twitter_views_field_handlers.inc \twitter_views_handler_field_xss
- 7.6 twitter_views_field_handlers.inc \twitter_views_handler_field_xss
- 7.3 twitter_views_field_handlers.inc \twitter_views_handler_field_xss
- 7.4 twitter_views_field_handlers.inc \twitter_views_handler_field_xss
- 7.5 twitter_views_field_handlers.inc \twitter_views_handler_field_xss
Process Twitter-style @usernames and URLs before filtering XSS.
Hierarchy
- class \twitter_views_handler_field_xss extends \views_handler_field
Expanded class hierarchy of twitter_views_handler_field_xss
1 string reference to 'twitter_views_handler_field_xss'
- twitter_views_data in ./
twitter.views.inc - Implementation of hook_views_data()
File
- ./
twitter_views_field_handlers.inc, line 10 - Views handlers for Twitter module.
View source
class twitter_views_handler_field_xss extends views_handler_field {
function option_definition() {
$options = parent::option_definition();
$options['link_urls'] = array(
'default' => TRUE,
);
$options['link_usernames'] = array(
'default' => TRUE,
);
$options['link_hashtags'] = array(
'default' => TRUE,
);
$options['link_attributes'] = array(
'default' => TRUE,
);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['link_urls'] = array(
'#title' => t('Link urls to their destinations'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['link_urls']),
);
$form['link_usernames'] = array(
'#title' => t('Link Twitter @usernames to their Twitter.com urls'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['link_usernames']),
);
$form['link_hashtags'] = array(
'#title' => t('Link Twitter #hashtags to another url'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['link_hashtags']),
);
$form['link_attributes'] = array(
'#title' => t('Open links in new windows/tabs and add rel="nofollow" attributes.'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['link_attributes']),
);
}
/**
* Processes the message through the selected options.
*/
function render($values) {
$value = $values->{$this->field_alias};
// Load the options.
$usernames = TRUE;
if (isset($this->options['link_usernames'])) {
$usernames = $this->options['link_usernames'];
}
$hashtags = TRUE;
if (isset($this->options['link_hashtags'])) {
$hashtags = $this->options['link_hashtags'];
}
$attributes = TRUE;
if (isset($this->options['link_attributes'])) {
$attributes = $this->options['link_attributes'];
}
$urls = TRUE;
if (isset($this->options['link_urls'])) {
$urls = $this->options['link_urls'];
}
// Offload processing to the shared function.
return twitter_filter_message($value, $usernames, $hashtags, $attributes, $urls);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
twitter_views_handler_field_xss:: |
function | |||
twitter_views_handler_field_xss:: |
function | |||
twitter_views_handler_field_xss:: |
function | Processes the message through the selected options. |