JRules/ construct: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 4: | Line 4: | ||
===Syntax=== | ===Syntax=== | ||
| Line 48: | Line 48: | ||
===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