33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-11-27 23:36:38 +00:00

add list of alternative plugin group names

This commit is contained in:
Denis Ryabov 2021-02-24 00:20:09 +03:00
parent 75b6aa0f47
commit 5771fb0203

View File

@ -47,6 +47,18 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
*/
protected $description = 'COM_JEDCHECKER_INFO_XML_DESC';
/**
* Mapping of the plugin title prefix to the plugin group
*
* @var string[]
*/
protected $pluginsGroupMap = array(
'button' => 'editors-xtd',
'editor' => 'editors',
'smartsearch' => 'finder',
'twofactorauthentication' => 'twofactorauth'
);
/**
* Initiates the search and check
*
@ -253,7 +265,11 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
{
$parts = explode(' - ', $extension_name, 2);
$extension_name_group = isset($parts[1]) ? strtolower(preg_replace('/\s/', '', $parts[0])) : false;
if ($extension_name_group !== (string) $xml['group'])
$group = (string) $xml['group'];
if ($extension_name_group !== $group && $extension_name_group !== str_replace('-', '', $group)
&& !(isset($this->pluginsGroupMap[$extension_name_group]) && $this->pluginsGroupMap[$extension_name_group] === $group)
)
{
$this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_PLUGIN_FORMAT', $extension_name));
}