API16

JApplicationHelper/parseXMLLangMetaFile

From Joomla! Documentation

< API16:JApplicationHelper
Revision as of 21:49, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)

The "API16" 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 edit link to red link >]

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

Syntax[edit]

static parseXMLLangMetaFile($path)
Parameter Name Default Value Description
$path

Defined in[edit]

libraries/joomla/application/helper.php

Importing[edit]

jimport( 'joomla.application.helper' );

Source Body[edit]

public static function parseXMLLangMetaFile($path)
{
        // Read the file to see if it's a valid component XML file
        $xml = JFactory::getXML($path);

        if( ! $xml)
        {
                return false;
        }

        /*
         * Check for a valid XML root tag.
         *
         * Should be 'langMetaData'.
         */
        if ($xml->getName() != 'metafile') {
                unset($xml);
                return false;
        }

        $data = array();

        $data['name'] = (string)$xml->name;
        $data['type'] = $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[edit]

<CodeExamplesForm />