lithium\template\Helper::escape()

public method

Escapes values according to the output type of the rendering context. Helpers that output to non-HTML/XML contexts should override this method accordingly.

Parameters

  • string $value
  • mixed $method
  • array $options

Returns

mixed

Source

	public function escape($value, $method = null, array $options = []) {
		$defaults = ['escape' => true];
		$options += $defaults;

		if ($options['escape'] === false) {
			return $value;
		}
		if (is_array($value)) {
			return array_map([$this, __FUNCTION__], $value);
		}
		return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
	}