symfony API

sfOutputEscaper Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.0 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

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.
  • __construct(, )
    Constructor stores the escaping method and value.
  • mixed __get()
    Gets a value from the escaper.

Method Details

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

  • __construct (, ) Browse code

    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 () Browse code

    Gets a value from the escaper.

    returns Value