/**
* Escapes a value for output in a view script.
*
* If escaping mechanism is htmlspecialchars, use
* {@link $_charset} setting.
*
* @param mixed $var The output to escape.
*
* @return mixed The escaped value.
*
* @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($var)
{
if ($var === null) {
return '';
}
return htmlspecialchars($var, ENT_QUOTES, $this->_charset);
}