_is_safe_html = $string->_is_safe_html; $string = $string->unescaped(); } $this->_raw_string = (string) $string; } /** * Factory method returning a new SafeString instance for the given string. */ static function of($string) { return new SafeString($string); } /** * Marks this string as safe to be used in HTML without any escaping. */ function mark_html_safe() { $this->_is_safe_html = true; return $this; } /** * Safe for use in HTML. * @see #for_html() */ function __toString() { if ($this->_is_safe_html) { return $this->_raw_string; } else { return self::_escape_for_html($this->_raw_string); } } /** * Safe for use in HTML. * * Example:
*= $php_var ?> * * @return the string escaped for use in HTML. */ function for_html() { return $this; } /** * Safe for use in JavaScript. * * Example:*