-
(mixed) escape ($escapingMethod, $value)
Browse code
| $escapingMethod |
The escaping method (a PHP callable) 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 InvalidArgumentException 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
-
(bool) isClassMarkedAsSafe ($class)
Browse code
Returns true if the class if marked as safe.
returns true if the class if safe, false otherwise
-
markClassAsSafe ($class)
Browse code
Marks a class (and all its children) as being safe for output.
-
markClassesAsSafe ($classes)
Browse code
| $classes |
An array of class names |
Marks an array of classes (and all its children) as being safe for output.
-
(mixed) unescape ($value)
Browse code
| $value |
The value to unescape |
Unescapes a value that has been escaped previously with the escape() method.
returns Unescaped value
throws InvalidArgumentException If the escaping fails
-
__construct ($escapingMethod, $value)
Browse code
| $escapingMethod |
Escaping method |
| $value |
Escaping value |
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