From 084367bc780b7bdc1957f8cbf59af931edac0456 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 11 May 2021 23:08:21 +0300 Subject: [PATCH] check prefixed names --- .../com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini | 1 + .../components/com_jedchecker/libraries/rules/xmlinfo.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini b/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini index 13b3220..3fd6930 100644 --- a/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini +++ b/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini @@ -46,6 +46,7 @@ COM_JEDCHECKER_INFO_XML_VERSION_XML="Version tag has the value: %s" COM_JEDCHECKER_INFO_XML_CREATIONDATE_XML="The creationDate tag has the value: %s" COM_JEDCHECKER_INFO_XML_NO_MANIFEST="No manifest file found" COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS="Keywords such as module, plugin or template are considered reserved words ('%2$s') and can't be used in the extension names ('%1$s')" +COM_JEDCHECKER_INFO_XML_NAME_PREFIXED="Listing name ('%s') starts with extension type prefix" COM_JEDCHECKER_INFO_XML_NAME_VERSION="Version in name/title ('%s')" COM_JEDCHECKER_INFO_XML_NAME_JOOMLA="An extension name ('%s') can't start with the word 'Joomla'" COM_JEDCHECKER_INFO_XML_NAME_JOOMLA_DERIVATIVE="Extensions that use 'Joomla' or a derivative of Joomla in the extension name ('%s') need to be licensed by OSM" diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php index 45e4958..e5c88a7 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php @@ -140,6 +140,12 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS', $extensionName, strtolower($match[0]))); } + // Extension name shouldn't start with extension type prefix + if (preg_match('/^\s*(?:mod|com|plg|tpl|pkg)_/i', $extensionName)) + { + $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_PREFIXED', $extensionName)); + } + // NM5 - Version in name/title if (preg_match('/(?:\bversion\b|\d\.\d)/i', $extensionName)) {