aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-09-15 13:06:29 +0200
committerGravatar GitHub <noreply@github.com> 2018-09-15 13:06:29 +0200
commitaf27b6d300723883f1110eee103eb892ddf1056d (patch)
tree2bf68be80d624723dedc78262105546f0bc0088d /app/Models/Feed.php
parent60cc39db25de4f70c9a78930f5901d49b081c1f5 (diff)
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
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php18
1 files changed, 13 insertions, 5 deletions
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());