manifestObject->children as $element) { switch ($element->name) { // single elements case 'blurb': case 'description': case 'name': case 'author': case 'version': case 'website': case 'copyright': case 'license': case 'repository': case 'bugtracker': case 'donations': case 'activate_on_install': $parsed[$element->name] = $element->content; break; // arrays case 'category': $parsed[$element->name][] = $element->content; break; // 3d arrays case 'screenshot': case 'provides': case 'conflicts': case 'requires': case 'suggests': if (!isset($element->children)) { return false; } $info = array(); foreach ($element->children as $child_element) { $info[$child_element->name] = $child_element->content; } $parsed[$element->name][] = $info; break; } } // check we have all the required fields foreach ($this->requiredAttributes as $attr) { if (!array_key_exists($attr, $parsed)) { throw new PluginException(elgg_echo('PluginException:ParserErrorMissingRequiredAttribute', array($attr, $this->caller->getPluginID()))); } } $this->manifest = $parsed; if (!$this->manifest) { return false; } return true; } }