Actions

API15

JApplicationHelper/parseXMLInstallFile

From Joomla! Documentation

< API15:JApplicationHelper
Revision as of 17:09, 22 March 2010 by Doxiki (Talk | contribs)

Replacement filing cabinet.png
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.

[Edit Descripton]

Description:JApplicationHelper/parseXMLInstallFile

Contents

Syntax

parseXMLInstallFile($path)
Parameter Name Default Value Description
$path

Defined in

libraries/joomla/application/helper.php

Importing

jimport( 'joomla.application.helper' );

Source Body

function parseXMLInstallFile($path)
{
        // Read the file to see if it's a valid component XML file
        $xml = & JFactory::getXMLParser('Simple');
 
        if (!$xml->loadFile($path)) {
                unset($xml);
                return false;
        }
 
        /*
         * Check for a valid XML root tag.
         *
         * Should be 'install', but for backward compatability we will accept 'mosinstall'.
         */
        if ( !is_object($xml->document) || ($xml->document->name() != 'install' && $xml->document->name() != 'mosinstall')) {
                unset($xml);
                return false;
        }
 
        $data = array();
        $data['legacy'] = $xml->document->name() == 'mosinstall';
 
        $element = & $xml->document->name[0];
        $data['name'] = $element ? $element->data() : '';
        $data['type'] = $element ? $xml->document->attributes("type") : '';
 
        $element = & $xml->document->creationDate[0];
        $data['creationdate'] = $element ? $element->data() : JText::_('Unknown');
 
        $element = & $xml->document->author[0];
        $data['author'] = $element ? $element->data() : JText::_('Unknown');
 
        $element = & $xml->document->copyright[0];
        $data['copyright'] = $element ? $element->data() : '';
 
        $element = & $xml->document->authorEmail[0];
        $data['authorEmail'] = $element ? $element->data() : '';
 
        $element = & $xml->document->authorUrl[0];
        $data['authorUrl'] = $element ? $element->data() : '';
 
        $element = & $xml->document->version[0];
        $data['version'] = $element ? $element->data() : '';
 
        $element = & $xml->document->description[0];
        $data['description'] = $element ? $element->data() : '';
 
        $element = & $xml->document->group[0];
        $data['group'] = $element ? $element->data() : '';
 
        return $data;
}

[Edit See Also] SeeAlso:JApplicationHelper/parseXMLInstallFile

Examples

<CodeExamplesForm />