-
(mixed) escape ($escapingMethod, $value, )
Browse code
| $escapingMethod |
the escaping method (a PHP function) to apply to the value |
| $value |
the value to escape |
Decorates a PHP variable with something that will escape any data obtained
from it.
The following cases are dealt with:
- The value is null or false: null or false is returned.
- The value is scalar: the result of applying the escaping method is
returned.
- The value is an array or an object that implements the ArrayAccess
interface: the array is decorated such that accesses to elements yield
an escaped value.
- The value implements the Traversable interface (either an Iterator, an
IteratorAggregate or an internal PHP class that implements
Traversable): decorated much like the array.
- The value is another type of object: decorated such that the result of
method calls is escaped.
The escaping method is actually the name of a PHP callable. There are a set
of standard escaping methods listed in the escaping helper
(EscapingHelper.php).
returns Escaping value
throws sfException If the escaping fails
-
(mixed) getRawValue ()
Browse code
Returns the raw value associated with this instance.
Concrete instances of sfOutputEscaper classes decorate a value which is
stored by the constructor. This returns that original, unescaped, value.
returns The original value used to construct the decorator
-
Constructor stores the escaping method and value.
Since sfOutputEscaper is an abstract class, instances cannot be created
directly but the constructor will be inherited by sub-classes.
-
Gets a value from the escaper.
returns Value