forked from blallo/rss-bridge
[FilterMore] has_media
This commit is contained in:
parent
82dd4994ce
commit
0089605181
1 changed files with 13 additions and 1 deletions
|
@ -49,6 +49,13 @@ class FilterMoreBridge extends FeedExpander {
|
||||||
'exampleValue' => '-1 hour',
|
'exampleValue' => '-1 hour',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'has_media' => array(
|
||||||
|
'name' => 'Has at least 1 media inside',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'required' => false,
|
||||||
|
'defaultValue' => false,
|
||||||
|
),
|
||||||
|
|
||||||
'invert_filter' => array(
|
'invert_filter' => array(
|
||||||
'name' => 'Invert filter result',
|
'name' => 'Invert filter result',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
|
@ -80,7 +87,7 @@ class FilterMoreBridge extends FeedExpander {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filters = ['filterByTitle', 'filterByBody', 'filterByAuthor', 'filterByDateNewer', 'filterByDateOlder'];
|
$filters = ['filterByTitle', 'filterByBody', 'filterByAuthor', 'filterByDateNewer', 'filterByDateOlder', 'filterByMedia'];
|
||||||
$results = [];
|
$results = [];
|
||||||
|
|
||||||
foreach($filters as $filter) {
|
foreach($filters as $filter) {
|
||||||
|
@ -151,6 +158,11 @@ class FilterMoreBridge extends FeedExpander {
|
||||||
protected function filterByDateOlder($item){
|
protected function filterByDateOlder($item){
|
||||||
return $this->filterByDate($item, 'older_than', -1);
|
return $this->filterByDate($item, 'older_than', -1);
|
||||||
}
|
}
|
||||||
|
protected function filterByMedia($item) {
|
||||||
|
if(!$this->getInput('has_media')) return null;
|
||||||
|
if(count($item['enclosures']) > 0) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getConjType(){
|
protected function getConjType(){
|
||||||
return $this->getInput('conj_type');
|
return $this->getInput('conj_type');
|
||||||
|
|
Loading…
Reference in a new issue