function addMenuItens(&$xml, &$menu, $idp, &$core, $inModule = "") { if ($xml->data[0] != 'xhtml') { // not the BASE node $tm = $core->loaded(strtolower($xml->data[0]), true); // check if this is a module if (!is_object($tm) && $inModule != '') { $tm = $core->loaded($inModule, true); } // if not a module, but we are INSIDE a module, inherit it if (is_object($tm)) { $inModule = $tm->name; } else { $inModule = ""; } $permissionTag = strtolower($xml->data[0]) == 'new' ? CONS_ACTION_INCLUDE : (strtolower($xml->data[0]) == 'list' ? true : strtolower($xml->data[0])); if ($permissionTag == $inModule || $inModule == '') { $permissionTag = true; } $perm = $inModule == '' || is_object($tm) && $core->authControl->checkPermission($tm, $permissionTag); // permission to see this? if ($perm) { // yes, add this item // Check the listing options for this module, if any if ($xml->data[1] != '') { $xml->data[1] = xmlParamsParser($xml->data[1]); if (is_object($tm) && isset($xml->data[1]['listing'])) { $tm->options[CONS_MODULE_LISTING] = $xml->data[1]['listing']; } } // prepare the item $id = 1000 + count($menu) + 1; $item = array('id' => $id, 'id_parent' => $idp, 'title' => $core->langOut($xml->data[0]), 'link' => $xml->data[2], 'icon' => isset($xml->data[1]['icon']) ? $xml->data[1]['icon'] : 'list'); if (is_object($tm)) { $item['listing'] = isset($tm->options[CONS_MODULE_LISTING]) ? $tm->options[CONS_MODULE_LISTING] : array(); $item['module'] = $tm->name; } // add $menu[] = $item; } } else { $id = $idp; $perm = true; } // and recursivelly add all child nodes IF this node was allowed to be seen if ($perm) { $total = $xml->total(); for ($c = 0; $c < $total; $c++) { $this->addMenuItens($xml->getbranch($c), $menu, $id, $core, $inModule); } } }
private function parseparams($data) { // arrives as xxx="yy yy yy" zzz="11 22 33", leaves as array # Supports W3C (mandatory quotes) or single-worded unquoted parameters return xmlParamsParser($data); }