Updated controllers, install and modules for PHP 8.x compatibility

This commit is contained in:
vishalsingh.qlo325
2025-05-23 15:08:00 +05:30
parent b9dbc449fe
commit 2f9c64d0fb
173 changed files with 688 additions and 939 deletions

View File

@@ -29,6 +29,7 @@ class AdminModulesCatalogControllerCore extends AdminController
const ELEMENT_TYPE_THEME = 2;
const MODULES_PER_PAGE = 18;
protected $themes;
public function __construct()
{
@@ -73,12 +74,12 @@ class AdminModulesCatalogControllerCore extends AdminController
$module->element_type = self::ELEMENT_TYPE_MODULE;
$module->logo = '../../img/questionmark.png';
if (@filemtime(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.basename(_PS_MODULE_DIR_).DIRECTORY_SEPARATOR.$module->name
.DIRECTORY_SEPARATOR.'logo.gif')) {
$logoGifPath = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.basename(_PS_MODULE_DIR_).DIRECTORY_SEPARATOR.$module->name.DIRECTORY_SEPARATOR.'logo.gif';
if (file_exists($logoGifPath) && @filemtime($logoGifPath)) {
$module->logo = 'logo.gif';
}
if (@filemtime(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.basename(_PS_MODULE_DIR_).DIRECTORY_SEPARATOR.$module->name
.DIRECTORY_SEPARATOR.'logo.png')) {
$logoPngPath = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.basename(_PS_MODULE_DIR_).DIRECTORY_SEPARATOR.$module->name.DIRECTORY_SEPARATOR.'logo.png';
if (file_exists($logoPngPath) && @filemtime($logoPngPath)) {
$module->logo = 'logo.png';
}
@@ -254,7 +255,7 @@ class AdminModulesCatalogControllerCore extends AdminController
if ($criteria != 'popularity') {
usort($list, function($a, $b) use($criteria){
if ($criteria == 'name') {
return strnatcasecmp($a->displayName, $b->displayName);
return (strnatcasecmp($a->displayName, $b->displayName)) ? 1 : 0;
} else if ($criteria == 'price_increasing') {
$priceA = $priceB = 0;
if (isset($a->price)) {
@@ -263,7 +264,7 @@ class AdminModulesCatalogControllerCore extends AdminController
if (isset($b->price)) {
$priceB = $b->price;
}
return $priceA > $priceB;
return ($priceA > $priceB) ? 1 : 0;
} else if ($criteria == 'price_decreasing') {
$priceA = $priceB = 0;
if (isset($a->price)) {
@@ -272,7 +273,7 @@ class AdminModulesCatalogControllerCore extends AdminController
if (isset($b->price)) {
$priceB = $b->price;
}
return $priceA < $priceB;
return ($priceA < $priceB) ? 1 : 0;
}
});
@@ -316,4 +317,4 @@ class AdminModulesCatalogControllerCore extends AdminController
'num_block_per_page' => self::MODULES_PER_PAGE
));
}
}
}