33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-12-28 12:30:44 +00:00

Fix warning on types not supported by JED

This commit is contained in:
Denis Ryabov 2021-03-11 17:20:50 +03:00
parent d023f84c3a
commit 3961bbf319

View File

@ -87,11 +87,20 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule
*
* @var string[]
*/
protected $types = array(
protected $joomlaTypes = array(
'component', 'file', 'language', 'library',
'module', 'package', 'plugin', 'template'
);
/**
* List of JED extension types
*
* @var string[]
*/
protected $jedTypes = array(
'component', 'module', 'package', 'plugin'
);
/**
* Initiates the search and check
*
@ -137,20 +146,24 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule
// Check extension type
$type = (string) $xml['type'];
if (!in_array($type, $this->types, true))
if (!in_array($type, $this->joomlaTypes, true))
{
$this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_TYPE', $type));
return true;
}
// JED allows components, modules, plugins, and packages (as a container) only
if (!in_array($type, $this->jedTypes, true))
{
$this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_TYPE_NOT_ACCEPTED', $type));
}
// Load DTD-like data for this extension type
$json_filename = __DIR__ . '/xmlmanifest/dtd_' . $type . '.json';
if (!is_file($json_filename))
{
$this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_TYPE_NOT_ACCEPTED', $type));
return true;
}