1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 17:56:34 +00:00

tag-related fixes

1. move tag sanitization to feedparser common item class
2. enforce length limit on tags when parsing
3. support multiple tags passed via one dc:subject and other such elements, parse them as a comma-separated list
4. sort resulting tag list to prevent different order between feed updates
5. remove some duplicate code related to tag validation
6. allow + symbol in tags
This commit is contained in:
Andrew Dolgov
2019-11-20 18:56:34 +03:00
parent ffa3f9309f
commit 304d3a0b88
5 changed files with 52 additions and 83 deletions

View File

@@ -103,20 +103,20 @@ class FeedItem_Atom extends FeedItem_Common {
function get_categories() {
$categories = $this->elem->getElementsByTagName("category");
$cats = array();
$cats = [];
foreach ($categories as $cat) {
if ($cat->hasAttribute("term"))
array_push($cats, trim($cat->getAttribute("term")));
array_push($cats, $cat->getAttribute("term"));
}
$categories = $this->xpath->query("dc:subject", $this->elem);
foreach ($categories as $cat) {
array_push($cats, clean(trim($cat->nodeValue)));
array_push($cats, $cat->nodeValue);
}
return $cats;
return $this->normalize_categories($cats);
}
function get_enclosures() {