private function parse($allowedPlugins) { $content = file($this->file); $content = implode("", $content); $p = xml_parser_create(); xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); xml_parse_into_struct($p, $content, $vals, $index); if (xml_get_error_code($p)) { echo xml_error_string(xml_get_error_code($p)) . " at line " . xml_get_current_line_number($p); } xml_parser_free($p); if (isset($index["genericCollection"]) and isset($vals[$index["genericCollection"][0]])) { $this->genericCollection = $vals[$index["genericCollection"][0]]["value"] == "true"; } else { $this->genericCollection = false; } if (isset($index["genericSingle"]) and isset($vals[$index["genericSingle"][0]])) { $this->genericSingle = $vals[$index["genericSingle"][0]]["value"] == "true"; } else { $this->genericSingle = false; } if (isset($vals[$index["name"][0]])) { $this->name = $vals[$index["name"][0]]["value"]; } if (isset($index["folder"]) and isset($vals[$index["folder"][0]])) { foreach ($index["folder"] as $k => $v) { $this->folder[] = $vals[$index["folder"][$k]]["value"]; } } if (isset($vals[$index["icon"][0]]) and isset($vals[$index["icon"][0]]["value"])) { $this->icon = $vals[$index["icon"][0]]["value"]; } if (isset($index["menuName"]) and isset($vals[$index["menuName"][0]]) and isset($vals[$index["menuName"][0]]["value"])) { $this->menuName = $vals[$index["menuName"][0]]["value"]; } if (isset($index["javascript"]) and isset($vals[$index["javascript"][0]])) { $JS = array(); foreach ($index["javascript"] as $k => $v) { $JS[] = $vals[$index["javascript"][$k]]["value"]; } $this->javascript = $JS; #$vals[$index["javascript"][0]]["value"]; } if (isset($index["blockNonAdmin"]) and isset($vals[$index["blockNonAdmin"][0]])) { $this->blockNonAdmin = $vals[$index["blockNonAdmin"][0]]["value"] == "true"; } if (isset($index["adminOnly"]) and isset($vals[$index["adminOnly"][0]])) { $this->adminOnly = $vals[$index["adminOnly"][0]]["value"]; } else { $this->adminOnly = "false"; } if (isset($index["collection"]) and isset($vals[$index["collection"][0]])) { $this->collection = $vals[$index["collection"][0]]["value"]; } if (isset($index["doSomethingElse"]) and isset($vals[$index["doSomethingElse"][0]])) { $this->doSomethingElse = $vals[$index["doSomethingElse"][0]]["value"]; } if (isset($index["menuEntryTarget"]) and isset($vals[$index["menuEntryTarget"][0]])) { $this->menuEntryTarget = $vals[$index["menuEntryTarget"][0]]["value"]; } if (isset($index["version"]) and isset($vals[$index["version"][0]]) and isset($vals[$index["version"][0]]["value"])) { $this->version = $vals[$index["version"][0]]["value"]; } if (count($allowedPlugins) > 0 and !in_array($this->registerClassName(), $allowedPlugins)) { return; } if (isset($index["registry"]) and isset($vals[$index["registry"][0]])) { foreach ($index["registry"] as $k => $v) { $call = explode(";", $vals[$index["registry"][$k]]["value"]); #print_r($call); if (count($call) == 3) { Registry::setCallback($call[0], $call[1], $call[2]); } if (count($call) == 2) { Registry::setCallback($call[0], $call[1]); } #echo "callbacks:"; #print_r(Registry::getCallbacks($call[0], $call[2])); } } if (isset($index["collectionGUI"])) { for ($i = $index["collectionGUI"][0]; $i <= $index["collectionGUI"][count($index["collectionGUI"]) - 1]; $i++) { if ($vals[$i]["tag"] == "column") { if ($vals[$i]["value"] == "") { continue; } $name = $vals[$i]["value"]; if (!isset($this->collectionGUI["showAttributes"])) { $this->collectionGUI["showAttributes"] = array(); } $this->collectionGUI["showAttributes"][] = $name; if (isset($vals[$i]["attributes"])) { if (!isset($this->collectionGUI["rowStyle"])) { $this->collectionGUI["rowStyle"] = array(); } if (!isset($this->collectionGUI["colWidth"])) { $this->collectionGUI["colWidth"] = array(); } if (isset($vals[$i]["attributes"]["rowStyle"])) { $this->collectionGUI["rowStyle"][$name] = $vals[$i]["attributes"]["rowStyle"]; } if (isset($vals[$i]["attributes"]["colWidth"])) { $this->collectionGUI["colWidth"][$name] = $vals[$i]["attributes"]["colWidth"]; } } } } } }