N°5302 - PHP 8.1: Migrate some strlen() usages to internal method

This commit is contained in:
Molkobain
2023-01-16 16:47:26 +01:00
parent b2c256e51e
commit da07fadfb3
5 changed files with 6 additions and 5 deletions

View File

@@ -70,7 +70,7 @@ class BlobField extends Field
else else
{ {
$sFilename = $this->currentValue->GetFileName(); $sFilename = $this->currentValue->GetFileName();
$iSize = utils::BytesToFriendlyFormat(strlen($this->currentValue->GetData())); $iSize = utils::BytesToFriendlyFormat(utils::Strlen($this->currentValue->GetData()));
$sOpenLink = $this->GetDisplayUrl(); $sOpenLink = $this->GetDisplayUrl();
$sDownloadLink = $this->GetDownloadUrl(); $sDownloadLink = $this->GetDownloadUrl();

View File

@@ -37,7 +37,7 @@ class EmailField extends StringField
public function GetDisplayValue() public function GetDisplayValue()
{ {
$sLabel = Str::pure2html($this->currentValue); $sLabel = Str::pure2html($this->currentValue);
if (strlen($sLabel) > 128) if (utils::StrLen($sLabel) > 128)
{ {
// Truncate the length to 128 characters, by removing the middle // Truncate the length to 128 characters, by removing the middle
$sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20);

View File

@@ -41,7 +41,7 @@ class ImageField extends BlobField
else else
{ {
$sFilename = $this->currentValue->GetFileName(); $sFilename = $this->currentValue->GetFileName();
$iSize = utils::BytesToFriendlyFormat(strlen($this->currentValue->GetData())); $iSize = utils::BytesToFriendlyFormat(utils::StrLen($this->currentValue->GetData()));
$sOpenLink = $this->GetDisplayUrl(); $sOpenLink = $this->GetDisplayUrl();
$sDownloadLink = $this->GetDownloadUrl(); $sDownloadLink = $this->GetDownloadUrl();

View File

@@ -37,7 +37,7 @@ class PhoneField extends StringField
public function GetDisplayValue() public function GetDisplayValue()
{ {
$sLabel = Str::pure2html($this->currentValue); $sLabel = Str::pure2html($this->currentValue);
if (strlen($sLabel) > 128) if (utils::StrLen($sLabel) > 128)
{ {
// Truncate the length to 128 characters, by removing the middle // Truncate the length to 128 characters, by removing the middle
$sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20);

View File

@@ -21,6 +21,7 @@ namespace Combodo\iTop\Form\Field;
use Str; use Str;
use Closure; use Closure;
use utils;
/** /**
* Description of UrlField * Description of UrlField
@@ -58,7 +59,7 @@ class UrlField extends StringField
public function GetDisplayValue() public function GetDisplayValue()
{ {
$sLabel = Str::pure2html($this->currentValue); $sLabel = Str::pure2html($this->currentValue);
if (strlen($sLabel) > 128) if (utils::StrLen($sLabel) > 128)
{ {
// Truncate the length to 128 characters, by removing the middle // Truncate the length to 128 characters, by removing the middle
$sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20); $sLabel = substr($sLabel, 0, 100).'.....'.substr($sLabel, -20);