symfony API

sfOutputEscaper Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.4 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:

Abstract class that provides an interface for escaping of output.

Inheritence

sfOutputEscaperGetterDecorator  <  sfOutputEscaper

Method Summary

  • mixed escape($escapingMethod, $value)
    Decorates a PHP variable with something that will escape any data obtained
  • mixed getRawValue()
    Returns the raw value associated with this instance.
  • bool isClassMarkedAsSafe($class)
    Returns true if the class if marked as safe.
  • markClassAsSafe($class)
    Marks a class (and all its children) as being safe for output.
  • markClassesAsSafe($classes)
    Marks an array of classes (and all its children) as being safe for output.
  • mixed unescape($value)
    Unescapes a value that has been escaped previously with the escape() method.
  • __construct($escapingMethod, $value)
    Constructor stores the escaping method and value.
  • mixed __get($var)
    Gets a value from the escaper.

Method Details

  • (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

    $class A class name

    Returns true if the class if marked as safe.

    returns true if the class if safe, false otherwise

  • markClassAsSafe ($class) Browse code

    $class A class name

    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.

  • (mixed) __get ($var) Browse code

    $var Value to get

    Gets a value from the escaper.

    returns Value