API15

JFilterOutput/objectHTMLSafe: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
No edit summary
m preparing for archive only
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JFilterOutput/objectHTMLSafe|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JFilterOutput/objectHTMLSafe}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 60: Line 60:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JFilterOutput/objectHTMLSafe|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JFilterOutput/objectHTMLSafe}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=objectHTMLSafe
  category=objectHTMLSafe
  category=JFilterOutput
  category=JFilterOutput
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Latest revision as of 00:38, 25 March 2017

Description

Makes an object safe to display in forms

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

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

libraries/joomla/filter/filteroutput.php

Importing

jimport( 'joomla.filter.filteroutput' );

Source Body

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' );
                }
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples