mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-31 21:51:46 +00:00
Fix warning on types not supported by JED
This commit is contained in:
parent
d023f84c3a
commit
3961bbf319
@ -87,11 +87,20 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule
|
|||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $types = array(
|
protected $joomlaTypes = array(
|
||||||
'component', 'file', 'language', 'library',
|
'component', 'file', 'language', 'library',
|
||||||
'module', 'package', 'plugin', 'template'
|
'module', 'package', 'plugin', 'template'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of JED extension types
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $jedTypes = array(
|
||||||
|
'component', 'module', 'package', 'plugin'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates the search and check
|
* Initiates the search and check
|
||||||
*
|
*
|
||||||
@ -137,20 +146,24 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule
|
|||||||
// Check extension type
|
// Check extension type
|
||||||
$type = (string) $xml['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));
|
$this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_TYPE', $type));
|
||||||
|
|
||||||
return true;
|
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
|
// Load DTD-like data for this extension type
|
||||||
$json_filename = __DIR__ . '/xmlmanifest/dtd_' . $type . '.json';
|
$json_filename = __DIR__ . '/xmlmanifest/dtd_' . $type . '.json';
|
||||||
|
|
||||||
if (!is_file($json_filename))
|
if (!is_file($json_filename))
|
||||||
{
|
{
|
||||||
$this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_TYPE_NOT_ACCEPTED', $type));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user