blob: 23a45d14e819d0b3617654c1ac60b8475662d98a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php
class FreshRSS_FilterAction {
private $booleanSearch = null;
private $actions = null;
private function __construct($booleanSearch, $actions) {
$this->booleanSearch = $booleanSearch;
$this->_actions($actions);
}
public function booleanSearch() {
return $this->booleanSearch;
}
public function actions() {
return $this->actions;
}
public function _actions($actions) {
if (is_array($actions)) {
$this->actions = array_unique($actions);
} else {
$this->actions = null;
}
}
public function toJSON() {
if (is_array($this->actions) && $this->booleanSearch != null) {
return array(
'search' => $this->booleanSearch->getRawInput(),
'actions' => $this->actions,
);
}
return '';
}
public static function fromJSON($json) {
if (!empty($json['search']) && !empty($json['actions']) && is_array($json['actions'])) {
return new FreshRSS_FilterAction(new FreshRSS_BooleanSearch($json['search']), $json['actions']);
}
return null;
}
}
|