API16:JApplicationHelper/parseXMLInstallFile
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Parse a XML install manifest file.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
static parseXMLInstallFile($path)
| Parameter Name | Default Value | Description |
|---|---|---|
| $path | $path Full path to xml file. |
Returns
array XML metadata.
Defined in
libraries/joomla/application/helper.php
Importing
jimport( 'joomla.application.helper' );
Source Body
public static function parseXMLInstallFile($path) { // Read the file to see if it's a valid component XML file if( ! $xml = JFactory::getXML($path)) { return false; } /* * Check for a valid XML root tag. * * Should be 'install', but for backward compatability we will accept 'extension'. * Languages are annoying and use 'metafile' instead */ if($xml->getName() != 'install' && $xml->getName() != 'extension' && $xml->getName() != 'metafile') { unset($xml); return false; } $data = array(); $data['legacy'] = ($xml->getName() == 'mosinstall' || $xml->getName() == 'install'); $data['name'] = (string)$xml->name; // check if we're a language if so use that $data['type'] = $xml->getName() == 'metafile' ? 'language' : (string)$xml->attributes()->type; $data['creationDate'] =((string)$xml->creationDate) ? (string)$xml->creationDate : JText::_('Unknown'); $data['author'] =((string)$xml->author) ? (string)$xml->author : JText::_('Unknown'); $data['copyright'] = (string)$xml->copyright; $data['authorEmail'] = (string)$xml->authorEmail; $data['authorUrl'] = (string)$xml->authorUrl; $data['version'] = (string)$xml->version; $data['description'] = (string)$xml->description; $data['group'] = (string)$xml->group; return $data; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
