API16

JRules/ construct: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Constructor. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{D...
 
m clean up
Line 2: Line 2:
Constructor.
Constructor.


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JRules/__construct|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JRules/__construct}}
 
{{subst:Description:JRules/__construct}}


===Syntax===
===Syntax===
Line 49: Line 47:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JRules/__construct|Edit See Also]]<nowiki>]</nowiki>
{{subst:SeeAlso:JRules/__construct}}
</span>
{{SeeAlso:JRules/__construct}}


===Examples===
===Examples===

Revision as of 14:22, 24 March 2017

Description

Constructor.


{{subst:Description:JRules/__construct}}

Syntax

__construct($input= '')
Parameter Name Default Value Description
$input A JSON format string (probably from the database), or a nested array.

Defined in

libraries/joomla/access/rules.php

Importing

jimport( 'joomla.access.rules' );

Source Body

public function __construct($input = '')
{
        // Convert in input to an array.
        if (is_string($input)) {
                $input = json_decode($input, true);
        }
        else if (is_object($input)) {
                $input = (array) $input;
        }

        if (is_array($input))
        {
                // Top level keys represent the actions.
                foreach ($input as $action => $identities) {
                        $this->mergeAction($action, $identities);
                }
        }
}


{{subst:SeeAlso:JRules/__construct}}

Examples

<CodeExamplesForm />