* eaxs report->setDefaultSubtype($this->id); // Find all XML files of the extension $files = JEDCheckerHelper::findManifests($this->basedir); // Iterate through all the xml files foreach ($files as $file) { // Try to find the license $this->find($file); } } /** * Reads a file and searches for the license * * @param string $file - The path to the file * * @return boolean True if the license was found, otherwise False. */ protected function find($file) { $xml = simplexml_load_file($file); // Failed to parse the xml file. // Assume that this is not a extension manifest if (!$xml) { return true; } // Check if there's a license tag if (!isset($xml->license)) { $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_FOUND')); return false; } // Check if the license is gpl if (stripos($xml->license, 'gpl') === false && stripos($xml->license, 'general public license') === false) { $this->report->addCompat($file, Text::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_GPL')); return false; } // All checks passed. Return true return true; } }