|
Revision 16553, 1.4 kB
(checked in by Kris.Wallsmith, 4 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 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 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 |
|
|---|