Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
/**
12
 * Marks a variable as being safe for output.
13
 *
14
 * @package    symfony
15
 * @subpackage view
16
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17
 * @version    SVN: $Id: sfOutputEscaperSafe.class.php 16553 2009-03-24 16:49:06Z Kris.Wallsmith $
18
 */
19
class sfOutputEscaperSafe extends ArrayIterator
20
{
21
  protected
22
    $value = null;
23
 
24
  /**
25
   * Constructor.
26
   *
27
   * @param mixed $value  The value to mark as safe
28
   */
29
  public function __construct($value)
30
  {
31
    $this->value = $value;
32
 
33
    if (is_array($value) || is_object($value))
34
    {
35
      parent::__construct($value);
36
    }
37
  }
38
 
39
  public function __toString()
40
  {
41
    return (string) $this->value;
42
  }
43
 
44
  public function __get($key)
45
  {
46
    return $this->value->$key;
47
  }
48
 
49
  public function __set($key, $value)
50
  {
51
    $this->value->$key = $value;
52
  }
53
 
54
  public function __call($method, $arguments)
55
  {
56
    return call_user_func_array(array($this->value, $method), $arguments);
57
  }
58
 
59
  public function __isset($key)
60
  {
61
    return isset($this->value->$key);
62
  }
63
 
64
  public function __unset($key)
65
  {
66
    unset($this->value->$key);
67
  }
68
 
69
  /**
70
   * Returns the embedded value.
71
   *
72
   * @return mixed The embedded value
73
   */
74
  public function getValue()
75
  {
76
    return $this->value;
77
  }
78
}