summaryrefslogtreecommitdiff
path: root/classes/feeditem
diff options
context:
space:
mode:
Diffstat (limited to 'classes/feeditem')
-rwxr-xr-xclasses/feeditem/atom.php14
-rwxr-xr-xclasses/feeditem/common.php2
-rwxr-xr-xclasses/feeditem/rss.php6
3 files changed, 12 insertions, 10 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php
index cac6d8c54..f6c96f959 100755
--- a/classes/feeditem/atom.php
+++ b/classes/feeditem/atom.php
@@ -19,19 +19,19 @@ class FeedItem_Atom extends FeedItem_Common {
$updated = $this->elem->getElementsByTagName("updated")->item(0);
if ($updated) {
- return strtotime($updated->nodeValue);
+ return strtotime($updated->nodeValue ?? '');
}
$published = $this->elem->getElementsByTagName("published")->item(0);
if ($published) {
- return strtotime($published->nodeValue);
+ return strtotime($published->nodeValue ?? '');
}
$date = $this->xpath->query("dc:date", $this->elem)->item(0);
if ($date) {
- return strtotime($date->nodeValue);
+ return strtotime($date->nodeValue ?? '');
}
// consistent with strtotime failing to parse
@@ -43,7 +43,8 @@ class FeedItem_Atom extends FeedItem_Common {
$links = $this->elem->getElementsByTagName("link");
foreach ($links as $link) {
- if ($link && $link->hasAttribute("href") &&
+ /** @phpstan-ignore-next-line */
+ if ($link->hasAttribute("href") &&
(!$link->hasAttribute("rel")
|| $link->getAttribute("rel") == "alternate"
|| $link->getAttribute("rel") == "standout")) {
@@ -180,7 +181,8 @@ class FeedItem_Atom extends FeedItem_Common {
$encs = [];
foreach ($links as $link) {
- if ($link && $link->hasAttribute("href") && $link->hasAttribute("rel")) {
+ /** @phpstan-ignore-next-line */
+ if ($link->hasAttribute("href") && $link->hasAttribute("rel")) {
$base = $this->xpath->evaluate("string(ancestor-or-self::*[@xml:base][1]/@xml:base)", $link);
if ($link->getAttribute("rel") == "enclosure") {
@@ -199,7 +201,7 @@ class FeedItem_Atom extends FeedItem_Common {
}
}
- $encs = array_merge($encs, parent::get_enclosures());
+ array_push($encs, ...parent::get_enclosures());
return $encs;
}
diff --git a/classes/feeditem/common.php b/classes/feeditem/common.php
index 6a9be8aca..fde481179 100755
--- a/classes/feeditem/common.php
+++ b/classes/feeditem/common.php
@@ -189,7 +189,7 @@ abstract class FeedItem_Common extends FeedItem {
$tmp = [];
foreach ($cats as $rawcat) {
- $tmp = array_merge($tmp, explode(",", $rawcat));
+ array_push($tmp, ...explode(",", $rawcat));
}
$tmp = array_map(function($srccat) {
diff --git a/classes/feeditem/rss.php b/classes/feeditem/rss.php
index 7017d04e9..e07fd1d06 100755
--- a/classes/feeditem/rss.php
+++ b/classes/feeditem/rss.php
@@ -17,13 +17,13 @@ class FeedItem_RSS extends FeedItem_Common {
$pubDate = $this->elem->getElementsByTagName("pubDate")->item(0);
if ($pubDate) {
- return strtotime($pubDate->nodeValue);
+ return strtotime($pubDate->nodeValue ?? '');
}
$date = $this->xpath->query("dc:date", $this->elem)->item(0);
if ($date) {
- return strtotime($date->nodeValue);
+ return strtotime($date->nodeValue ?? '');
}
// consistent with strtotime failing to parse
@@ -153,7 +153,7 @@ class FeedItem_RSS extends FeedItem_Common {
array_push($encs, $enc);
}
- $encs = array_merge($encs, parent::get_enclosures());
+ array_push($encs, ...parent::get_enclosures());
return $encs;
}