33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2025-01-04 23:15:19 +00:00

Merge pull request #235 from dryabov/patch-85

Display a notice if en-GB sys.ini file is missed
This commit is contained in:
Denis Ryabov 2024-01-08 12:14:06 +03:00 committed by GitHub
commit abd14993e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -56,6 +56,7 @@ COM_JEDCHECKER_INFO_XML_URL_JOOMLA_DERIVATIVE="Domain names that use 'Joomla' or
COM_JEDCHECKER_INFO_XML_NAME_TOO_LONG="Listing name ('%s') is too long, consider to shorten it" COM_JEDCHECKER_INFO_XML_NAME_TOO_LONG="Listing name ('%s') is too long, consider to shorten it"
COM_JEDCHECKER_INFO_XML_NAME_ADMIN_MENU="The admin menu name '%1$s' isn't the same as the extension name '%2$s'" COM_JEDCHECKER_INFO_XML_NAME_ADMIN_MENU="The admin menu name '%1$s' isn't the same as the extension name '%2$s'"
COM_JEDCHECKER_INFO_XML_NAME_PLUGIN_FORMAT="The name of the plugin ('%s') must comply with the JED naming conventions in the form '{Type} - {Extension Name}'" COM_JEDCHECKER_INFO_XML_NAME_PLUGIN_FORMAT="The name of the plugin ('%s') must comply with the JED naming conventions in the form '{Type} - {Extension Name}'"
COM_JEDCHECKER_INFO_XML_NO_LANGUAGE_FILE_FOUND="No '%1$s' language file was found for the '%2$s' language tag."
COM_JEDCHECKER_RULE_PH1="PHP Headers missing GPL License Notice" COM_JEDCHECKER_RULE_PH1="PHP Headers missing GPL License Notice"
COM_JEDCHECKER_RULE_PH1_DESC="A notice is required on each PHP file stating that the file is licensed GPL (or other compatible accepted license). For more information, please <a href='https://extensions.joomla.org/support/knowledgebase/submission-requirements/jed-entries-checklists/#licensechecklist' target='_blank'>click here</a>." COM_JEDCHECKER_RULE_PH1_DESC="A notice is required on each PHP file stating that the file is licensed GPL (or other compatible accepted license). For more information, please <a href='https://extensions.joomla.org/support/knowledgebase/submission-requirements/jed-entries-checklists/#licensechecklist' target='_blank'>click here</a>."
COM_JEDCHECKER_ERROR_GPL_NOT_FOUND="GPL or compatible license was not found" COM_JEDCHECKER_ERROR_GPL_NOT_FOUND="GPL or compatible license was not found"

View File

@ -150,7 +150,16 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
$type = (string) $xml['type']; $type = (string) $xml['type'];
// Load the language of the extension (if any) // Load the language of the extension (if any)
$this->loadExtensionLanguage($xml, dirname($file)); if (!$this->loadExtensionLanguage($xml, dirname($file))) {
$lang_file = JEDCheckerHelper::getElementName($xml) . '.sys.ini';
if ($type === 'plugin' && isset($xml['group']) && strpos($lang_file, 'plg_') !== 0)
{
$lang_file = 'plg_' . $xml['group'] . '_' . $lang_file;
}
$this->report->addNotice($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_NO_LANGUAGE_FILE_FOUND', $lang_file, 'en-GB'));
}
// Get the real extension's name now that the language has been loaded // Get the real extension's name now that the language has been loaded
$lang = Factory::getLanguage(); $lang = Factory::getLanguage();
@ -273,7 +282,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
* @param string $rootDir The basepath * @param string $rootDir The basepath
* @param string $langTag The language to load * @param string $langTag The language to load
* *
* @return void * @return bool True if language file found, and false otherwise
*/ */
protected function loadExtensionLanguage($xml, $rootDir, $langTag = 'en-GB') protected function loadExtensionLanguage($xml, $rootDir, $langTag = 'en-GB')
{ {
@ -353,10 +362,12 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule
$loadLanguage = new ReflectionMethod($lang, 'loadLanguage'); $loadLanguage = new ReflectionMethod($lang, 'loadLanguage');
$loadLanguage->setAccessible(true); $loadLanguage->setAccessible(true);
$loadLanguage->invoke($lang, $langSysFile, $extension); $loadLanguage->invoke($lang, $langSysFile, $extension);
return; return true;
} }
} }
} }
return false;
} }
/** /**