public function __construct(array $options = array()) { if (isset($options['one_script_root'])) { $this->_root = $options['one_script_root']; unset($options['one_script_root']); } // precedence: // POST > GET > constructor options > defaults > parent defaults $defaults = array('id' => null, 'schemeName' => null, 'task' => null, 'view' => null, 'parseContentPlugins' => false); // @deprecated params should never come in through $_POST // should be replaced by: // $request = JRequest::get('get'); $request = array_merge($_GET, $_POST); // convert order to one format (foo+ or foo-) if (array_key_exists('order', $options)) { $options['order'] = $options['order'] . ($options['orderdirection'] == 'asc' ? '+' : '-'); } // merge everything $options = array_merge($defaults, $options, $request); parent::__construct($options); }
/** * Decode the options and decide what needs to be done. * * The precedence has changed in this version of one|content. Now, we take the options as precedence, and * overlay them over the menu item we are on. * * @param array $options */ public function __construct(array $options = array()) { $app = JFactory::getApplication(); $defaults = array('id' => null, 'scheme' => null, 'task' => null, 'oview' => null, 'parseContentPlugins' => false); // get menu parameters $menu_options = array(); if (($menu = $app->getMenu()->getActive()) && $menu->component == 'com_one') { $menu_options = array_merge($menu->params->toArray(), $menu->query); // if the scheme in the request differs from the one specified in the menu, the menu options become invalid if (array_key_exists('scheme', $options) && $menu_options['scheme'] != $options['scheme']) { $menu_options = array(); } // retrieve eventual additional parameters to be passed as in the request if (isset($menu_options['extraParameters'])) { $extras = parse_ini_string($menu_options['extraParameters']); unset($menu_options['extraParameters']); $menu_options = array_merge($menu_options, $extras); foreach ($extras as $key => $value) { $options[$key] = $value; } } } if (isset($options['oview'])) { $options['view'] = $options['oview']; } $options = array_merge($defaults, $menu_options, $options); // convert order to one format (foo+ or foo-) if (array_key_exists('order', $options)) { $options['order'] = $options['order'] . ($options['orderdirection'] == 'asc' ? '+' : '-'); } $this->parseContentPlugins = (bool) $options['parseContentPlugins']; // @TODO WTF is noflow ? if (!isset($options['noflow'])) { $options['noflow'] = true; } else { $options['noflow'] = (bool) $options['noflow']; } parent::__construct($options); }