diff --git a/administrator/components/com_jedchecker/controller.php b/administrator/components/com_jedchecker/controller.php index 3d61ac6..809c44f 100644 --- a/administrator/components/com_jedchecker/controller.php +++ b/administrator/components/com_jedchecker/controller.php @@ -12,11 +12,13 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\MVC\Controller\BaseController; + /** * Class JedcheckerController * * @since 1.0 */ -class JedcheckerController extends JControllerLegacy +class JedcheckerController extends BaseController { } diff --git a/administrator/components/com_jedchecker/controllers/police.raw.php b/administrator/components/com_jedchecker/controllers/police.raw.php index fc57db5..a8f31ad 100644 --- a/administrator/components/com_jedchecker/controllers/police.raw.php +++ b/administrator/components/com_jedchecker/controllers/police.raw.php @@ -11,17 +11,18 @@ defined('_JEXEC') or die('Restricted access'); - -jimport('joomla.filesystem'); -jimport('joomla.filesystem.folder'); -jimport('joomla.filesystem.archive'); +use Joomla\CMS\Factory; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\MVC\Controller\BaseController; /** * Class jedcheckerControllerPolice * * @since 1.0 */ -class JedcheckerControllerPolice extends JControllerLegacy +class JedcheckerControllerPolice extends BaseController { /** * Runs all the rules on the given directory @@ -30,11 +31,11 @@ class JedcheckerControllerPolice extends JControllerLegacy */ public function check() { - $rule = JFactory::getApplication()->input->get('rule'); + $rule = Factory::getApplication()->input->get('rule'); JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/'); - $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; + $path = Factory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; $class = 'jedcheckerRules' . ucfirst($rule); // Stop if the class does not exist @@ -65,7 +66,7 @@ class JedcheckerControllerPolice extends JControllerLegacy protected function police($class, $folder) { // Prepare rule properties - $properties = array('basedir' => JPath::clean($folder)); + $properties = array('basedir' => Path::clean($folder)); // Create instance of the rule $police = new $class($properties); @@ -89,8 +90,8 @@ class JedcheckerControllerPolice extends JControllerLegacy $folders = array(); // Add the folders in the "jed_checked/unzipped" folder - $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; - $tmp_folders = JFolder::folders($path); + $path = Factory::getConfig()->get('tmp_path') . '/jed_checker/unzipped'; + $tmp_folders = Folder::folders($path); if (!empty($tmp_folders)) { @@ -101,9 +102,9 @@ class JedcheckerControllerPolice extends JControllerLegacy } // Parse the local.txt file and parse it - $local = JFactory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; + $local = Factory::getConfig()->get('tmp_path') . '/jed_checker/local.txt'; - if (JFile::exists($local)) + if (File::exists($local)) { $content = file_get_contents($local); @@ -119,11 +120,11 @@ class JedcheckerControllerPolice extends JControllerLegacy if (!empty($line)) { - if (JFolder::exists(JPATH_ROOT . '/' . $line)) + if (Folder::exists(JPATH_ROOT . '/' . $line)) { $folders[] = JPATH_ROOT . '/' . $line; } - elseif (JFolder::exists($line)) + elseif (Folder::exists($line)) { $folders[] = $line; } diff --git a/administrator/components/com_jedchecker/controllers/uploads.php b/administrator/components/com_jedchecker/controllers/uploads.php index 8cb7474..7a1c979 100644 --- a/administrator/components/com_jedchecker/controllers/uploads.php +++ b/administrator/components/com_jedchecker/controllers/uploads.php @@ -12,18 +12,20 @@ defined('_JEXEC') or die('Restricted access'); -jimport('joomla.filesystem'); -jimport('joomla.filesystem.folder'); -jimport('joomla.filesystem.archive'); - use Joomla\Archive\Archive; +use Joomla\CMS\Factory; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Session\Session; /** * Class JedcheckerControllerUploads * * @since 1.0 */ -class JedcheckerControllerUploads extends JControllerLegacy +class JedcheckerControllerUploads extends BaseController { /** @var string */ public $path; @@ -40,7 +42,7 @@ class JedcheckerControllerUploads extends JControllerLegacy */ public function __construct() { - $this->path = JFactory::getConfig()->get('tmp_path') . '/jed_checker'; + $this->path = Factory::getConfig()->get('tmp_path') . '/jed_checker'; $this->pathArchive = $this->path . '/archives'; $this->pathUnzipped = $this->path . '/unzipped'; parent::__construct(); @@ -53,11 +55,11 @@ class JedcheckerControllerUploads extends JControllerLegacy */ public function upload() { - $appl = JFactory::getApplication(); + $appl = Factory::getApplication(); $input = $appl->input; // Check the sent token by the form - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // Gets the uploaded file from the sent form $file = $input->files->get('extension', null, 'raw'); @@ -67,18 +69,18 @@ class JedcheckerControllerUploads extends JControllerLegacy $path = $this->pathArchive; // If the archive folder doesn't exist - create it! - if (!JFolder::exists($path)) + if (!Folder::exists($path)) { - JFolder::create($path); + Folder::create($path); } else { // Let us remove all previous uploads - $archiveFiles = JFolder::files($path); + $archiveFiles = Folder::files($path); foreach ($archiveFiles as $archive) { - if (!JFile::delete($this->pathArchive . '/' . $archive)) + if (!File::delete($this->pathArchive . '/' . $archive)) { echo 'could not delete' . $archive; } @@ -88,10 +90,10 @@ class JedcheckerControllerUploads extends JControllerLegacy $file['filepath'] = $path . '/' . strtolower($file['name']); // Let us try to upload - if (!JFile::upload($file['tmp_name'], $file['filepath'], false, true)) + if (!File::upload($file['tmp_name'], $file['filepath'], false, true)) { // Error in upload - redirect back with an error notice - $appl->enqueueMessage(JText::_('COM_JEDCHECKER_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error'); + $appl->enqueueMessage(Text::_('COM_JEDCHECKER_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error'); $appl->redirect('index.php?option=com_jedchecker&view=uploads'); return false; @@ -119,28 +121,28 @@ class JedcheckerControllerUploads extends JControllerLegacy */ public function unzip() { - $appl = JFactory::getApplication(); + $appl = Factory::getApplication(); // Form check token - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); // If folder doesn't exist - create it! - if (!JFolder::exists($this->pathUnzipped)) + if (!Folder::exists($this->pathUnzipped)) { - JFolder::create($this->pathUnzipped); + Folder::create($this->pathUnzipped); } else { // Let us remove all previous unzipped files - $folders = JFolder::folders($this->pathUnzipped); + $folders = Folder::folders($this->pathUnzipped); foreach ($folders as $folder) { - JFolder::delete($this->pathUnzipped . '/' . $folder); + Folder::delete($this->pathUnzipped . '/' . $folder); } } - $file = JFolder::files($this->pathArchive); + $file = Folder::files($this->pathArchive); $origin = $this->pathArchive . DIRECTORY_SEPARATOR . $file[0]; $destination = $this->pathUnzipped . DIRECTORY_SEPARATOR . $file[0]; @@ -150,7 +152,7 @@ class JedcheckerControllerUploads extends JControllerLegacy $archive = new Archive; $result = $archive->extract($origin, $destination); } - catch (\Exception $e) + catch (Exception $e) { $result = false; } @@ -160,14 +162,14 @@ class JedcheckerControllerUploads extends JControllerLegacy // Scan unzipped folders if we find zip file -> unzip them as well $this->unzipAll($this->pathUnzipped . '/' . $file[0]); $message = 'COM_JEDCHECKER_UNZIP_SUCCESS'; - $appl->enqueueMessage(JText::_($message)); + $appl->enqueueMessage(Text::_($message)); } else { $message = 'COM_JEDCHECKER_UNZIP_FAILED'; } - // $appl->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message)); + // $appl->redirect('index.php?option=com_jedchecker&view=uploads', Text::_($message)); $message = 'COM_JEDCHECKER_UNZIP_FAILED'; return $message; @@ -197,7 +199,7 @@ class JedcheckerControllerUploads extends JControllerLegacy $archive = new Archive; $result = $archive->extract($file->getPathname(), $unzip); } - catch (\Exception $e) + catch (Exception $e) { $result = false; } @@ -205,7 +207,7 @@ class JedcheckerControllerUploads extends JControllerLegacy // Delete the archive once we extract it if ($result) { - JFile::delete($file->getPathname()); + File::delete($file->getPathname()); // Now check the new extracted folder for archive files $this->unzipAll($unzip); @@ -228,7 +230,7 @@ class JedcheckerControllerUploads extends JControllerLegacy { if (file_exists($this->path)) { - $result = JFolder::delete($this->path); + $result = Folder::delete($this->path); if (!$result) { @@ -238,7 +240,7 @@ class JedcheckerControllerUploads extends JControllerLegacy $message = 'COM_JEDCHECKER_DELETE_SUCCESS'; - // JFactory::getApplication()->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message)); + // Factory::getApplication()->redirect('index.php?option=com_jedchecker&view=uploads', Text::_($message)); $this->setRedirect('index.php?option=com_jedchecker&view=uploads'); } } diff --git a/administrator/components/com_jedchecker/jedchecker.php b/administrator/components/com_jedchecker/jedchecker.php index bf7db9c..f177630 100644 --- a/administrator/components/com_jedchecker/jedchecker.php +++ b/administrator/components/com_jedchecker/jedchecker.php @@ -11,18 +11,17 @@ */ defined('_JEXEC') or die('Restricted access'); -jimport('joomla.application.component.controllerlegacy'); -if (!JFactory::getUser()->authorise('core.manage', 'com_jedchecker')) +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\BaseController; + +if (!Factory::getUser()->authorise('core.manage', 'com_jedchecker')) { - throw new Exception(JText::_('JERROR_ALERTNOAUTHOR')); + throw new Exception(Text::_('JERROR_ALERTNOAUTHOR')); } -// We'll need JFile and JFolder all through the component so let us load them here -jimport('joomla.filesystem.folder'); -jimport('joomla.filesystem.file'); - -$input = JFactory::getApplication()->input; +$input = Factory::getApplication()->input; $view = $input->getCmd('view', ''); if ($view === '' && $input->getCmd('task', '') === '') @@ -30,6 +29,6 @@ if ($view === '' && $input->getCmd('task', '') === '') $input->set('view', 'uploads'); } -$controller = JControllerLegacy::getInstance('jedchecker'); +$controller = BaseController::getInstance('jedchecker'); $controller->execute($input->getCmd('task', '')); $controller->redirect(); diff --git a/administrator/components/com_jedchecker/libraries/helper.php b/administrator/components/com_jedchecker/libraries/helper.php index b4a50f1..d4df50e 100644 --- a/administrator/components/com_jedchecker/libraries/helper.php +++ b/administrator/components/com_jedchecker/libraries/helper.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Filter\InputFilter; /** * class JedcheckerHelper @@ -34,7 +36,7 @@ abstract class JEDCheckerHelper public static function findManifests($basedir) { // Find all XML files of the extension - $files = JFolder::files($basedir, '\.xml$', true, true); + $files = Folder::files($basedir, '\.xml$', true, true); $excludeList = array(); @@ -134,7 +136,7 @@ abstract class JEDCheckerHelper } } - $extension = strtolower(JFilterInput::getInstance()->clean($extension, 'cmd')); + $extension = strtolower(InputFilter::getInstance()->clean($extension, 'cmd')); if ($type === 'component' && strpos($extension, 'com_') !== 0) { diff --git a/administrator/components/com_jedchecker/libraries/rules/encoding.php b/administrator/components/com_jedchecker/libraries/rules/encoding.php index 68c5501..d8b46bd 100644 --- a/administrator/components/com_jedchecker/libraries/rules/encoding.php +++ b/administrator/components/com_jedchecker/libraries/rules/encoding.php @@ -12,6 +12,9 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Language\Text; + // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -81,7 +84,7 @@ class JedcheckerRulesEncoding extends JEDcheckerRule $this->encodingsRegex = '/' . implode('|', $encodings) . '/i'; // Find all php files of the extension - $files = JFolder::files($this->basedir, '\.php$', true, true); + $files = Folder::files($this->basedir, '\.php$', true, true); // Iterate through all files foreach ($files as $file) @@ -121,7 +124,7 @@ class JedcheckerRulesEncoding extends JEDcheckerRule if (preg_match($this->encodingsRegex, $line)) { $found = true; - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_ERROR_ENCODING'), $i + 1, $origContent[$i]); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_ERROR_ENCODING'), $i + 1, $origContent[$i]); } } diff --git a/administrator/components/com_jedchecker/libraries/rules/errorreporting.php b/administrator/components/com_jedchecker/libraries/rules/errorreporting.php index f3f9f0f..c73f799 100644 --- a/administrator/components/com_jedchecker/libraries/rules/errorreporting.php +++ b/administrator/components/com_jedchecker/libraries/rules/errorreporting.php @@ -11,6 +11,9 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Language\Text; + // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -82,7 +85,7 @@ class JedcheckerRulesErrorreporting extends JEDcheckerRule $this->errorreportingRegex = '/' . implode('|', $codes) . '/i'; // Find all php files of the extension - $files = JFolder::files($this->basedir, '\.php$', true, true); + $files = Folder::files($this->basedir, '\.php$', true, true); // Iterate through all files foreach ($files as $file) @@ -122,7 +125,7 @@ class JedcheckerRulesErrorreporting extends JEDcheckerRule if (preg_match($this->errorreportingRegex, $line)) { $found = true; - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_ERROR_ERRORREPORTING'), $i + 1, $origContent[$i]); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_ERROR_ERRORREPORTING'), $i + 1, $origContent[$i]); } } diff --git a/administrator/components/com_jedchecker/libraries/rules/framework.php b/administrator/components/com_jedchecker/libraries/rules/framework.php index 002184c..a60d12a 100644 --- a/administrator/components/com_jedchecker/libraries/rules/framework.php +++ b/administrator/components/com_jedchecker/libraries/rules/framework.php @@ -11,6 +11,9 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Language\Text; + // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -83,15 +86,15 @@ class JedcheckerRulesFramework extends JEDcheckerRule $regexLeftoverFolders = '^' . $this->regexLeftoverFolders . '$'; // Get matched files and folder (w/o default exclusion list) - $folders = JFolder::folders($this->basedir, $regexLeftoverFolders, true, true, array(), array()); - $files = JFolder::files($this->basedir, $regexLeftoverFolders, true, true, array(), array()); + $folders = Folder::folders($this->basedir, $regexLeftoverFolders, true, true, array(), array()); + $files = Folder::files($this->basedir, $regexLeftoverFolders, true, true, array(), array()); if ($folders !== false) { // Warn on leftover folders found foreach ($folders as $folder) { - $this->report->addWarning($folder, JText::_("COM_JEDCHECKER_ERROR_FRAMEWORK_LEFTOVER_FOLDER")); + $this->report->addWarning($folder, Text::_("COM_JEDCHECKER_ERROR_FRAMEWORK_LEFTOVER_FOLDER")); } } @@ -100,11 +103,11 @@ class JedcheckerRulesFramework extends JEDcheckerRule // Warn on leftover files found foreach ($files as $file) { - $this->report->addWarning($file, JText::_("COM_JEDCHECKER_ERROR_FRAMEWORK_LEFTOVER_FILE")); + $this->report->addWarning($file, Text::_("COM_JEDCHECKER_ERROR_FRAMEWORK_LEFTOVER_FILE")); } } - $files = JFolder::files($this->basedir, '\.php$', true, true); + $files = Folder::files($this->basedir, '\.php$', true, true); foreach ($files as $file) { @@ -154,14 +157,14 @@ class JedcheckerRulesFramework extends JEDcheckerRule // Check BOM if (strncmp($content, "\xEF\xBB\xBF", 3) === 0) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_FRAMEWORK_BOM_FOUND')); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_FRAMEWORK_BOM_FOUND')); $result = true; } // Report spaces/tabs/EOLs at the beginning of file if (strpos(" \t\n\r\v\f", $content[0]) !== false) { - $this->report->addNotice($file, JText::_('COM_JEDCHECKER_ERROR_FRAMEWORK_LEADING_SPACES')); + $this->report->addNotice($file, Text::_('COM_JEDCHECKER_ERROR_FRAMEWORK_LEADING_SPACES')); $result = true; } @@ -176,7 +179,7 @@ class JedcheckerRulesFramework extends JEDcheckerRule if (preg_match('/<\?\s/', $content, $match, PREG_OFFSET_CAPTURE)) { $lineno = substr_count($content, "\n", 0, $match[0][1]); - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_FRAMEWORK_SHORT_PHP_TAG'), $lineno + 1, $origContent[$lineno]); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_FRAMEWORK_SHORT_PHP_TAG'), $lineno + 1, $origContent[$lineno]); $result = true; } @@ -230,7 +233,7 @@ class JedcheckerRulesFramework extends JEDcheckerRule if (preg_match('/' . $regex . '/i', $line)) { $origLine = str_ireplace($singleTest, '' . $singleTest . '', htmlspecialchars($origLine)); - $error_message = JText::_('COM_JEDCHECKER_ERROR_FRAMEWORK_' . strtoupper($testObject->group)) . ':
' . $origLine . '
'; + $error_message = Text::_('COM_JEDCHECKER_ERROR_FRAMEWORK_' . strtoupper($testObject->group)) . ':
' . $origLine . '
'; switch ($testObject->kind) { diff --git a/administrator/components/com_jedchecker/libraries/rules/gpl.php b/administrator/components/com_jedchecker/libraries/rules/gpl.php index 6768abc..7b069dd 100644 --- a/administrator/components/com_jedchecker/libraries/rules/gpl.php +++ b/administrator/components/com_jedchecker/libraries/rules/gpl.php @@ -11,6 +11,8 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Language\Text; // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -80,7 +82,7 @@ class JedcheckerRulesGpl extends JEDcheckerRule $this->init(); // Find all php files of the extension - $files = JFolder::files($this->basedir, '\.php$', true, true); + $files = Folder::files($this->basedir, '\.php$', true, true); // Iterate through all files foreach ($files as $file) @@ -89,7 +91,7 @@ class JedcheckerRulesGpl extends JEDcheckerRule if (!$this->find($file)) { // Add as error to the report if it was not found - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_GPL_NOT_FOUND')); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_GPL_NOT_FOUND')); } } } @@ -214,7 +216,7 @@ class JedcheckerRulesGpl extends JEDcheckerRule $lineno = substr_count($content, "\n", 0, $match[0][1]) + 1; $this->report->addPassed( $file, - JText::_('COM_JEDCHECKER_PH1_LICENSE_FOUND'), + Text::_('COM_JEDCHECKER_PH1_LICENSE_FOUND'), $lineno, $match[0][0] ); @@ -227,7 +229,7 @@ class JedcheckerRulesGpl extends JEDcheckerRule $lineno = substr_count($content, "\n", 0, $match[0][1]) + 1; $this->report->addWarning( $file, - JText::_('COM_JEDCHECKER_GPL_COMPATIBLE_LICENSE_WAS_FOUND'), + Text::_('COM_JEDCHECKER_GPL_COMPATIBLE_LICENSE_WAS_FOUND'), $lineno, $match[0][0] ); diff --git a/administrator/components/com_jedchecker/libraries/rules/jamss.php b/administrator/components/com_jedchecker/libraries/rules/jamss.php index cb19ce7..d0e39c7 100644 --- a/administrator/components/com_jedchecker/libraries/rules/jamss.php +++ b/administrator/components/com_jedchecker/libraries/rules/jamss.php @@ -12,6 +12,9 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Language\Text; + // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -67,7 +70,7 @@ class JedcheckerRulesJamss extends JEDcheckerRule */ public function check() { - $files = JFolder::files($this->basedir, '', true, true); + $files = Folder::files($this->basedir, '', true, true); $this->init_jamss(); @@ -328,12 +331,12 @@ class JedcheckerRulesJamss extends JEDcheckerRule { if ($malic_file_descr = array_search(pathinfo($path, PATHINFO_BASENAME), $jamssFileNames)) { - $this->jamssWarning($path, JText::_('COM_JEDCHECKER_ERROR_JAMSS_SUSPICIOUS_FILENAME'), $malic_file_descr, '', 0); + $this->jamssWarning($path, Text::_('COM_JEDCHECKER_ERROR_JAMSS_SUSPICIOUS_FILENAME'), $malic_file_descr, '', 0); } if (!($content = file_get_contents($path))) { - $this->report->addError($path, JText::_('COM_JEDCHECKER_ERROR_JAMSS_CANNOT_OPEN') . $malic_file_descr, 0); + $this->report->addError($path, Text::_('COM_JEDCHECKER_ERROR_JAMSS_CANNOT_OPEN') . $malic_file_descr, 0); return true; } @@ -413,7 +416,7 @@ class JedcheckerRulesJamss extends JEDcheckerRule // Then it has some additional comments $this->jamssWarning( $path, - JText::_('COM_JEDCHECKER_ERROR_JAMSS_PATTERN') . "#$pattern[2] - $pattern[1]", + Text::_('COM_JEDCHECKER_ERROR_JAMSS_PATTERN') . "#$pattern[2] - $pattern[1]", $pattern[3], $first_code, $first_line @@ -424,7 +427,7 @@ class JedcheckerRulesJamss extends JEDcheckerRule // It's a string, no comments available $this->jamssWarning( $path, - JText::_('COM_JEDCHECKER_ERROR_JAMSS_STRING') . $pattern, + Text::_('COM_JEDCHECKER_ERROR_JAMSS_STRING') . $pattern, '', $first_code, $first_line diff --git a/administrator/components/com_jedchecker/libraries/rules/jexec.php b/administrator/components/com_jedchecker/libraries/rules/jexec.php index 00e9fe2..44edc5f 100644 --- a/administrator/components/com_jedchecker/libraries/rules/jexec.php +++ b/administrator/components/com_jedchecker/libraries/rules/jexec.php @@ -12,6 +12,8 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -95,7 +97,7 @@ class JedcheckerRulesJexec extends JEDcheckerRule if (!$this->find($file)) { // Add as error to the report if it was not found - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_JEXEC_NOT_FOUND')); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_JEXEC_NOT_FOUND')); } } } diff --git a/administrator/components/com_jedchecker/libraries/rules/language.php b/administrator/components/com_jedchecker/libraries/rules/language.php index 09a0b8e..5437f04 100644 --- a/administrator/components/com_jedchecker/libraries/rules/language.php +++ b/administrator/components/com_jedchecker/libraries/rules/language.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Language\Text; // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -66,7 +68,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule public function check() { // Find all INI files of the extension - $files = JFolder::files($this->basedir, '\.ini$', true, true); + $files = Folder::files($this->basedir, '\.ini$', true, true); // Iterate through all the ini files foreach ($files as $file) @@ -99,7 +101,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule } // Check JText usage - $files = JFolder::files($this->basedir, '\.php$', true, true); + $files = Folder::files($this->basedir, '\.php$', true, true); foreach ($files as $file) { @@ -127,7 +129,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check EOL format is \n (not \r or \n\r) if (strpos($content, "\r") !== false) { - $this->report->addNotice($file, JText::_('COM_JEDCHECKER_LANG_INCORRECT_EOL', false, false)); + $this->report->addNotice($file, Text::_('COM_JEDCHECKER_LANG_INCORRECT_EOL', false, false)); } $lines = file($file); @@ -151,7 +153,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check for BOM sequence if ($lineno === 0 && strncmp($line, "\xEF\xBB\xBF", 3) === 0) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_BOM_FOUND'), $startLineno); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_BOM_FOUND'), $startLineno); // Remove BOM for further checks $line = substr($line, 3); @@ -166,14 +168,14 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Report incorrect comment character if ($line[0] === '#') { - $this->report->addError($file, JText::_('COM_JEDCHECKER_LANG_INCORRECT_COMMENT'), $startLineno, $line); + $this->report->addError($file, Text::_('COM_JEDCHECKER_LANG_INCORRECT_COMMENT'), $startLineno, $line); continue; } // Check for "=" character in the line if (strpos($line, '=') === false) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_LANG_WRONG_LINE'), $startLineno, $line); + $this->report->addError($file, Text::_('COM_JEDCHECKER_LANG_WRONG_LINE'), $startLineno, $line); continue; } @@ -186,47 +188,47 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check for empty key if ($key === '') { - $this->report->addError($file, JText::_('COM_JEDCHECKER_LANG_KEY_EMPTY'), $startLineno, $line); + $this->report->addError($file, Text::_('COM_JEDCHECKER_LANG_KEY_EMPTY'), $startLineno, $line); continue; } // Check for spaces in the key name if (preg_match('/\s/', $key)) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_LANG_KEY_WHITESPACE'), $startLineno, $line); + $this->report->addError($file, Text::_('COM_JEDCHECKER_LANG_KEY_WHITESPACE'), $startLineno, $line); continue; } // Check for invalid characters (see https://www.php.net/manual/en/function.parse-ini-file.php) if (strpbrk($key, '{}|&~![()^"') !== false) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_LANG_KEY_INVALID_CHARACTER'), $startLineno, $line); + $this->report->addError($file, Text::_('COM_JEDCHECKER_LANG_KEY_INVALID_CHARACTER'), $startLineno, $line); continue; } // Check for invalid key names (see https://www.php.net/manual/en/function.parse-ini-file.php) if (in_array($key, array('null', 'yes', 'no', 'true', 'false', 'on', 'off', 'none'), true)) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_LANG_KEY_RESERVED'), $startLineno, $line); + $this->report->addError($file, Text::_('COM_JEDCHECKER_LANG_KEY_RESERVED'), $startLineno, $line); continue; } // Check key contains ASCII characters only if (preg_match('/[\x00-\x1F\x80-\xFF]/', $key)) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_KEY_NOT_ASCII'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_KEY_NOT_ASCII'), $startLineno, $line); } // Check key is uppercase if ($key !== strtoupper($key)) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_KEY_NOT_UPPERCASE'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_KEY_NOT_UPPERCASE'), $startLineno, $line); } // Check for duplicated keys if (isset($keys[$key])) { - $this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_LANG_KEY_DUPLICATED', $keys[$key]), $startLineno, $line); + $this->report->addWarning($file, Text::sprintf('COM_JEDCHECKER_LANG_KEY_DUPLICATED', $keys[$key]), $startLineno, $line); } else { @@ -253,7 +255,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // The value doesn't match INI format if (!isset($matches[0])) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_TRANSLATION_ERROR'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_TRANSLATION_ERROR'), $startLineno, $line); continue; } @@ -263,7 +265,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check for empty value if ($value === '""') { - $this->report->addNotice($file, JText::_('COM_JEDCHECKER_LANG_TRANSLATION_EMPTY'), $startLineno, $line); + $this->report->addNotice($file, Text::_('COM_JEDCHECKER_LANG_TRANSLATION_EMPTY'), $startLineno, $line); continue; } @@ -272,26 +274,26 @@ class JedcheckerRulesLanguage extends JEDcheckerRule if (!$validUTF8) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_INVALID_UTF8'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_INVALID_UTF8'), $startLineno, $line); } // Check for unquoted values if (strlen($value) < 2 || ($value[0] !== '"' && substr($value, -1) !== '"')) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES'), $startLineno, $line); continue; } if ($value[0] !== '"') { - $msg = JText::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES') . ' ' . JText::_('COM_JEDCHECKER_LANG_TRANSLATION_MISSED_LEFT_QUOTE'); + $msg = Text::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES') . ' ' . Text::_('COM_JEDCHECKER_LANG_TRANSLATION_MISSED_LEFT_QUOTE'); $this->report->addWarning($file, $msg, $startLineno, $line); continue; } if (substr($value, -1) !== '"') { - $msg = JText::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES') . ' ' . JText::_('COM_JEDCHECKER_LANG_TRANSLATION_MISSED_RIGHT_QUOTE'); + $msg = Text::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES') . ' ' . Text::_('COM_JEDCHECKER_LANG_TRANSLATION_MISSED_RIGHT_QUOTE'); $this->report->addWarning($file, $msg, $startLineno, $line); continue; } @@ -302,7 +304,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check for legacy "_QQ_" code (deprecated since Joomla! 3.9 in favour of escaped double quote \"; removed in Joomla! 4) if (strpos($value, '"_QQ_"') !== false) { - $this->report->addCompat($file, JText::sprintf('COM_JEDCHECKER_LANG_QQDEPRECATED', '"_QQ_"', '\\"'), $startLineno, $line); + $this->report->addCompat($file, Text::sprintf('COM_JEDCHECKER_LANG_QQDEPRECATED', '"_QQ_"', '\\"'), $startLineno, $line); } // Convert "_QQ_" to escaped quotes for further analysis @@ -311,13 +313,13 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check for unescaped quote if (preg_match('/[^\\\\]"/', $value)) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_UNESCAPED_QUOTE'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_UNESCAPED_QUOTE'), $startLineno, $line); } // Check for value interpolation (see https://www.php.net/manual/en/function.parse-ini-file.php for details) if (strpos($value, '${') !== false) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_VARIABLE_REF'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_VARIABLE_REF'), $startLineno, $line); } // The code below detects incorrect format of numbered placeholders (e.g. "%1s" instead of "%1$s") @@ -340,7 +342,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // If placeholder numbers form a sequence, the maximal value is equal to the number of elements if ($maxNumber === $count) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_INCORRECT_ARGNUM'), $startLineno, $line); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_LANG_INCORRECT_ARGNUM'), $startLineno, $line); } } @@ -350,7 +352,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule // Check spaces around (but allow trailing space after colon) if (preg_match('/^\s|[^:]\s+$/', $value)) { - $this->report->addNotice($file, JText::_('COM_JEDCHECKER_LANG_SPACES_AROUND'), $startLineno, $line); + $this->report->addNotice($file, Text::_('COM_JEDCHECKER_LANG_SPACES_AROUND'), $startLineno, $line); } } } @@ -406,7 +408,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule if (!isset($this->langKeys[$key])) { $lineno = substr_count($content, "\n", 0, $match[1]); - $this->report->addNotice($file, JText::sprintf('COM_JEDCHECKER_LANG_UNKNOWN_KEY_IN_CODE', htmlspecialchars($key)), $lineno + 1, $lines[$lineno]); + $this->report->addNotice($file, Text::sprintf('COM_JEDCHECKER_LANG_UNKNOWN_KEY_IN_CODE', htmlspecialchars($key)), $lineno + 1, $lines[$lineno]); } } diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php b/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php index 5125de8..71d0e73 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -304,7 +305,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule if (!is_dir($folder)) { - $this->errors[] = JText::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $attrPath); + $this->errors[] = Text::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $attrPath); } } } @@ -319,7 +320,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule if (!is_dir($this->basedir . $admindir . $folder) && !is_dir($this->basedir . $sitedir . $folder)) { - $this->errors[] = JText::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $folder); + $this->errors[] = Text::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $folder); } } @@ -358,7 +359,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule return $folder . '/'; } - $this->warnings[] = JText::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $folder); + $this->warnings[] = Text::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $folder); return ''; } @@ -380,7 +381,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule $path[] = $p->getName(); } - $this->warnings[] = JText::sprintf('COM_JEDCHECKER_XML_FILES_EMPTY_LIST', implode('/', $path)); + $this->warnings[] = Text::sprintf('COM_JEDCHECKER_XML_FILES_EMPTY_LIST', implode('/', $path)); } } @@ -409,7 +410,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule continue; } - $this->errors[] = JText::sprintf('COM_JEDCHECKER_XML_FILES_FILE_NOT_FOUND', $dir . $file); + $this->errors[] = Text::sprintf('COM_JEDCHECKER_XML_FILES_FILE_NOT_FOUND', $dir . $file); } } @@ -427,7 +428,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule { if (!is_dir($this->basedir . $dir . $folder)) { - $this->errors[] = JText::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $dir . $folder); + $this->errors[] = Text::sprintf('COM_JEDCHECKER_XML_FILES_FOLDER_NOT_FOUND', $dir . $folder); } } } diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php index f719f32..1cb0570 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlinfo.php @@ -12,6 +12,8 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -109,7 +111,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule if (!$manifestFound) { - $this->report->addError('', JText::_('COM_JEDCHECKER_INFO_XML_NO_MANIFEST')); + $this->report->addError('', Text::_('COM_JEDCHECKER_INFO_XML_NO_MANIFEST')); } } @@ -136,7 +138,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule // 1.5 uses 'install', 1.6+ uses 'extension' if ($xml->getName() === 'install') { - $this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_MANIFEST_OUTDATED')); + $this->report->addWarning($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_MANIFEST_OUTDATED')); } if ($xml->getName() !== 'extension') @@ -151,12 +153,12 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule $this->loadExtensionLanguage($xml, dirname($file)); // Get the real extension's name now that the language has been loaded - $lang = JFactory::getLanguage(); + $lang = Factory::getLanguage(); $extensionName = $lang->_((string) $xml->name); - $info[] = JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_XML', $extensionName); - $info[] = JText::sprintf('COM_JEDCHECKER_INFO_XML_VERSION_XML', (string) $xml->version); - $info[] = JText::sprintf('COM_JEDCHECKER_INFO_XML_CREATIONDATE_XML', (string) $xml->creationDate); + $info[] = Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_XML', $extensionName); + $info[] = Text::sprintf('COM_JEDCHECKER_INFO_XML_VERSION_XML', (string) $xml->version); + $info[] = Text::sprintf('COM_JEDCHECKER_INFO_XML_CREATIONDATE_XML', (string) $xml->creationDate); $this->report->addInfo($file, implode('
', $info)); @@ -165,7 +167,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule // 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)); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_TYPE_NOT_ACCEPTED', $type)); } // NM3 - Listing name contains “module” or “plugin” @@ -173,20 +175,20 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule if (preg_match('/\b(?:module|plugin|component|template|extension|free)\b/i', $extensionName, $match)) { $this->report->addIssue(JEDcheckerReport::LEVEL_ERROR, 'NM3', $file, - JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_RESERVED_KEYWORDS', $extensionName, strtolower($match[0]))); + Text::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)); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_PREFIXED', $extensionName)); } // NM5 - Version in name/title if (preg_match('/(?:\bversion\b|\d\.\d)/i', $extensionName)) { $this->report->addIssue(JEDcheckerReport::LEVEL_ERROR, 'NM5', $file, - JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_VERSION', $extensionName)); + Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_VERSION', $extensionName)); } // Check for "Joomla" in the name @@ -194,7 +196,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule { // An extension name can't start with the word "Joomla" $this->report->addIssue(JEDcheckerReport::LEVEL_ERROR, 'TM2', $file, - JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_JOOMLA', $extensionName)); + Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_JOOMLA', $extensionName)); } else { @@ -204,14 +206,14 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule { // Extensions that use "Joomla" or a derivative of Joomla in the extension name need to be licensed by OSM $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')); + Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_JOOMLA_DERIVATIVE', $extensionName, 'https://tm.joomla.org/approved-domains.html')); } } // Check extension name consists of ASCII characters only if (preg_match('/[^\x20-\x7E]/', $extensionName)) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_NON_ASCII', $extensionName)); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_NON_ASCII', $extensionName)); } // Extension name shouldn't be too long @@ -219,11 +221,11 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule if ($nameLen > 80) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_TOO_LONG', $extensionName)); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_TOO_LONG', $extensionName)); } elseif ($nameLen > 40) { - $this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_TOO_LONG', $extensionName)); + $this->report->addWarning($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_TOO_LONG', $extensionName)); } } @@ -241,7 +243,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule // Do name the Component's admin menu the same as the extension name if ($extensionName !== $menuName) { - $this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_ADMIN_MENU', $menuName, $extensionName)); + $this->report->addWarning($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_ADMIN_MENU', $menuName, $extensionName)); } } @@ -256,7 +258,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule && !(isset($this->pluginsGroupMap[$extensionNameGroup]) && $this->pluginsGroupMap[$extensionNameGroup] === $group) ) { - $this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_NAME_PLUGIN_FORMAT', $extensionName)); + $this->report->addWarning($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_NAME_PLUGIN_FORMAT', $extensionName)); } } @@ -287,7 +289,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule } // Load the language of the extension (if any) - $lang = JFactory::getLanguage(); + $lang = Factory::getLanguage(); // Populate list of directories to look for $lookupLangDirs = array(); @@ -373,7 +375,7 @@ class JedcheckerRulesXMLinfo extends JEDcheckerRule { // Extensions that use "Joomla" or a derivative of Joomla in the domain name need to be licensed by OSM $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')); + Text::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 4416715..f871c32 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmllicense.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmllicense.php @@ -12,6 +12,8 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -96,7 +98,7 @@ class JedcheckerRulesXMLlicense extends JEDcheckerRule // Check if there's a license tag if (!isset($xml->license)) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_FOUND')); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_FOUND')); return false; } @@ -105,7 +107,7 @@ class JedcheckerRulesXMLlicense extends JEDcheckerRule if (stripos($xml->license, 'gpl') === false && stripos($xml->license, 'general public license') === false) { - $this->report->addCompat($file, JText::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_GPL')); + $this->report->addCompat($file, Text::_('COM_JEDCHECKER_ERROR_XML_LICENSE_NOT_GPL')); return false; } diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php index 981459e..52c930c 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -143,7 +144,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (!in_array($type, $this->joomlaTypes, true)) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_TYPE', $type)); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_TYPE', $type)); return true; } @@ -159,7 +160,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule // Warn if method="upgrade" attribute is not found if ((string) $xml['method'] !== 'upgrade') { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_MANIFEST_MISSED_METHOD_UPGRADE')); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_MANIFEST_MISSED_METHOD_UPGRADE')); } switch ($type) @@ -172,11 +173,11 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (!isset($xml['client'])) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $xml->getName(), 'client')); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $xml->getName(), 'client')); } elseif ($client !== 'site' && $client !== 'administrator') { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE_VALUE', $xml->getName(), 'client', $client)); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE_VALUE', $xml->getName(), 'client', $client)); } if ($type === 'module') @@ -186,7 +187,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (count($elements) >= 2) { - $this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_ATTRIBUTES', 'module')); + $this->report->addWarning($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_ATTRIBUTES', 'module')); } if (isset($xml->element)) @@ -195,14 +196,14 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (count($elements) && $elements[0] !== $element) { - $this->report->addWarning($file, JText::_('COM_JEDCHECKER_MANIFEST_MODULE_ELEMENT_MISMATCH')); + $this->report->addWarning($file, Text::_('COM_JEDCHECKER_MANIFEST_MODULE_ELEMENT_MISMATCH')); } } else { if (count($elements) === 0) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ELEMENT_ATTRIBUTE', 'module')); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ELEMENT_ATTRIBUTE', 'module')); } } } @@ -215,12 +216,12 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (count($elements) >= 2) { - $this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_ATTRIBUTES', 'plugin')); + $this->report->addWarning($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_ATTRIBUTES', 'plugin')); } if (count($elements) === 0) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ELEMENT_ATTRIBUTE', 'plugin')); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ELEMENT_ATTRIBUTE', 'plugin')); } break; @@ -231,12 +232,12 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule { if (!isset($item['type'])) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'type')); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'type')); } if (!isset($item['id'])) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'id')); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'id')); } switch ((string) $item['type']) @@ -244,7 +245,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule case 'plugin': if (!isset($item['group'])) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'group')); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'group')); } break; @@ -255,11 +256,11 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (!isset($item['client'])) { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'client')); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_ATTRIBUTE', $item->getName(), 'client')); } elseif ($client !== 'site' && $client !== 'administrator') { - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE_VALUE', $item->getName(), 'client', $client)); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE_VALUE', $item->getName(), 'client', $client)); } break; @@ -269,7 +270,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule break; default: - $this->report->addError($file, JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_TYPE', $item['type'])); + $this->report->addError($file, Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_TYPE', $item['type'])); } } } @@ -322,7 +323,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule // No known attributes for this node foreach ($node->attributes() as $attr) { - $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, (string) $attr->getName()); + $this->notices[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, (string) $attr->getName()); } } elseif ($DTDattributes[0] !== '*') // Skip node with arbitrary attributes (e.g. "field") @@ -334,7 +335,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (!in_array($attrName, $DTDattributes, true)) { // The node has unknown attribute - $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, $attrName); + $this->notices[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_ATTRIBUTE', $name, $attrName); } } } @@ -350,7 +351,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule // No known children for this node if ($node->count() > 0) { - $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILDREN', $name); + $this->notices[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILDREN', $name); } } elseif (!isset($DTDchildRules['*'])) // Skip node with arbitrary children @@ -377,12 +378,12 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if ($count === 0) { // The node doesn't contain required child element - $this->errors[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_REQUIRED', $name, $child); + $this->errors[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_REQUIRED', $name, $child); } elseif ($count > 1) { // The node contains multiple child elements when single only is expected - $this->errors[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_FOUND', $name, $child); + $this->errors[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_FOUND', $name, $child); } break; @@ -391,12 +392,12 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if ($count === 0) { // The node doesn't contain optional child element - $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_OPTIONAL', $name, $child); + $this->notices[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_MISSED_OPTIONAL', $name, $child); } elseif ($count > 1) { // The node contains multiple child elements when single only is expected - $this->warnings[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_FOUND', $name, $child); + $this->warnings[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_FOUND', $name, $child); } break; @@ -420,14 +421,14 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (!isset($DTDchildToRule[$child])) { // The node contains unknown child element - $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILD', $name, $child); + $this->notices[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_UNKNOWN_CHILD', $name, $child); } else { if ($DTDchildRules[$DTDchildToRule[$child]] === '?' && $node->$child->count() > 1) { // The node contains multiple child elements when single only is expected - $this->errors[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_FOUND', $name, $child); + $this->errors[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_MULTIPLE_FOUND', $name, $child); } } } @@ -437,7 +438,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule { if ($child->count() === 0 && $child->attributes()->count() === 0 && (string) $child === '') { - $this->notices[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_EMPTY_CHILD', $child->getName()); + $this->notices[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_EMPTY_CHILD', $child->getName()); } } } @@ -481,7 +482,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule if (in_array($attrName, $skipAttrs, true)) { - $this->warnings[] = JText::sprintf('COM_JEDCHECKER_MANIFEST_MENU_UNUSED_ATTRIBUTE', $attrName); + $this->warnings[] = Text::sprintf('COM_JEDCHECKER_MANIFEST_MENU_UNUSED_ATTRIBUTE', $attrName); } } } diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php b/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php index dc151d1..76b2ca6 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php @@ -12,6 +12,8 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; + // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; @@ -193,7 +195,7 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule // Check if there is an updateservers tag if (!isset($xml->updateservers)) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_NOT_FOUND')); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_NOT_FOUND')); return false; } @@ -201,7 +203,7 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule // Check if server tag(s) exist if (!isset($xml->updateservers->server)) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_NOT_FOUND')); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_NOT_FOUND')); return false; @@ -212,13 +214,13 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule { if (stripos($server, 'http') === false) { - $this->report->addError($file, JText::_('COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_LINK_NOT_FOUND')); + $this->report->addError($file, Text::_('COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_LINK_NOT_FOUND')); return false; } else { - $this->report->addPassed($file, JText::sprintf('COM_JEDCHECKER_INFO_XML_UPDATE_SERVER_LINK', (string) $server)); + $this->report->addPassed($file, Text::sprintf('COM_JEDCHECKER_INFO_XML_UPDATE_SERVER_LINK', (string) $server)); } } diff --git a/administrator/components/com_jedchecker/models/report.php b/administrator/components/com_jedchecker/models/report.php index 7804b95..67b7bd6 100644 --- a/administrator/components/com_jedchecker/models/report.php +++ b/administrator/components/com_jedchecker/models/report.php @@ -12,6 +12,9 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Object\CMSObject; + /** * Class JEDcheckerReport * @@ -20,7 +23,7 @@ defined('_JEXEC') or die('Restricted access'); * * @since 1.0 */ -class JEDcheckerReport extends JObject +class JEDcheckerReport extends CMSObject { /** * Rule's issue levels @@ -107,12 +110,12 @@ class JEDcheckerReport extends JObject { // Initialize language strings $this->issueLangTitles = array( - self::LEVEL_ERROR => JText::_('COM_JEDCHECKER_LEVEL_ERROR'), - self::LEVEL_WARNING => JText::_('COM_JEDCHECKER_LEVEL_WARNING'), - self::LEVEL_COMPAT => JText::_('COM_JEDCHECKER_LEVEL_COMPATIBILITY'), - self::LEVEL_NOTICE => JText::_('COM_JEDCHECKER_LEVEL_NOTICE'), - self::LEVEL_INFO => JText::_('COM_JEDCHECKER_LEVEL_INFO'), - self::LEVEL_PASSED => JText::_('COM_JEDCHECKER_LEVEL_PASSED'), + self::LEVEL_ERROR => Text::_('COM_JEDCHECKER_LEVEL_ERROR'), + self::LEVEL_WARNING => Text::_('COM_JEDCHECKER_LEVEL_WARNING'), + self::LEVEL_COMPAT => Text::_('COM_JEDCHECKER_LEVEL_COMPATIBILITY'), + self::LEVEL_NOTICE => Text::_('COM_JEDCHECKER_LEVEL_NOTICE'), + self::LEVEL_INFO => Text::_('COM_JEDCHECKER_LEVEL_INFO'), + self::LEVEL_PASSED => Text::_('COM_JEDCHECKER_LEVEL_PASSED'), ); $this->data = array(); @@ -269,7 +272,7 @@ class JEDcheckerReport extends JObject { // No errors or compatibility issues found $html[] = '
'; - $html[] = JText::_('COM_JEDCHECKER_EVERYTHING_SEEMS_TO_BE_FINE_WITH_THAT_RULE'); + $html[] = Text::_('COM_JEDCHECKER_EVERYTHING_SEEMS_TO_BE_FINE_WITH_THAT_RULE'); $html[] = '
'; } else @@ -343,7 +346,7 @@ class JEDcheckerReport extends JObject // Add line information if given if ($item->line !== null) { - $html[] = ' ' . JText::_('COM_JEDCHECKER_IN_LINE') . ': ' . $item->line . ''; + $html[] = ' ' . Text::_('COM_JEDCHECKER_IN_LINE') . ': ' . $item->line . ''; } $html[] = '
'; diff --git a/administrator/components/com_jedchecker/models/rule.php b/administrator/components/com_jedchecker/models/rule.php index d97840b..8cf99ca 100644 --- a/administrator/components/com_jedchecker/models/rule.php +++ b/administrator/components/com_jedchecker/models/rule.php @@ -13,7 +13,7 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\Registry\Registry; - +use Joomla\CMS\Object\CMSObject; /** * class JEDcheckerRule @@ -22,7 +22,7 @@ use Joomla\Registry\Registry; * * @since 1.0 */ -class JEDcheckerRule extends JObject +class JEDcheckerRule extends CMSObject { /** * The formal ID of this rule. For example: SE1. diff --git a/administrator/components/com_jedchecker/views/uploads/tmpl/default.php b/administrator/components/com_jedchecker/views/uploads/tmpl/default.php index ed84720..14fec0c 100644 --- a/administrator/components/com_jedchecker/views/uploads/tmpl/default.php +++ b/administrator/components/com_jedchecker/views/uploads/tmpl/default.php @@ -11,24 +11,28 @@ defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; + // Load Bootstrap if (version_compare(JVERSION, '4.0', '>=')) { - JHtml::_('bootstrap.collapse'); - JHtml::_('bootstrap.tab'); + HTMLHelper::_('bootstrap.collapse'); + HTMLHelper::_('bootstrap.tab'); // Tooltips are used by JAMSS reports - JHtml::_('bootstrap.tooltip'); + HTMLHelper::_('bootstrap.tooltip'); } else { - JHtml::_('behavior.core'); - JHtml::_('stylesheet', 'com_jedchecker/j4-style.css', array('version' => 'auto', 'relative' => true)); - JHtml::_('script', 'com_jedchecker/bootstrap.bundle.min.js', array('version' => 'auto', 'relative' => true), array('defer' => true)); + HTMLHelper::_('behavior.core'); + HTMLHelper::_('stylesheet', 'com_jedchecker/j4-style.css', array('version' => 'auto', 'relative' => true)); + HTMLHelper::_('script', 'com_jedchecker/bootstrap.bundle.min.js', array('version' => 'auto', 'relative' => true), array('defer' => true)); } -JHtml::_('stylesheet', 'com_jedchecker/style.css', array('version' => 'auto', 'relative' => true)); -JHtml::_('script', 'com_jedchecker/script.js', array('version' => 'auto', 'relative' => true), array('defer' => true)); +HTMLHelper::_('stylesheet', 'com_jedchecker/style.css', array('version' => 'auto', 'relative' => true)); +HTMLHelper::_('script', 'com_jedchecker/script.js', array('version' => 'auto', 'relative' => true), array('defer' => true)); ?>
@@ -36,36 +40,36 @@ JHtml::_('script', 'com_jedchecker/script.js', array('version' => 'auto', 'relat
- +

- +

- +

- +

    -
  1. -
  2. +
  3. +
-
+ aria-describedby="extension-upload" aria-label=""> -
+
- +
@@ -74,13 +78,13 @@ JHtml::_('script', 'com_jedchecker/script.js', array('version' => 'auto', 'relat
- +
-
+

- +

@@ -88,7 +92,7 @@ JHtml::_('script', 'com_jedchecker/script.js', array('version' => 'auto', 'relat