From 2ef85ec182278544ed7a625a319b8b0ee4edbc74 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Fri, 7 Nov 2008 15:33:07 +0000 Subject: First version of it_html based on objects --- it_q.class | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 it_q.class (limited to 'it_q.class') diff --git a/it_q.class b/it_q.class new file mode 100644 index 0000000..3458b10 --- /dev/null +++ b/it_q.class @@ -0,0 +1,52 @@ +. +** +** UltraHTML 3000 tool layer. Texts are now objects, used by it_html +** +**/ + +class it_q +{ + var $quote; + var $value; + +function __construct($value, $quote = true) +{ + $this->quote = $quote; + $this->value = $value; +} + +/** + * Return htmlspecialchars(strval($this)) and encode forbidden characters 80-9f if latin1 is output + * @return Encoded string value of this object + */ +function __toString() +{ + $result = strval($this->value); + + if ($GLOBALS['it_html']->p['charset'] == "iso-8859-1") + $result = preg_replace('/[\x80-\x9f]/', ' ', strtr($result, array("\x80" => "EUR", "\x82" => "'", "\x84" => "\"", "\x85" => "...", "\x8a" => "S", "\x8c" => "OE", "\x8e" => "Z", "\x91" => "'", "\x92" => "'", "\x93" => "\"", "\x94" => "\"", "\x96" => "-", "\x97" => "-", "\x9a" => "s", "\x9e" => "z"))); + + return $this->quote ? htmlspecialchars($result) : $result; +} + +} + +?> -- cgit v1.2.3