function views_handler::sanitize_value

Same name in other branches
  1. 6.x-3.x includes/handlers.inc \views_handler::sanitize_value()

Sanitize the value for output.

Parameters

string $value: The value being rendered.

string $type: The type of sanitization needed. If not provided, check_plain() is used.

Return value

string Returns the safe value.

27 calls to views_handler::sanitize_value()
views_handler_area_text_custom::render_textarea_custom in handlers/views_handler_area_text_custom.inc
Render a text area with filter_xss_admin.
views_handler_field::render in handlers/views_handler_field.inc
Render the field.
views_handler_field_accesslog_path::render in modules/statistics/views_handler_field_accesslog_path.inc
Render the field.
views_handler_field_aggregator_category::render in modules/aggregator/views_handler_field_aggregator_category.inc
Render the field.
views_handler_field_aggregator_title_link::render in modules/aggregator/views_handler_field_aggregator_title_link.inc
Render the field.

... See full list

File

includes/handlers.inc, line 333

Class

views_handler
Base handler, from which all the other handlers are derived. It creates a common interface to create consistency amongst handlers and data.

Code

public function sanitize_value($value, $type = NULL) {
    if (!is_null($value) && strlen($value) > 0) {
        switch ($type) {
            case 'xss':
                $value = filter_xss($value);
                break;
            case 'xss_admin':
                $value = filter_xss_admin($value);
                break;
            case 'url':
                $value = check_url($value);
                break;
            default:
                $value = check_plain($value);
                break;
        }
    }
    return $value;
}