summaryrefslogtreecommitdiff
path: root/classes/feeditem
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2014-03-04 16:38:04 +0400
committerAndrew Dolgov <[email protected]>2014-03-04 16:38:04 +0400
commit31bd6f7643bf139802a224f4584caca3cbbcc9b8 (patch)
tree1b042a485937c850aa40919ba2b2bcff8fb65e50 /classes/feeditem
parent4ce778677ef16353d5b0b8342a29bd65575310f5 (diff)
parser: trim some some feed-extracted data link titles and links
Diffstat (limited to 'classes/feeditem')
-rw-r--r--classes/feeditem/atom.php10
-rw-r--r--classes/feeditem/rss.php12
2 files changed, 11 insertions, 11 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php
index 74be03d80..48e3aa567 100644
--- a/classes/feeditem/atom.php
+++ b/classes/feeditem/atom.php
@@ -43,9 +43,9 @@ class FeedItem_Atom extends FeedItem_Common {
$base = $this->xpath->evaluate("string(ancestor-or-self::*[@xml:base][1]/@xml:base)", $link);
if ($base)
- return rewrite_relative_url($base, $link->getAttribute("href"));
+ return rewrite_relative_url($base, trim($link->getAttribute("href")));
else
- return $link->getAttribute("href");
+ return trim($link->getAttribute("href"));
}
}
@@ -55,7 +55,7 @@ class FeedItem_Atom extends FeedItem_Common {
$title = $this->elem->getElementsByTagName("title")->item(0);
if ($title) {
- return $title->nodeValue;
+ return trim($title->nodeValue);
}
}
@@ -106,13 +106,13 @@ class FeedItem_Atom extends FeedItem_Common {
foreach ($categories as $cat) {
if ($cat->hasAttribute("term"))
- array_push($cats, $cat->getAttribute("term"));
+ array_push($cats, trim($cat->getAttribute("term")));
}
$categories = $this->xpath->query("dc:subject", $this->elem);
foreach ($categories as $cat) {
- array_push($cats, $cat->nodeValue);
+ array_push($cats, trim($cat->nodeValue));
}
return $cats;
diff --git a/classes/feeditem/rss.php b/classes/feeditem/rss.php
index 28f4a388d..bf08a1dfe 100644
--- a/classes/feeditem/rss.php
+++ b/classes/feeditem/rss.php
@@ -33,20 +33,20 @@ class FeedItem_RSS extends FeedItem_Common {
|| $link->getAttribute("rel") == "alternate"
|| $link->getAttribute("rel") == "standout")) {
- return $link->getAttribute("href");
+ return trim($link->getAttribute("href"));
}
}
$link = $this->elem->getElementsByTagName("guid")->item(0);
if ($link && $link->hasAttributes() && $link->getAttribute("isPermaLink") == "true") {
- return $link->nodeValue;
+ return trim($link->nodeValue);
}
$link = $this->elem->getElementsByTagName("link")->item(0);
if ($link) {
- return $link->nodeValue;
+ return trim($link->nodeValue);
}
}
@@ -54,7 +54,7 @@ class FeedItem_RSS extends FeedItem_Common {
$title = $this->elem->getElementsByTagName("title")->item(0);
if ($title) {
- return $title->nodeValue;
+ return trim($title->nodeValue);
}
}
@@ -90,13 +90,13 @@ class FeedItem_RSS extends FeedItem_Common {
$cats = array();
foreach ($categories as $cat) {
- array_push($cats, $cat->nodeValue);
+ array_push($cats, trim($cat->nodeValue));
}
$categories = $this->xpath->query("dc:subject", $this->elem);
foreach ($categories as $cat) {
- array_push($cats, $cat->nodeValue);
+ array_push($cats, trim($cat->nodeValue));
}
return $cats;