Back to Installer class

Method isManifest

public \SimpleXMLElement|null
isManifest
(mixed $file)
Is the XML file a valid Joomla installation manifest file.
Parameters
  • string $file An xmlfile path to check
Returns
  • \SimpleXMLElement|null A \SimpleXMLElement, or null if the file failed to parse
Since
  • 3.1
Class: Installer
Project: Joomla

Method isManifest - Source code

/**
 * Is the XML file a valid Joomla installation manifest file.
 *
 * @param   string  $file  An xmlfile path to check
 *
 * @return  \SimpleXMLElement|null  A \SimpleXMLElement, or null if the file failed to parse
 *
 * @since   3.1
 */
public function isManifest($file)
{
    $xml = simplexml_load_file($file);
    // If we cannot load the XML file return null
    if (!$xml) {
        return;
    }
    // Check for a valid XML root tag.
    if ($xml->getName() !== 'extension') {
        return;
    }
    // Valid manifest file return the object
    return $xml;
}