Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1463 alexandre_ 1
<?php
2
// +----------------------------------------------------------------------+
3
// | PEAR :: I18Nv2 :: DecoratedList :: HtmlSpecialchars                  |
4
// +----------------------------------------------------------------------+
5
// | This source file is subject to version 3.0 of the PHP license,       |
6
// | that is available at http://www.php.net/license/3_0.txt              |
7
// | If you did not receive a copy of the PHP license and are unable      |
8
// | to obtain it through the world-wide-web, please send a note to       |
9
// | license@php.net so we can mail you a copy immediately.               |
10
// +----------------------------------------------------------------------+
11
// | Copyright (c) 2004 Michael Wallner <mike@iworks.at>                  |
12
// +----------------------------------------------------------------------+
13
//
14
// $Id: HtmlSpecialchars.php,v 1.1 2007-06-25 09:55:28 alexandre_tb Exp $
15
 
16
/**
17
 * I18Nv2::DecoratedList::HtmlSpecialchars
18
 *
19
 * @package     I18Nv2
20
 * @category    Internationalization
21
 */
22
 
23
require_once 'I18Nv2/DecoratedList.php';
24
 
25
/**
26
 * I18Nv2_Decorator_HtmlSpecialchars
27
 *
28
 * When you are going to serve XHTML as XML or XHTML+XML then you will get
29
 * problems while displaying umlauts etc. as their HTML entities.
30
 *
31
 * @author      Michael Wallner <mike@php.net>
32
 * @version     $Revision: 1.1 $
33
 * @package     I18Nv2
34
 * @access      public
35
 */
36
class I18Nv2_DecoratedList_HtmlSpecialchars extends I18Nv2_DecoratedList
37
{
38
    /**
39
     * decorate
40
     *
41
     * @access  protected
42
     * @return  mixed
43
     * @param   mixed   $value
44
     */
45
    function decorate($value)
46
    {
47
        if (is_string($value)) {
48
            return htmlSpecialchars($value, ENT_QUOTES,
49
                $this->list->getEncoding());
50
        } elseif (is_array($value)) {
51
            return array_map(array(&$this, 'decorate'), $value);
52
        }
53
        return $value;
54
    }
55
}
56
?>