public function xmlToElement(ModelObject $element, SimpleXMLExtended $xml) { if (($id = $xml->attribute('id')) !== null) { $element->ElementID = intval($id); } if (($id = $xml->attribute('slug')) !== null) { $element->Slug = strval($id); } if (($id = $xml->attribute('pluginid')) !== null) { $element->PluginID = strval($id); } /* if ($xml->creation_date) $element->CreationDate = $this->DateFactory->newStorageDate(strval($xml->creation_date)); if ($xml->modified_date) $element->ModifiedDate = $this->DateFactory->newStorageDate(strval($xml->modified_date)); */ foreach (array('Name', 'Description', 'DefaultOrder') as $key) { $xmlKey = StringUtils::underscore($key); $element->{$key} = strval($xml->info->{$xmlKey}); } $element->AllowSlugSlashes = StringUtils::strToBool($xml->info->allow_slug_slashes); $element->BaseURL = strval($xml->info->base_url); if (isset($xml->info->node_class)) { $element->NodeClass = strval($xml->info->node_class); } else { $element->NodeClass = 'Node'; } $aspectSlugs = array(); foreach ($xml->aspects->children() as $aspectNode) { if ($aspectNode->getName() == 'aspect') { $aspectSlugs[] = $aspectNode->attribute('slug'); } } $element->AspectSlugs = $aspectSlugs; if ($xml->storage_facility) { foreach ($xml->storage_facility as $sfXML) { $info = new StorageFacilityInfo(); $info->For = $sfXML->attribute('for') != null ? $sfXML->attribute('for') : 'media'; $info->GenerateRewriteRules = StringUtils::strToBool($sfXML->attribute('generate_rewrite_rules')); $info->ObjectRef = strval($sfXML->attribute('ref')); $params = new StorageFacilityParams(); $params->BaseURI = strval($sfXML->base_uri); $params->BaseStoragePath = strval($sfXML->base_storage_path); $params->Domain = strval($sfXML->domain); if (($ssl = $sfXML->attribute('ssl')) !== null) { $params->SSL = StringUtils::strToBool($ssl); } $info->StorageFacilityParams = $params; $element->setStorageFacilityInfo($info->For, $info); } } return $element; }