php8 fixes
Dieser Commit ist enthalten in:
Ursprung
3611f1dec4
Commit
316a8e26e0
5 geänderte Dateien mit 517 neuen und 439 gelöschten Zeilen
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
|
@ -41,7 +41,7 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
|
||||
class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
||||
/**
|
||||
* @var obj
|
||||
* @var
|
||||
* @access protected
|
||||
*/
|
||||
protected $oAuth; // for validating against fe-authentication
|
||||
|
@ -50,13 +50,13 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $aLevel;
|
||||
protected array $aLevel;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $iRootCat;
|
||||
protected int $iRootCat;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -68,7 +68,7 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @return void
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function __construct(DB_ConLite $oDb, array $aCfg, $iClient, $iLang, array $aCfgClient) {
|
||||
public function __construct(DB_ConLite $oDb, array $aCfg, int $iClient, int $iLang, array $aCfgClient) {
|
||||
parent::__construct($oDb, $aCfg, $iClient, $iLang, $aCfgClient);
|
||||
$this->iRootCat = -1;
|
||||
}
|
||||
|
@ -85,7 +85,8 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @return boolean
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
protected function loadSubCategories($iIdcat, $bAsObjects = true, $bWithSubCategories = false, $iSubCategoriesLoadDepth = 3) {
|
||||
protected function loadSubCategories(int $iIdcat, bool $bAsObjects = true, bool $bWithSubCategories = false, int $iSubCategoriesLoadDepth = 3): bool
|
||||
{
|
||||
$iIdcat = (int) $iIdcat;
|
||||
$bUseAuth = (is_null($this->oAuth)
|
||||
|| (get_class($this->oAuth) != 'Auth'
|
||||
|
@ -129,11 +130,11 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
$this->oDbg->show($sSql, 'Contenido_FrontendNavigation::loadSubCategories($iIdcat, $bAsObjects = true): $sSql');
|
||||
}
|
||||
$this->oDb->query($sSql);
|
||||
if ($this->oDb->Errno != 0) {
|
||||
if ($this->oDb->getErrno() != 0) {
|
||||
return false;
|
||||
}
|
||||
$this->aCategories = array();
|
||||
while ($this->oDb->next_record()) {
|
||||
while ($this->oDb->nextRecord()) {
|
||||
// check against fe-auth and against be-access
|
||||
if ($bUseAuth === true && intval($this->oDb->f('public')) == 0) {
|
||||
$sPerms = strval($this->oAuth->auth['perm']);
|
||||
|
@ -159,12 +160,17 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
}
|
||||
if($bAsObjects === true) {
|
||||
$oCategories = new Contenido_Categories(new DB_ConLite(), $this->aCfg);
|
||||
$oCategories->setDebug($this->bDbg, $this->sDbgMode);
|
||||
if(!empty($this->sDbgMode)) {
|
||||
$oCategories->setDebug($this->bDbg, $this->sDbgMode);
|
||||
} else {
|
||||
$oCategories->setDebug($this->bDbg, 'hidden');
|
||||
}
|
||||
$oCategories->setIdLang($this->iLang);
|
||||
$oCategories->setloadSubCategories($bWithSubCategories, $iSubCategoriesLoadDepth);
|
||||
$oCategories->load($this->aCategories, true, $this->iLang);
|
||||
$this->oCategories = $oCategories;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,7 +185,8 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @return mixed Contenido_Categories or Array, depending on value for $bAsObjects
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function getSubCategories($iIdcat, $bAsObjects = true, $bWithSubCategories = false, $iSubCategoriesLoadDepth = 3) {
|
||||
public function getSubCategories(int $iIdcat, bool $bAsObjects = true, bool $bWithSubCategories = false, int $iSubCategoriesLoadDepth = 3): mixed
|
||||
{
|
||||
$this->loadSubCategories($iIdcat, $bAsObjects, $bWithSubCategories, $iSubCategoriesLoadDepth);
|
||||
return $bAsObjects === true ? $this->oCategories : $this->aCategories;
|
||||
}
|
||||
|
@ -196,11 +203,11 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
}
|
||||
$sSql = 'SELECT level FROM ' . $this->aCfg["tab"]["cat_tree"] . ' WHERE idcat = ' . Contenido_Security::escapeDB(intval($iIdcat), $this->oDb);
|
||||
$this->oDb->query($sSql);
|
||||
if ($this->oDb->Errno != 0) {
|
||||
if ($this->oDb->getErrno() != 0) {
|
||||
return -1;
|
||||
}
|
||||
if ($this->oDb->num_rows() > 0) {
|
||||
$this->oDb->next_record();
|
||||
$this->oDb->nextRecord();
|
||||
return intval($this->oDb->f('level'));
|
||||
}
|
||||
return -1;
|
||||
|
@ -214,7 +221,8 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @return boolean
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function isActiveParent(Contenido_Category $oCategory, $iCurrentIdcat) {
|
||||
public function isActiveParent(Contenido_Category $oCategory, int $iCurrentIdcat): bool
|
||||
{
|
||||
if ($oCategory->getIdParent() > 0) {
|
||||
$iCurrentIdcat = (int) $iCurrentIdcat;
|
||||
if ($oCategory->getIdParent() == $iCurrentIdcat) {
|
||||
|
@ -234,7 +242,8 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @return boolean
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function isActiveChild(Contenido_Category $oCategory, $iCurrentIdcat) {
|
||||
public function isActiveChild(Contenido_Category $oCategory, int $iCurrentIdcat): bool
|
||||
{
|
||||
if ($oCategory->getSubCategories()->count() > 0) {
|
||||
$iCurrentIdcat = (int) $iCurrentIdcat;
|
||||
$oChildCategories = $oCategory->getSubCategories();
|
||||
|
@ -255,7 +264,8 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @param int $iTreeHaystackCat
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInPathToRoot($iNeedleCat, $iTreeHaystackCat) {
|
||||
public function isInPathToRoot(int $iNeedleCat, int $iTreeHaystackCat): bool
|
||||
{
|
||||
$oBreadcrumb = new Contenido_FrontendNavigation_Breadcrumb($this->oDb, $this->aCfg, $this->iClient, $this->iLang, $this->aCfgClient);
|
||||
$aBreadCats = $oBreadcrumb->getAsArray($iTreeHaystackCat, ($this->getLevel($this->getRootCat())+1));
|
||||
return in_array($iNeedleCat, $aBreadCats);
|
||||
|
@ -269,16 +279,18 @@ class Contenido_FrontendNavigation extends Contenido_FrontendNavigation_Base {
|
|||
* @return void
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function setAuth(Auth $oAuth) {
|
||||
public function setAuth(Auth $oAuth): void
|
||||
{
|
||||
$this->oAuth = $oAuth;
|
||||
}
|
||||
|
||||
public function setRootCat($iIdcat) {
|
||||
public function setRootCat($iIdcat): void
|
||||
{
|
||||
$this->iRootCat = (int) $iIdcat;
|
||||
}
|
||||
|
||||
public function getRootCat() {
|
||||
public function getRootCat(): int
|
||||
{
|
||||
return (int) $this->iRootCat;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -36,53 +36,51 @@ class Contenido_FrontendNavigation_Base {
|
|||
* @var int
|
||||
* @access protected
|
||||
*/
|
||||
protected $iLang;
|
||||
protected $iClient;
|
||||
protected int $iLang;
|
||||
protected int $iClient;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $aCategories;
|
||||
protected array $aCategories;
|
||||
|
||||
/**
|
||||
* @var obj
|
||||
* @var null|Contenido_Categories
|
||||
* @access protected
|
||||
*/
|
||||
protected $oCategories;
|
||||
protected null|Contenido_Categories $oCategories;
|
||||
|
||||
// needed properties for db queries
|
||||
/**
|
||||
* @var obj
|
||||
* @access protected
|
||||
*/
|
||||
protected $oDb;
|
||||
protected DB_ConLite $oDb;
|
||||
/**
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $aCfg;
|
||||
protected array $aCfg;
|
||||
/**
|
||||
* @var array
|
||||
* @access protected
|
||||
*/
|
||||
protected $aCfgClient;
|
||||
protected array $aCfgClient;
|
||||
/**
|
||||
* @var boolean
|
||||
* @access protected
|
||||
*/
|
||||
protected $bDbg;
|
||||
protected bool $bDbg;
|
||||
/**
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
protected $sDbgMode;
|
||||
protected string $sDbgMode;
|
||||
/**
|
||||
* @var obj
|
||||
* @access protected
|
||||
*/
|
||||
protected $oDbg;
|
||||
protected Debug_File|Debug_Visible|Debug_Hidden|Debug_VisibleAdv|Debug_DevNull|null $oDbg;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -94,14 +92,14 @@ class Contenido_FrontendNavigation_Base {
|
|||
* @return void
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function __construct(DB_ConLite $oDb, array $aCfg, $iClient, $iLang, array $aCfgClient) {
|
||||
public function __construct(DB_ConLite $oDb, array $aCfg, int $iClient, int $iLang, array $aCfgClient) {
|
||||
$this->oDb = $oDb;
|
||||
$this->aCfg = $aCfg;
|
||||
$this->iClient = (int) $iClient;
|
||||
$this->iLang = (int) $iLang;
|
||||
$this->aCfgClient = $aCfgClient;
|
||||
$this->_iCurrentLoadDepth = 1;
|
||||
$this->_aSubCategories = array();
|
||||
$this->_aSubCategories = [];
|
||||
$this->bDbg = false;
|
||||
$this->oDbg = null;
|
||||
}
|
||||
|
@ -114,22 +112,18 @@ class Contenido_FrontendNavigation_Base {
|
|||
* @param string $sStyle Available styles are: front_content, custom, custom_path
|
||||
* @param array $aConfig As default this is Contenido_UrlBuilderConfig::getConfig(), can be overridden by setting this value
|
||||
* @param boolean $bUseAbsolutePath If true, will use absolute http://www.xy.com/ as "prefix"
|
||||
* @return void
|
||||
* @throws InvalidArgumentException
|
||||
* @return string
|
||||
* @see appropriate Contenido_UrlBuilder for details on needed params
|
||||
* @todo Apply other styles as soon as they are available
|
||||
*/
|
||||
public function getUrl(array $aParams, $sStyle = 'custom_path', array $aConfig = array(), $bUseAbsolutePath = false) {
|
||||
try {
|
||||
$oUrlBuilder = Contenido_UrlBuilderFactory::getUrlBuilder($sStyle);
|
||||
if ($bUseAbsolutePath === true) {
|
||||
$oUrlBuilder->setHttpBasePath($this->aCfgClient[$this->iClient]['path']['htmlpath']);
|
||||
}
|
||||
$oUrlBuilder->buildUrl($aParams, $bUseAbsolutePath, $aConfig);
|
||||
return $oUrlBuilder->getUrl();
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw $e;
|
||||
public function getUrl(array $aParams, string $sStyle = 'custom_path', array $aConfig = array(), bool $bUseAbsolutePath = false): string
|
||||
{
|
||||
$oUrlBuilder = Contenido_UrlBuilderFactory::getUrlBuilder($sStyle);
|
||||
if ($bUseAbsolutePath === true) {
|
||||
$oUrlBuilder->setHttpBasePath($this->aCfgClient[$this->iClient]['path']['htmlpath']);
|
||||
}
|
||||
$oUrlBuilder->buildUrl($aParams, $bUseAbsolutePath, $aConfig);
|
||||
return $oUrlBuilder->getUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +134,8 @@ class Contenido_FrontendNavigation_Base {
|
|||
* @return void
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function setDebug($bDebug = true, $sDebugMode = 'visible') {
|
||||
public function setDebug($bDebug = true, $sDebugMode = 'visible'): void
|
||||
{
|
||||
if (!in_array($sDebugMode, array('visible', 'hidden'))) {
|
||||
$sDebugMode = 'hidden';
|
||||
}
|
||||
|
@ -154,4 +149,3 @@ class Contenido_FrontendNavigation_Base {
|
|||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -38,19 +38,19 @@ class Contenido_FrontendNavigation_Breadcrumb extends Contenido_FrontendNavigati
|
|||
* @access private
|
||||
* @desc Used for breadcrumb loop over tree
|
||||
*/
|
||||
private $_iCurrentLevel;
|
||||
private int $_iCurrentLevel;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @access private
|
||||
*/
|
||||
private $_bAsArray;
|
||||
private bool $_bAsArray;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
private $_aCategories;
|
||||
private array $_aCategories;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -62,7 +62,7 @@ class Contenido_FrontendNavigation_Breadcrumb extends Contenido_FrontendNavigati
|
|||
* @return void
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
public function __construct(DB_ConLite $oDb, array $aCfg, $iClient, $iLang, array $aCfgClient) {
|
||||
public function __construct(DB_ConLite $oDb, array $aCfg, int $iClient, $iLang, array $aCfgClient) {
|
||||
parent::__construct($oDb, $aCfg, $iClient, $iLang, $aCfgClient);
|
||||
$this->oCategories = null;
|
||||
$this->_bAsArray = false;
|
||||
|
@ -79,7 +79,8 @@ class Contenido_FrontendNavigation_Breadcrumb extends Contenido_FrontendNavigati
|
|||
* @author Rudi Bieller
|
||||
* @todo Add possibility to return an array
|
||||
*/
|
||||
public function get($iBaseCategoryId, $iRootLevel = 0, $bReset = false) {
|
||||
public function get(int $iBaseCategoryId, int $iRootLevel = 0, bool $bReset = false): ?array
|
||||
{
|
||||
$this->getBreadcrumb($iBaseCategoryId, $iRootLevel, $bReset);
|
||||
$this->oCategories->reverse(); // For a breadcrumb, we start at the main category, not the current one.
|
||||
return $this->oCategories;
|
||||
|
@ -96,7 +97,8 @@ class Contenido_FrontendNavigation_Breadcrumb extends Contenido_FrontendNavigati
|
|||
* @author Rudi Bieller
|
||||
* @todo Add possibility to return an array
|
||||
*/
|
||||
public function getAsArray($iBaseCategoryId, $iRootLevel = 0, $bReset = false) {
|
||||
public function getAsArray(int $iBaseCategoryId, int $iRootLevel = 0, bool $bReset = false): array
|
||||
{
|
||||
$this->_bAsArray = true;
|
||||
$this->getBreadcrumb($iBaseCategoryId, $iRootLevel, $bReset);
|
||||
$this->_aCategories = array_reverse($this->_aCategories); // For a breadcrumb, we start at the main category, not the current one.
|
||||
|
@ -113,7 +115,8 @@ class Contenido_FrontendNavigation_Breadcrumb extends Contenido_FrontendNavigati
|
|||
* @return array
|
||||
* @author Rudi Bieller
|
||||
*/
|
||||
protected function getBreadcrumb($iBaseCategoryId, $iRootLevel = 0, $bReset = false) {
|
||||
protected function getBreadcrumb(int $iBaseCategoryId, int $iRootLevel = 0, bool $bReset = false): Contenido_Categories|bool|array|null
|
||||
{
|
||||
// this method calls itself, so check if this happened already
|
||||
if ($bReset === true || is_null($this->oCategories) || $this->oCategories->count() == 0) {
|
||||
$this->oCategories = new Contenido_Categories($this->oDb, $this->aCfg);
|
||||
|
@ -138,10 +141,10 @@ class Contenido_FrontendNavigation_Breadcrumb extends Contenido_FrontendNavigati
|
|||
$this->oDbg->show($sSql, 'Contenido_FrontendNavigation_Breadcrumb::getBreadcrumb($iBaseCategoryId, $iRootLevel = 0, $bReset = false): $sSql');
|
||||
}
|
||||
$this->oDb->query($sSql);
|
||||
if ($this->oDb->Errno != 0) {
|
||||
if ($this->oDb->getErrno() != 0) {
|
||||
return false;
|
||||
}
|
||||
$this->oDb->next_record();
|
||||
$this->oDb->nextRecord();
|
||||
if ($this->_bAsArray === false) {
|
||||
$oContenidoCategory = new Contenido_Category(new DB_ConLite(), $this->aCfg);
|
||||
$oContenidoCategory->load(intval($this->oDb->f('idcat')), true, $this->iLang);
|
||||
|
@ -163,4 +166,3 @@ class Contenido_FrontendNavigation_Breadcrumb extends Contenido_FrontendNavigati
|
|||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -38,11 +38,11 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
class DebuggerFactory {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sType
|
||||
* @return Debug_VisibleAdv
|
||||
* @return Debug_File|Debug_Visible|Debug_Hidden|Debug_VisibleAdv|Debug_DevNull
|
||||
*/
|
||||
public static function getDebugger($sType) {
|
||||
public static function getDebugger(string $sType): Debug_File|Debug_Visible|Debug_Hidden|Debug_VisibleAdv|Debug_DevNull
|
||||
{
|
||||
$oDebugger = null;
|
||||
switch ($sType) {
|
||||
case 'visible':
|
||||
|
@ -73,4 +73,3 @@ class DebuggerFactory {
|
|||
return $oDebugger;
|
||||
}
|
||||
}
|
||||
?>
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren