Fix deprecation warnings for using trim() on null

This commit is contained in:
Kijin Sung 2023-01-16 22:34:26 +09:00
parent 33b58b5e77
commit bdae876529
2 changed files with 7 additions and 7 deletions

View file

@ -324,7 +324,7 @@ class CommentItem extends BaseObject
function isExistsHomepage()
{
if(trim($this->get('homepage')))
if(trim($this->get('homepage') ?? ''))
{
return TRUE;
}
@ -334,7 +334,7 @@ class CommentItem extends BaseObject
function getHomepageUrl()
{
$url = trim($this->get('homepage'));
$url = trim($this->get('homepage') ?? '');
if(!$url)
{
return;

View file

@ -440,17 +440,17 @@ class DocumentItem extends BaseObject
return $this->get('ipaddress');
}
return '*' . strstr($this->get('ipaddress'), '.');
return '*' . strstr($this->get('ipaddress') ?? '', '.');
}
function isExistsHomepage()
{
return (bool) trim($this->get('homepage'));
return (bool) trim($this->get('homepage') ?? '');
}
function getHomepageUrl()
{
if(!$url = trim($this->get('homepage')))
if(!$url = trim($this->get('homepage') ?? ''))
{
return;
}
@ -594,7 +594,7 @@ class DocumentItem extends BaseObject
}
$title = escape($this->getTitleText($cut_size, $tail), false);
$this->add('title_color', trim($this->get('title_color')));
$this->add('title_color', trim($this->get('title_color') ?? ''));
$attrs = array();
if($this->get('title_bold') == 'Y')
@ -603,7 +603,7 @@ class DocumentItem extends BaseObject
}
if($this->get('title_color') && $this->get('title_color') != 'N')
{
$attrs[] = 'color:#' . ltrim($this->get('title_color'), '#');
$attrs[] = 'color:#' . ltrim($this->get('title_color') ?? '', '#');
}
if(count($attrs))
{