JRules/ construct: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Constructor.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{D... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
Constructor. | Constructor. | ||
===Syntax=== | ===Syntax=== | ||
| Line 49: | Line 47: | ||
</source> | </source> | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=__construct | category=__construct | ||
category=JRules | category=JRules | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 02:02, 25 March 2017
Description
Constructor.
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);
}
}
}
Examples
Code Examples