Development

/branches/1.2/lib/view/escaper/sfOutputEscaperSafe.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/view/escaper/sfOutputEscaperSafe.class.php

Revision 16553, 1.4 kB (checked in by Kris.Wallsmith, 6 years ago)

[1.1, 1.2, 1.3] Added proxies to sfOutputEscaperSafe so safe vars work as expected when accessed from an action (closes #6147)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
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$
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 }
79
Note: See TracBrowser for help on using the browser.