JFilterOutput/objectHTMLSafe
From Joomla! Documentation
< API15:JFilterOutput
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Makes an object safe to display in forms
Template:Description:JFilterOutput/objectHTMLSafe
Syntax[edit]
objectHTMLSafe(&$mixed, $quote_style=ENT_QUOTES, $exclude_keys='')
Parameter Name | Default Value | Description |
---|---|---|
&$mixed | An object to be parsed | |
$quote_style | ENT_QUOTES | The optional quote style for the htmlspecialchars function |
$exclude_keys | An optional single field name or array of field names not to be parsed (eg, for a textarea) |
Defined in[edit]
libraries/joomla/filter/filteroutput.php
Importing[edit]
jimport( 'joomla.filter.filteroutput' );
Source Body[edit]
function objectHTMLSafe( &$mixed, $quote_style=ENT_QUOTES, $exclude_keys='' )
{
if (is_object( $mixed ))
{
foreach (get_object_vars( $mixed ) as $k => $v)
{
if (is_array( $v ) || is_object( $v ) || $v == NULL || substr( $k, 1, 1 ) == '_' ) {
continue;
}
if (is_string( $exclude_keys ) && $k == $exclude_keys) {
continue;
} else if (is_array( $exclude_keys ) && in_array( $k, $exclude_keys )) {
continue;
}
$mixed->$k = htmlspecialchars( $v, $quote_style, 'UTF-8' );
}
}
}
[Edit See Also] Template:SeeAlso:JFilterOutput/objectHTMLSafe
Examples[edit]
<CodeExamplesForm />