Table of Contents

escape

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Application Class JView Method escape Reference escape() Never Work in Progress

Applies escaping to a value.

Escaping is used to prepare data so that its characters are not interpreted as special characters. As an example, having ‘<’ signs in HTML documents can interfere with the markup of the page.

This is a flexible escape() method which allows any combination of methods to be used to escape values.

By default, the escape rules that have been defined in the object using the addEscape and setEscape methods are used. If additional parameters are provided, the escape methods specified in the method parameters are used instead.

Escape methods are specified by providing additional string parameters which contain the names of escape callback functions to be called (e.g. stripslashes, htmlspecialchars, etc.).

It is possible to perform escaping for values that are not strings by providing escape() methods that will operate on the supplied type.

This method returns the escaped value.

Syntax

mixed escape ( $value )

$value mixed is a variable containing the value to be escaped.

Examples

Example - Using Predefined Callbacks

$result = $view->escape($value);

will escape $value using the callback functions that have been setup.

Example - Using Replacement Callbacks

$result = $view->escape(
	$value,
	'stripslashes',
	'htmlspecialchars',
	array('StaticClass', 'method'),
	array($object, $method)
);

will escape $value using the specified callback functions.