diff options
| author | 2018-05-01 17:02:11 +0200 | |
|---|---|---|
| committer | 2018-05-01 17:02:11 +0200 | |
| commit | b552abb3327f09baa1c0f4e821dc9f6bd6ef738e (patch) | |
| tree | dc5439bcf0e65d16fda118d45d2ded0c7ff7230c /app/Models/Feed.php | |
| parent | 404ca869e9aafa40931914812b8552e4b9973694 (diff) | |
JSON column for feeds (#1838)
* Draft of JSON column for feeds
https://github.com/FreshRSS/FreshRSS/issues/1654
* Add some per-feed options
* Feed cURL timeout
* Mark updated articles as read https://github.com/FreshRSS/FreshRSS/issues/891
* Mark as read upon reception https://github.com/FreshRSS/FreshRSS/issues/1702
* Ignore SSL (unsafe) https://github.com/FreshRSS/FreshRSS/issues/1811
* Try PHPCS workaround
While waiting for a better syntax support
Diffstat (limited to 'app/Models/Feed.php')
| -rw-r--r-- | app/Models/Feed.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 196d94931..04101c10d 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -26,6 +26,7 @@ class FreshRSS_Feed extends Minz_Model { private $error = false; private $keep_history = self::KEEP_HISTORY_DEFAULT; private $ttl = self::TTL_DEFAULT; + private $attributes = array(); private $mute = false; private $hash = null; private $lockPath = ''; @@ -114,6 +115,13 @@ class FreshRSS_Feed extends Minz_Model { public function ttl() { return $this->ttl; } + public function attributes($key = '') { + if ($key == '') { + return $this->attributes; + } else { + return isset($this->attributes[$key]) ? $this->attributes[$key] : null; + } + } public function mute() { return $this->mute; } @@ -234,6 +242,22 @@ class FreshRSS_Feed extends Minz_Model { $this->ttl = abs($value); $this->mute = $value < self::TTL_DEFAULT; } + + public function _attributes($key, $value) { + if ($key == '') { + if (is_string($value)) { + $value = json_decode($value, true); + } + if (is_array($value)) { + $this->attributes = $value; + } + } elseif ($value === null) { + unset($this->attributes[$key]); + } else { + $this->attributes[$key] = $value; + } + } + public function _nbNotRead($value) { $this->nbNotRead = intval($value); } @@ -253,7 +277,7 @@ class FreshRSS_Feed extends Minz_Model { if ($this->httpAuth != '') { $url = preg_replace('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url); } - $feed = customSimplePie(); + $feed = customSimplePie($this->attributes()); if (substr($url, -11) === '#force_feed') { $feed->force_feed(true); $url = substr($url, 0, -11); |
