diff options
| author | 2021-02-16 12:00:49 -0500 | |
|---|---|---|
| committer | 2021-02-16 18:00:49 +0100 | |
| commit | fe1fba9828ad4d68a3cc93ed5f8e361f34e5a873 (patch) | |
| tree | ca9168f79844b0320f7731a1f2969d3d112c4eac /app/Models/Entry.php | |
| parent | 5daee165dc73fcf74673f2ede1891dbd5821c9f4 (diff) | |
Add a content action parameter to work with CSS selector (#3453)
Before, when retrieving article contents with CSS selector, the content
of the RSS feed was replaced by the content of the CSS selector. It works
well in most of the cases but if there is a different content in the feed
and in the selector, the former is lost.
Now, there is a parameter to decide which action is performed after retrieving
the content. By default, the previous behavior is kept. But now, it is
possible to append or prepend the CSS selector content to the feed content.
See #3451
Diffstat (limited to 'app/Models/Entry.php')
| -rw-r--r-- | app/Models/Entry.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 784576455..13c32b7a6 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -446,8 +446,20 @@ class FreshRSS_Entry extends Minz_Model { $feed->pathEntries(), $feed->attributes() ); - if ($fullContent != '') { - $this->content = $fullContent; + if ('' !== $fullContent) { + switch ($feed->attributes('content_action')) { + case 'prepend': + $this->content = $fullContent . $this->content(); + break; + case 'append': + $this->content = $this->content() . $fullContent; + break; + case 'replace': + default: + $this->content = $fullContent; + break; + } + return true; } } catch (Exception $e) { |
