From 07f5140771388c9e0c8a99b0dd2e5d950bdb173b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 15:16:42 +1100 Subject: moving h-source subdir out. --- h-source/admin/Library/BoxParser.php | 69 ------------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 h-source/admin/Library/BoxParser.php (limited to 'h-source/admin/Library/BoxParser.php') diff --git a/h-source/admin/Library/BoxParser.php b/h-source/admin/Library/BoxParser.php deleted file mode 100644 index 90d2426..0000000 --- a/h-source/admin/Library/BoxParser.php +++ /dev/null @@ -1,69 +0,0 @@ -module name tag defines the name of the object that has to be instantiate and saved in the -//$modules property (that is an array referencing different module objects) array(moduleObj1,moduleObj2, ...) -//if the module class corresponding ot the module name tag does not exists, than no module is created and the next module name is checked -class BoxParser { - - public $modules = array(); //array referencing different module classes --> array(moduleObj1,moduleObj2, ...) See files inside the Application/Modules folder - - //$simpleXMLText: it has to be an XML text - //$type; it can be string or file. - public function __construct($simpleXMLText, $type = 'string') - { - if ($type === 'string') - { - if (@simplexml_load_string($simpleXMLText)) - { - $simpleXmlObj = simplexml_load_string($simpleXMLText); - $this->populate($simpleXmlObj); - } - } - else if ($type === 'file') - { - if (@simplexml_load_file($simpleXMLText)) - { - $simpleXmlObj = simplexml_load_file($simpleXMLText); - $this->populate($simpleXmlObj); - } - } - } - - //inistantiate the module objects and save them in the $this->modules property array - private function populate($simpleXmlObj) - { - foreach ($simpleXmlObj as $mod) - { - $className = 'Mod'.ucwords((string)$mod->type); - if (class_exists($className)) - { - if (file_exists(ROOT . DS . APPLICATION_PATH . DS . 'Modules' . DS . $className . '.php')) - { - $newModule = new $className($mod); - if ($newModule instanceof ModAbstract) - { - $this->modules[] = $newModule; - } - } - } - } - } - - //create the HTML of the modules - public function render() - { - $HTML = null; - foreach ($this->modules as $module) - { - $HTML .= $module->render(); - } - return $HTML; - } - -} \ No newline at end of file -- cgit v1.2.3