Back to BaseLayout class

Method escape

public string
escape
(mixed $output)
Method to escape output.
Parameters
  • string $output The output to escape.
Returns
  • string The escaped output.
Since
  • 3.0
-
  • the ENT_COMPAT flag was replaced by ENT_QUOTES in Joomla 4.0 to also escape single quotes
Class: BaseLayout
Project: Joomla

Method escape - Source code

/**
 * Method to escape output.
 *
 * @param   string  $output  The output to escape.
 *
 * @return  string  The escaped output.
 *
 * @note the ENT_COMPAT flag was replaced by ENT_QUOTES in Joomla 4.0 to also escape single quotes
 *
 * @since   3.0
 */
public function escape($output)
{
    return $output === null ? '' : htmlspecialchars($output, ENT_QUOTES, 'UTF-8');
}