diff --git a/administrator/components/com_jedchecker/libraries/rules/framework.php b/administrator/components/com_jedchecker/libraries/rules/framework.php index c8ca73a..48c82cf 100644 --- a/administrator/components/com_jedchecker/libraries/rules/framework.php +++ b/administrator/components/com_jedchecker/libraries/rules/framework.php @@ -238,7 +238,7 @@ class JedcheckerRulesFramework extends JEDcheckerRule break; default: // Case 'notice': - $this->report->addInfo($file, $error_message, $line_number); + $this->report->addNotice($file, $error_message, $line_number); break; } } diff --git a/administrator/components/com_jedchecker/libraries/rules/gpl.php b/administrator/components/com_jedchecker/libraries/rules/gpl.php index 3391885..29a251c 100644 --- a/administrator/components/com_jedchecker/libraries/rules/gpl.php +++ b/administrator/components/com_jedchecker/libraries/rules/gpl.php @@ -74,6 +74,8 @@ class JedcheckerRulesGpl extends JEDcheckerRule */ public function check() { + $this->report->setDefaultSubtype($this->id); + // Prepare regexp $this->init(); @@ -210,7 +212,7 @@ class JedcheckerRulesGpl extends JEDcheckerRule if (preg_match($this->regexGPLLicenses, $content, $match, PREG_OFFSET_CAPTURE)) { $lineno = substr_count($content, "\n", 0, $match[0][1]) + 1; - $this->report->addInfo( + $this->report->addPassed( $file, JText::_('COM_JEDCHECKER_PH1_LICENSE_FOUND'), $lineno, diff --git a/administrator/components/com_jedchecker/libraries/rules/jexec.php b/administrator/components/com_jedchecker/libraries/rules/jexec.php index 17ac9f6..07a2f72 100644 --- a/administrator/components/com_jedchecker/libraries/rules/jexec.php +++ b/administrator/components/com_jedchecker/libraries/rules/jexec.php @@ -81,6 +81,8 @@ class JedcheckerRulesJexec extends JEDcheckerRule */ public function check() { + $this->report->setDefaultSubtype($this->id); + $this->initJexec(); // Find all php files of the extension diff --git a/administrator/components/com_jedchecker/libraries/rules/language.php b/administrator/components/com_jedchecker/libraries/rules/language.php index 755d1f5..2ccaae4 100644 --- a/administrator/components/com_jedchecker/libraries/rules/language.php +++ b/administrator/components/com_jedchecker/libraries/rules/language.php @@ -127,7 +127,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check EOL format is \n (not \r or \n\r) if (strpos($content, "\r") !== false) { - $this->report->addInfo($file, JText::_('COM_JEDCHECKER_LANG_INCORRECT_EOL', false, false)); + $this->report->addNotice($file, JText::_('COM_JEDCHECKER_LANG_INCORRECT_EOL', false, false)); } $lines = file($file); @@ -263,7 +263,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check for empty value if ($value === '""') { - $this->report->addInfo($file, JText::_('COM_JEDCHECKER_LANG_TRANSLATION_EMPTY'), $startLineno, $line); + $this->report->addNotice($file, JText::_('COM_JEDCHECKER_LANG_TRANSLATION_EMPTY'), $startLineno, $line); continue; } @@ -350,7 +350,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check spaces around (but allow trailing space after colon) if (preg_match('/^\s|[^:]\s+$/', $value)) { - $this->report->addInfo($file, JText::_('COM_JEDCHECKER_LANG_SPACES_AROUND'), $startLineno, $line); + $this->report->addNotice($file, JText::_('COM_JEDCHECKER_LANG_SPACES_AROUND'), $startLineno, $line); } } } @@ -406,7 +406,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule if (!isset($this->langKeys[$key])) { $lineno = substr_count($content, "\n", 0, $match[1]); - $this->report->addInfo($file, JText::sprintf('COM_JEDCHECKER_LANG_UNKNOWN_KEY_IN_CODE', htmlspecialchars($key)), $lineno + 1, $lines[$lineno]); + $this->report->addNotice($file, JText::sprintf('COM_JEDCHECKER_LANG_UNKNOWN_KEY_IN_CODE', htmlspecialchars($key)), $lineno + 1, $lines[$lineno]); } } diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php index a626521..631609f 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php @@ -172,7 +172,8 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule // (and other reserved words) if (preg_match('/\b(?:module|plugin|component|template|extension|free)\b/i', $extensionName, $match)) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS', $extensionName, strtolower($match[0]))); + $this->report->addIssue(JEDcheckerReport::LEVEL_ERROR, 'NM3', $file, + JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS', $extensionName, strtolower($match[0]))); } // Extension name shouldn't start with extension type prefix @@ -184,14 +185,16 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule // NM5 - Version in name/title if (preg_match('/(?:\bversion\b|\d\.\d)/i', $extensionName)) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_VERSION', $extensionName)); + $this->report->addIssue(JEDcheckerReport::LEVEL_ERROR, 'NM5', $file, + JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_VERSION', $extensionName)); } // Check for "Joomla" in the name if (stripos($extensionName, 'joomla') === 0) { // An extension name can't start with the word "Joomla" - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_JOOMLA', $extensionName)); + $this->report->addIssue(JEDcheckerReport::LEVEL_ERROR, 'TM2', $file, + JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_JOOMLA', $extensionName)); } else { @@ -200,9 +203,8 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule if (stripos($cleanName, 'joom') !== false) { // Extensions that use "Joomla" or a derivative of Joomla in the extension name need to be licensed by OSM - $this->report->addWarning($file, - JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_JOOMLA_DERIVATIVE', $extensionName, 'https://tm.joomla.org/approved-domains.html') - ); + $this->report->addIssue(JEDcheckerReport::LEVEL_WARNING, 'TM2', $file, + JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_JOOMLA_DERIVATIVE', $extensionName, 'https://tm.joomla.org/approved-domains.html')); } } @@ -364,7 +366,8 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule if (stripos($domain, 'joomla') !== false) { // Extensions that use "Joomla" or a derivative of Joomla in the domain name need to be licensed by OSM - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_URL_JOOMLA_DERIVATIVE', $url, 'https://tm.joomla.org/approved-domains.html')); + $this->report->addIssue(JEDcheckerReport::LEVEL_ERROR, 'TM1', $file, + JText::sprintf('COM_JEDCHECKER_INFO_XML_URL_JOOMLA_DERIVATIVE', $url, 'https://tm.joomla.org/approved-domains.html')); } } } diff --git a/administrator/components/com_jedchecker/libraries/rules/xmllicense.php b/administrator/components/com_jedchecker/libraries/rules/xmllicense.php index 40116ce..a559cbb 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmllicense.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmllicense.php @@ -62,6 +62,8 @@ class JedcheckerRulesXMLlicense extends JEDcheckerRule */ public function check() { + $this->report->setDefaultSubtype($this->id); + // Find all XML files of the extension $files = JEDCheckerHelper::findManifests($this->basedir); diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php index 800a647..9e6523f 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php @@ -69,11 +69,11 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule protected $warnings; /** - * List of infos. + * List of notices. * * @var string[] */ - protected $infos; + protected $notices; /** * Rules for XML nodes @@ -183,7 +183,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule $this->errors = array(); $this->warnings = array(); - $this->infos = array(); + $this->notices = array(); // Validate manifest $this->validateXml($xml, 'extension'); @@ -198,9 +198,9 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule $this->report->addWarning($file, implode('
', $this->warnings)); } - if (count($this->infos)) + if (count($this->notices)) { - $this->report->addInfo($file, implode('
', $this->infos)); + $this->report->addNotice($file, implode('
', $this->notices)); } // All checks passed. Return true @@ -226,7 +226,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule // No known attributes for this node foreach ($node->attributes() as $attr) { - $this->infos[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, (string) $attr->getName()); + $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, (string) $attr->getName()); } } elseif ($DTDattributes[0] !== '*') // Skip node with arbitrary attributes (e.g. "field") @@ -238,7 +238,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (!in_array($attrName, $DTDattributes, true)) { // The node has unknown attribute - $this->infos[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, $attrName); + $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, $attrName); } } } @@ -254,7 +254,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule // No known children for this node if ($node->count() > 0) { - $this->infos[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILDREN', $name); + $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILDREN', $name); } } elseif (!isset($DTDchildRules['*'])) // Skip node with arbitrary children @@ -295,7 +295,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if ($count === 0) { // The node doesn't contain optional child element - $this->infos[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_OPTIONAL', $name, $child); + $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_OPTIONAL', $name, $child); } elseif ($count > 1) { @@ -324,7 +324,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (!isset($DTDchildToRule[$child])) { // The node contains unknown child element - $this->infos[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILD', $name, $child); + $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILD', $name, $child); } else { @@ -341,7 +341,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule { if ($child->count() === 0 && $child->attributes()->count() === 0 && (string) $child === '') { - $this->infos[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_EMPTY_CHILD', $child->getName()); + $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_EMPTY_CHILD', $child->getName()); } } } diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php b/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php index 94d505d..dc151d1 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php @@ -62,6 +62,8 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule */ public function check() { + $this->report->setDefaultSubtype($this->id); + // Find all XML files of the extension $files = JEDCheckerHelper::findManifests($this->basedir); @@ -213,13 +215,13 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_LINK_NOT_FOUND')); return false; - - } else { - $this->report->addInfo($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_UPDATE_SERVER_LINK', (string) $server)); + } + else + { + $this->report->addPassed($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_UPDATE_SERVER_LINK', (string) $server)); } } - // All checks passed. Return true return true; }