Fix type error in content widget

https://xetown.com/questions/1801863
This commit is contained in:
Kijin Sung 2024-01-03 20:24:32 +09:00
parent 264a88d72d
commit a06383bd44

View file

@ -394,7 +394,7 @@ class content extends WidgetHandler
{
$args->rss_url = $rss;
$content_item = $this->_getRssItems($args);
if(count($content_item) > 0)
if(!empty($content_item))
{
$browser_title = $content_item[0]->getBrowserTitle();
$args->mid_lists[] = $browser_title;
@ -492,6 +492,7 @@ class content extends WidgetHandler
// Date Format
$DATE_FORMAT = $args->date_format ? $args->date_format : "Y-m-d H:i:s";
$content_items = array();
$buff = $this->requestFeedContents($args->rss_url);
$encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
@ -512,8 +513,6 @@ class content extends WidgetHandler
if(!$items) return;
if($items && !is_array($items)) $items = array($items);
$content_items = array();
foreach ($items as $key => $value)
{
if($key >= $args->list_count * $args->page_count) break;
@ -552,8 +551,6 @@ class content extends WidgetHandler
if(!$items) return;
if($items && !is_array($items)) $items = array($items);
$content_items = array();
foreach ($items as $key => $value)
{
if($key >= $args->list_count * $args->page_count) break;
@ -604,8 +601,6 @@ class content extends WidgetHandler
if(!$items) return;
if($items && !is_array($items)) $items = array($items);
$content_items = array();
foreach ($items as $key => $value)
{
if($key >= $args->list_count * $args->page_count) break;