Exemplo n.º 1
0
 /**
  * Constructor.
  *
  * The input array must be in the form: array('action' => array(-42 => true, 3 => true, 4 => false))
  * or an equivalent JSON encoded string, or an object where properties are arrays.
  *
  * @param   mixed  $input  A JSON format string (probably from the database) or a nested array.
  *
  * @return  JRules
  *
  * @since   11.1
  */
 public function __construct($input = '', $component = '', $section = '')
 {
     if ($component && $section) {
         $this->_actions = CCKAccess::getActions($component, $section, 'name');
     }
     // Convert in input to an array.
     if (is_string($input)) {
         $input = json_decode($input, true);
     } elseif (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);
         }
     }
 }