aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-05-12 22:15:10 +0200
committerGravatar GitHub <noreply@github.com> 2022-05-12 22:15:10 +0200
commit4a87206f2898665e99953590536cedc6c5505f05 (patch)
tree398f53769048460071194d398c61c7e847f22d7e /app/Models
parent9d1930d9adb4f56ae12209d3d01f4a1ed1af8503 (diff)
OPML export/import of some proprietary FreshRSS attributes (#4342)
* OPML export/import of some proprietary FreshRSS attributes #fix https://github.com/FreshRSS/FreshRSS/issues/4077 And one of the TODOs of https://github.com/FreshRSS/FreshRSS/pull/4220 XPath options, CSS Selector, and action filters * Bump library patch version * OPML namespace + documentation * Add example
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/BooleanSearch.php5
-rw-r--r--app/Models/Feed.php12
-rw-r--r--app/Models/FeedDAO.php4
-rw-r--r--app/Models/FilterAction.php3
4 files changed, 17 insertions, 7 deletions
diff --git a/app/Models/BooleanSearch.php b/app/Models/BooleanSearch.php
index e2f99d524..774e42073 100644
--- a/app/Models/BooleanSearch.php
+++ b/app/Models/BooleanSearch.php
@@ -5,6 +5,7 @@
*/
class FreshRSS_BooleanSearch {
+ /** @var string */
private $raw_input = '';
private $searches = array();
@@ -54,11 +55,11 @@ class FreshRSS_BooleanSearch {
return null;
}
- public function __toString() {
+ public function __toString(): string {
return $this->getRawInput();
}
- public function getRawInput() {
+ public function getRawInput(): string {
return $this->raw_input;
}
}
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index e0d26046b..b5b6fdfd8 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -245,7 +245,7 @@ class FreshRSS_Feed extends Minz_Model {
}
$this->url = $value;
}
- public function _kind($value) {
+ public function _kind(int $value) {
$this->kind = $value;
}
public function _category($value) {
@@ -567,8 +567,8 @@ class FreshRSS_Feed extends Minz_Model {
$feedSourceUrl = preg_replace('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $feedSourceUrl);
}
- // Same naming conventions than https://github.com/RSS-Bridge/rss-bridge/wiki/XPathAbstract
- // https://github.com/RSS-Bridge/rss-bridge/wiki/The-collectData-function
+ // Same naming conventions than https://rss-bridge.github.io/rss-bridge/Bridge_API/XPathAbstract.html
+ // https://rss-bridge.github.io/rss-bridge/Bridge_API/BridgeAbstract.html#collectdata
/** @var array<string,string> */
$xPathSettings = $this->attributes('xpath');
$xPathFeedTitle = $xPathSettings['feedTitle'] ?? '';
@@ -758,7 +758,8 @@ class FreshRSS_Feed extends Minz_Model {
}
}
- public function filtersAction(string $action) {
+ /** @return array<FreshRSS_BooleanSearch> */
+ public function filtersAction(string $action): array {
$action = trim($action);
if ($action == '') {
return array();
@@ -775,6 +776,9 @@ class FreshRSS_Feed extends Minz_Model {
return $filters;
}
+ /**
+ * @param array<string> $filters
+ */
public function _filtersAction(string $action, $filters) {
$action = trim($action);
if ($action == '' || !is_array($filters)) {
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index c4a0b1429..89e667813 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -104,6 +104,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
'website' => $feed->website(),
'description' => $feed->description(),
'lastUpdate' => 0,
+ 'pathEntries' => $feed->pathEntries(),
'httpAuth' => $feed->httpAuth(),
'attributes' => $feed->attributes(),
);
@@ -384,6 +385,9 @@ SQL;
return false;
}
+ /**
+ * @return array<FreshRSS_Feed>
+ */
public function listByCategory(int $cat): array {
$sql = 'SELECT * FROM `_feed` WHERE category=?';
$stm = $this->pdo->prepare($sql);
diff --git a/app/Models/FilterAction.php b/app/Models/FilterAction.php
index 23a45d14e..394b573a4 100644
--- a/app/Models/FilterAction.php
+++ b/app/Models/FilterAction.php
@@ -2,6 +2,7 @@
class FreshRSS_FilterAction {
+ /** @var FreshRSS_BooleanSearch */
private $booleanSearch = null;
private $actions = null;
@@ -33,7 +34,7 @@ class FreshRSS_FilterAction {
'actions' => $this->actions,
);
}
- return '';
+ return [];
}
public static function fromJSON($json) {