mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-24 15:27:23 +00:00
[FilterMore] limit number of entries
This commit is contained in:
parent
d6ec70a444
commit
707a8324e5
@ -86,6 +86,7 @@ class FilterMoreBridge extends FeedExpander
|
|||||||
],
|
],
|
||||||
'defaultValue' => 'asc',
|
'defaultValue' => 'asc',
|
||||||
],
|
],
|
||||||
|
'limit' => self::LIMIT,
|
||||||
|
|
||||||
]];
|
]];
|
||||||
|
|
||||||
@ -158,6 +159,7 @@ class FilterMoreBridge extends FeedExpander
|
|||||||
public function collectExpandableDatas($url, $maxItems = -1)
|
public function collectExpandableDatas($url, $maxItems = -1)
|
||||||
{
|
{
|
||||||
parent::collectExpandableDatas($url, $maxItems);
|
parent::collectExpandableDatas($url, $maxItems);
|
||||||
|
$limit = (int)($this->getInput('limit') ?: 10);
|
||||||
if ($this->getInput('sort_by') === 'random') {
|
if ($this->getInput('sort_by') === 'random') {
|
||||||
shuffle($this->items);
|
shuffle($this->items);
|
||||||
} elseif ($this->getInput('sort_by') !== 'none') {
|
} elseif ($this->getInput('sort_by') !== 'none') {
|
||||||
@ -171,6 +173,9 @@ class FilterMoreBridge extends FeedExpander
|
|||||||
if ($this->getInput('sort_dir') === 'desc') {
|
if ($this->getInput('sort_dir') === 'desc') {
|
||||||
$this->items = array_reverse($this->items);
|
$this->items = array_reverse($this->items);
|
||||||
}
|
}
|
||||||
|
if ($limit > 0) {
|
||||||
|
$this->items = array_slice($this->items, 0, $limit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function cmp($a, $b)
|
private function cmp($a, $b)
|
||||||
|
Loading…
Reference in New Issue
Block a user