These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @package content |
||
4 | */ |
||
5 | /** |
||
6 | * The AjaxSections page return an object of all sections and their fields |
||
7 | * that are available for pre-population |
||
8 | */ |
||
9 | |||
10 | class contentAjaxFilters extends JSONPage |
||
11 | { |
||
12 | public function view() |
||
13 | { |
||
14 | $handle = General::sanitize($_GET['handle']); |
||
15 | $section = General::sanitize($_GET['section']); |
||
16 | $options = array(); |
||
17 | $filters = array(); |
||
18 | |||
19 | if (!empty($handle) && !empty($section)) { |
||
20 | $section_id = SectionManager::fetchIDFromHandle($section); |
||
21 | $field_id = FieldManager::fetchFieldIDFromElementName($handle, $section_id); |
||
22 | $field = FieldManager::fetch($field_id); |
||
23 | |||
24 | View Code Duplication | if (!empty($field) && $field->canPublishFilter() === true) { |
|
0 ignored issues
–
show
|
|||
25 | if (method_exists($field, 'getToggleStates')) { |
||
26 | $options = $field->getToggleStates(); |
||
0 ignored issues
–
show
|
|||
27 | } elseif (method_exists($field, 'findAllTags')) { |
||
28 | $options = $field->findAllTags(); |
||
0 ignored issues
–
show
|
|||
29 | } |
||
30 | } |
||
31 | } |
||
32 | |||
33 | foreach ($options as $value => $data) { |
||
34 | $filters[] = array( |
||
35 | 'value' => ($value ? $value : $data), |
||
36 | 'text' => ($data ? $data : $value) |
||
37 | ); |
||
38 | } |
||
39 | |||
40 | $this->_Result['filters'] = $filters; |
||
41 | } |
||
42 | } |
||
43 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.