API15

JApplicationHelper/parseXMLInstallFile

< API15:JApplicationHelper

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

<! removed transcluded page call, red link never existed >

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;
}


<! removed transcluded page call, red link never existed >

Examples

Code Examples


Advertisement