diff --git a/helper.php b/helper.php old mode 100755 new mode 100644 index 60e9312..f8600ec --- a/helper.php +++ b/helper.php @@ -9,13 +9,16 @@ defined('_JEXEC') or die ('Restricted access'); -use Joomla\CMS\Helper\ModuleHelper; +use Joomla\CMS\Factory; -if (version_compare(JVERSION, '4.0.0', '>=')) { +if (version_compare(JVERSION, '5.0.0', '<')) { +if (version_compare(JVERSION, '4.0.0', '>=')) +{ require_once JPATH_LIBRARIES . '/classmap.php'; } else { require_once(JPATH_SITE . '/components/com_content/helpers/route.php'); } +} // loads module function file jimport('joomla.event.dispatcher'); @@ -34,9 +37,9 @@ class modDisplayNewsHelper var string $version = "DisplayNews by BK 3.0.3"; var string $target = ""; static array $shown_list = array(); - var JApplicationSite $app; + var Joomla\CMS\Application\SiteApplication $app; var string $currcontentid; - var JRegistry $params; + var Joomla\Registry\Registry $params; function readmore_out($row, $aroute, $aparams): string { @@ -977,8 +980,6 @@ function dn_hovertext($text1, $text2): string function truncate($text, $length = 100, $ending = '...', $exact = true, $considerHtml = false): array { - require_once(JPATH_LIBRARIES . '/phputf8/utf8.php'); - if (utf8_strlen($ending) > $length) { $ending = utf8_substr($ending, 0, $length); } @@ -1255,8 +1256,8 @@ function init_params($params, $module_id): bool $this->set_article_id = array_filter(array_merge((array)($this->params->get('set_article_id')), (array)($this->params->get('set_article_archived_id')), - explode(",", $this->params->get('set_article_id_extra')), - explode(",", $this->params->get('set_article_archived_id_extra')))); + explode(",", $this->params->get('set_article_id_extra') ?? ''), + explode(",", $this->params->get('set_article_archived_id_extra') ?? ''))); // $set_author_id = $this->params->get( 'set_author_id'); // $set_author_name = $this->params->get( 'set_author_name'); @@ -1542,7 +1543,7 @@ function init_params($params, $module_id): bool if ($this->view == "article") { $temp = $this->app->input->getString('id'); - $temp = explode(':', $temp); + $temp = explode(':', $temp ?? ''); $this->currcontentid = $temp[0]; } @@ -2178,7 +2179,7 @@ function mod_title_out($row): string function main(&$params, $module_id): string { - $this->app = JFactory::getApplication(); + $this->app = Factory::getApplication(); if ($this->init_params($params, $module_id) === false) { return ""; diff --git a/mod_dn.xml b/mod_dn.xml index 233c5ea..d4e4f2f 100644 --- a/mod_dn.xml +++ b/mod_dn.xml @@ -2,12 +2,12 @@ DisplayNews BK - 2022-Nov-27 - (C) 2006 - 2022 BK. All rights reserved. + 2023-Nov-03 + (C) 2006 - 2023 BK. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL bkomraz1@gmail.com http://joomla.rjews.net - 3.0.3 + 4.0.0 DISPLAY_NEWS_BY_BK_MODULE