From 3961bbf3195b9cdc057daf917e89e8fb6491d92b Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Thu, 11 Mar 2021 17:20:50 +0300 Subject: [PATCH] Fix warning on types not supported by JED --- .../libraries/rules/xmlmanifest.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php index b433331..cf89f20 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php @@ -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; }