N°4517 - PHP 8.1: Replace strlen() usages with utils::StrLen() for compatibility

This commit is contained in:
Molkobain
2022-05-18 19:59:20 +02:00
parent d3fb08ba81
commit 60aaa01e2e
3 changed files with 10 additions and 10 deletions

View File

@@ -655,7 +655,7 @@ abstract class MenuNode
$this->sMenuId = $sMenuId; $this->sMenuId = $sMenuId;
$this->iParentIndex = $iParentIndex; $this->iParentIndex = $iParentIndex;
$this->aReflectionProperties = array(); $this->aReflectionProperties = array();
if (strlen($sEnableClass) > 0) if (utils::StrLen($sEnableClass) > 0)
{ {
$this->aReflectionProperties['enable_class'] = $sEnableClass; $this->aReflectionProperties['enable_class'] = $sEnableClass;
$this->aReflectionProperties['enable_action'] = $iActionCode; $this->aReflectionProperties['enable_action'] = $iActionCode;

View File

@@ -461,7 +461,7 @@ abstract class MetaModel
$oStyle = self::$m_aClassParams[$sClass]['style']; $oStyle = self::$m_aClassParams[$sClass]['style'];
$sIcon = $oStyle->GetIconAsAbsUrl(); $sIcon = $oStyle->GetIconAsAbsUrl();
} }
if (strlen($sIcon) == 0) { if (utils::StrLen($sIcon) == 0) {
$sParentClass = self::GetParentPersistentClass($sClass); $sParentClass = self::GetParentPersistentClass($sClass);
if (strlen($sParentClass) > 0) { if (strlen($sParentClass) > 0) {
return self::GetClassIcon($sParentClass, $bImgTag, $sMoreStyles); return self::GetClassIcon($sParentClass, $bImgTag, $sMoreStyles);
@@ -494,7 +494,7 @@ abstract class MetaModel
$oStyle = new ormStyle("ibo-class-style--$sClass", "ibo-class-style-alt--$sClass"); $oStyle = new ormStyle("ibo-class-style--$sClass", "ibo-class-style-alt--$sClass");
} }
if ((strlen($oStyle->GetMainColor()) > 0) && (strlen($oStyle->GetComplementaryColor()) > 0) && (strlen($oStyle->GetIconAsRelPath()) > 0)) { if ((utils::StrLen($oStyle->GetMainColor()) > 0) && (utils::StrLen($oStyle->GetComplementaryColor()) > 0) && (utils::StrLen($oStyle->GetIconAsRelPath()) > 0)) {
// all the parameters are set, no need to search in the parent classes // all the parameters are set, no need to search in the parent classes
return $oStyle; return $oStyle;
} }
@@ -504,18 +504,18 @@ abstract class MetaModel
while (strlen($sParentClass) > 0) { while (strlen($sParentClass) > 0) {
$oParentStyle = self::GetClassStyle($sParentClass); $oParentStyle = self::GetClassStyle($sParentClass);
if (!is_null($oParentStyle)) { if (!is_null($oParentStyle)) {
if (strlen($oStyle->GetMainColor()) == 0) { if (utils::StrLen($oStyle->GetMainColor()) == 0) {
$oStyle->SetMainColor($oParentStyle->GetMainColor()); $oStyle->SetMainColor($oParentStyle->GetMainColor());
$oStyle->SetStyleClass($oParentStyle->GetStyleClass()); $oStyle->SetStyleClass($oParentStyle->GetStyleClass());
} }
if (strlen($oStyle->GetComplementaryColor()) == 0) { if (utils::StrLen($oStyle->GetComplementaryColor()) == 0) {
$oStyle->SetComplementaryColor($oParentStyle->GetComplementaryColor()); $oStyle->SetComplementaryColor($oParentStyle->GetComplementaryColor());
$oStyle->SetAltStyleClass($oParentStyle->GetAltStyleClass()); $oStyle->SetAltStyleClass($oParentStyle->GetAltStyleClass());
} }
if (strlen($oStyle->GetIconAsRelPath()) == 0) { if (utils::StrLen($oStyle->GetIconAsRelPath()) == 0) {
$oStyle->SetIcon($oParentStyle->GetIconAsRelPath()); $oStyle->SetIcon($oParentStyle->GetIconAsRelPath());
} }
if ((strlen($oStyle->GetMainColor()) > 0) && (strlen($oStyle->GetComplementaryColor()) > 0) && (strlen($oStyle->GetIconAsRelPath()) > 0)) { if ((utils::StrLen($oStyle->GetMainColor()) > 0) && (utils::StrLen($oStyle->GetComplementaryColor()) > 0) && (utils::StrLen($oStyle->GetIconAsRelPath()) > 0)) {
// all the parameters are set, no need to search in the parent classes // all the parameters are set, no need to search in the parent classes
return $oStyle; return $oStyle;
} }
@@ -523,7 +523,7 @@ abstract class MetaModel
$sParentClass = self::GetParentPersistentClass($sParentClass); $sParentClass = self::GetParentPersistentClass($sParentClass);
} }
if ((strlen($oStyle->GetMainColor()) == 0) && (strlen($oStyle->GetComplementaryColor()) == 0) && (strlen($oStyle->GetIconAsRelPath()) == 0)) { if ((utils::StrLen($oStyle->GetMainColor()) == 0) && (utils::StrLen($oStyle->GetComplementaryColor()) == 0) && (utils::StrLen($oStyle->GetIconAsRelPath()) == 0)) {
return null; return null;
} }

View File

@@ -423,11 +423,11 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
$oButton->SetActionType($sActionType) $oButton->SetActionType($sActionType)
->SetColor($sColor); ->SetColor($sColor);
if (strlen($sValue) > 0) { if (utils::StrLen($sValue) > 0) {
$oButton->SetValue($sValue); $oButton->SetValue($sValue);
} }
if (strlen($sName) > 0) { if (utils::StrLen($sName) > 0) {
$oButton->SetName($sName); $oButton->SetName($sName);
} }