summaryrefslogtreecommitdiff
path: root/it_q.class
blob: 3458b10f561a075ed990c66071db28a1fb556b6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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;
}

}

?>