From af27b6d300723883f1110eee103eb892ddf1056d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 15 Sep 2018 13:06:29 +0200 Subject: Tags split improvement (#2023) * Tags split improvement Some feeds use a single category with comma-separated tags. Better handling of tags containing a space * Handle spaces in searches with + Can now search in tags containing spaces * Fix searches with spaces for title and author --- app/Models/Feed.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'app/Models/Feed.php') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index ed381a867..cc96cde44 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -345,13 +345,21 @@ class FreshRSS_Feed extends Minz_Model { $link = $item->get_permalink(); $date = @strtotime($item->get_date()); - // gestion des tags (catégorie == tag) - $tags_tmp = $item->get_categories(); + //Tag processing (tag == category) + $categories = $item->get_categories(); $tags = array(); - if ($tags_tmp !== null) { - foreach ($tags_tmp as $tag) { - $tags[] = html_only_entity_decode($tag->get_label()); + if (is_array($categories)) { + foreach ($categories as $category) { + $text = html_only_entity_decode($category->get_label()); + //Some feeds use a single category with comma-separated tags + $labels = explode(',', $text); + if (is_array($labels)) { + foreach ($labels as $label) { + $tags[] = trim($label); + } + } } + $tags = array_unique($tags); } $content = html_only_entity_decode($item->get_content()); -- cgit v1.2.3