/** * Scans a directory for XML manifest files. The first XML file to be a * manifest wins. * * @var $path string The path to look into * * @return string|bool The full path to a manifest file or false if not found */ private function searchForManifest($path) { jimport('joomla.filesystem.folder'); $files = JFolder::files($path, '\\.xml$', false, true); if (!empty($files)) { foreach ($files as $filename) { if (version_compare(JVERSION, '3.0.0', 'ge')) { try { $xml = new JXMLElement($filename, LIBXML_NONET, true); } catch (Exception $e) { continue; } if ($xml->getName() != 'extension') { continue; } unset($xml); return $filename; } else { $xml = JFactory::getXMLParser('simple'); $result = $xml->loadFile($filename); if (!$result) { continue; } if ($xml->document->name() != 'install' && $xml->document->name() != 'extension' && $xml->document->name() != 'mosinstall') { continue; } unset($xml); return $filename; } } } return false; }