diff options
Diffstat (limited to 'it_q.class')
-rw-r--r-- | it_q.class | 52 |
1 files changed, 52 insertions, 0 deletions
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 @@ +<?php +/* +** $Id$ +** +** Copyright (C) 1995-2008 by the ITools Authors. +** This file is part of ITools - the Internet Tools Library +** +** ITools is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 3 of the License, or +** (at your option) any later version. +** +** ITools is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program. If not, see <http://www.gnu.org/licenses/>. +** +** 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; +} + +} + +?> |