Get applied filters from request.

@return array
16020
public static function getAppliedFilters()
    {
        $classMethods = get_class_methods(get_class());
        $calledClassMethods = get_class_methods(get_called_class());

        $filteredMethods = array_filter(
            $calledClassMethods, function ($calledClassMethod) use ($classMethods) {
                return !in_array($calledClassMethod, $classMethods, true);
            }
        );

        return \Illuminate\Support\Facades\Request::only($filteredMethods);
    }
1029674
public function getFilters(): array
    {
        return [
            new TwigFilter('substr', 'substr'),
            new TwigFilter('tokenize', 'Cake\Utility\Text::tokenize'),
            new TwigFilter('insert', 'Cake\Utility\Text::insert'),
            new TwigFilter('cleanInsert', 'Cake\Utility\Text::cleanInsert'),
            new TwigFilter('wrap', 'Cake\Utility\Text::wrap'),
            new TwigFilter('wrapBlock', 'Cake\Utility\Text::wrapBlock'),
            new TwigFilter('wordWrap', 'Cake\Utility\Text::wordWrap'),
            new TwigFilter('highlight', 'Cake\Utility\Text::highlight'),
            new TwigFilter('tail', 'Cake\Utility\Text::tail'),
            new TwigFilter('truncate', 'Cake\Utility\Text::truncate'),
            new TwigFilter('excerpt', 'Cake\Utility\Text::excerpt'),
            new TwigFilter('toList', 'Cake\Utility\Text::toList'),
            new TwigFilter('isMultibyte', 'Cake\Utility\Text::isMultibyte'),
            new TwigFilter('utf8', 'Cake\Utility\Text::utf8'),
            new TwigFilter('ascii', 'Cake\Utility\Text::ascii'),
            new TwigFilter('parseFileSize', 'Cake\Utility\Text::parseFileSize'),
            new TwigFilter('none', function ($string) {
                return;
            }),
        ];
    }
1279825
public function getFiltering()
    {
        if ($this->filtering === null) {
            $this->filtering = new Filtering($this);
        }
        return $this->filtering;
    }
200082
protected function getFilter()
    {
        $supports = $this->supports();
        $filters = $this->entityManager->getFilters()->getEnabledFilters();
        $fFilter = null;

        foreach ($filters as $name => $filter) {
            if ($filter instanceof $supports) {
                $fFilter = $filter;

                break;
            }
        }

        return $fFilter;
    }
107927
private function applyFilters()
    {
        $availableOptions = ['name', 'method', 'uri', 'action', 'middleware'];
        foreach ($this->options() as $key => $option) {
            if (in_array($key, $availableOptions) && null != $option) {
                foreach ($this->routes as $index => $route) {
                    if (!str_contains(strtolower($route[$key]), strtolower($option)))
                        unset($this->routes[$index]);
                }
            }
        }
    }
403765
public function getInputFilterSpecification(): array
    {
        return [
            'api_key' => [
                'required' => false,
                'filters' => [
                    ['name' => StripTags::class],
                    ['name' => StringTrim::class],
                ],
                'validators' => [
                    ['name' => StringLength::class, 'options' => [
                        'encoding' => 'UTF-8',
                        'min'      => 10,
                        'max'      => 20,
                    ]],
                    ['name' => Alnum::class],
                ],
            ],
            'blog' => [
                'required' => false,
                'filters' => [
                    ['name' => StripTags::class],
                    ['name' => StringTrim::class],
                ],
                'validators' => [
                    ['name' => StringLength::class, 'options' => [
                        'encoding' => 'UTF-8',
                        'min'      => 10,
                        'max'      => 255,
                    ]],
                    ['name' => Uri::class, 'options' => [
                        'uriHandler'    => Http::class,
                        'allowRelative' => false,
                    ]],
                ],
            ],
        ];
    }
692102
protected function applyMetaFilters()
	{
		if (isset($this->meta_filters_applied)) {
			return $this->meta_filters_applied;
		}
		
		if (empty($this->filters)) {
			return $this->meta_filters_applied = false;
		}
		
		$meta_model = $this->model->metaModel();
		$meta_instance = new $meta_model;
		$meta_query = $meta_instance->newQuery();
		
		if (isset($this->meta_context)) {
			if (method_exists($meta_model, 'applyQueryContext')) {
				call_user_func_array(array($meta_model, 'applyQueryContext'), array($meta_query, $this->meta_context));
			}
		}
		
		$filters = $this->filters;
		$meta_query->where(function ($query) use ($filters) {
			foreach ($filters as $filter) {
				foreach ($filter['metas'] as $sub_filter) {
					if (isset($sub_filter['id'])) {
						$query->orWhere('id', $sub_filter['id']);
					}
					else if (isset($sub_filter['name'])) {
						$query->orWhere('name', $sub_filter['name']);
					}
				}
			}
		});
		
		$metas = $meta_query->get();
		$meta_items = $metas->lists('num_items', 'id');
		
		$found = array(
			'id'   => $metas->lists('id', 'id'),
			'name' => $metas->lists('id', 'name'),
		);
		
		foreach ($filters as &$filter) {
			$found_one = false;
			
			foreach ($filter['metas'] as $idx => &$sub_filter) {
				$key = isset($sub_filter['id']) ? 'id' : 'name';
				$key_value = $sub_filter[$key];
				
				if (!array_key_exists($key_value, $found[$key])) {
					unset($filter['metas'][$idx]);
					continue;
				}
				
				$found_one = true;
				$sub_filter['id'] = $found[$key][$key_value];
				
				$num_items = $meta_items[$found[$key][$key_value]];
				if (!isset($filter['num_items']) || $num_items > $filter['num_items']) {
					$filter['num_items'] = $num_items;
				}
			}
			
			if (!$found_one) {
				return $this->meta_filters_applied = false;
			}
			
			if (count($filter['metas']) > 1) {
				$filter['num_items'] += 100000000;
			}
		}
		
		usort($filters, function ($a, $b) {
			return ($a['num_items'] < $b['num_items']) ? -1 : 1;
		});
		
		$set_distinct = false;
		
		$first_filter = current(array_splice($filters, 0, 1));
		if (count($first_filter['metas']) > 1) {
			$this->where(function ($query) use ($first_filter) {
				foreach ($first_filter['metas'] as $f) {
					if (isset($f['value'])) {
						$query->orWhere(function ($query) use ($f) {
							$query->where('m.meta_id', $f['id']);
							$query->where('m.value', $f['operator'], $f['value']);
						});
					}
					else {
						$query->orWhere('m.meta_id', $f['id']);
					}
				}
			});
			
			if (!$set_distinct) {
				$this->distinct();
				$set_distinct = true;
			}
		}
		else {
			foreach ($first_filter['metas'] as $f) {
				$this->where('m.meta_id', $f['id']);
				if (isset($f['value'])) {
					$this->where('m.value', $f['operator'], $f['value']);
				}
			}
		}
		
		foreach ($filters as $i => $cur_filter) {
			$this->join("{$this->model->metableTable()} AS m{$i}", function ($join) use ($i, $cur_filter) {
				$join_query = $join->on('m.xref_id', '=', "m{$i}.xref_id");
				
				if (count($cur_filter['metas']) <= 1) {
					foreach ($cur_filter['metas'] as $f) {
						if (isset($f['value'])) {
							$join_query->where("m{$i}.meta_id", '=', $f['id']);
							$join_query->where("m{$i}.value", $f['operator'], $f['value']);
						}
						else {
							$join_query->where("m{$i}.meta_id", '=', $f['id']);
						}
					}
				}
			});
			
			if (count($cur_filter['metas']) > 1) {
				$this->where(function ($query) use ($cur_filter, $i) {
					foreach ($cur_filter['metas'] as $f) {
						if (isset($f['value'])) {
							$query->orWhere(function ($query2) use ($f, $i) {
								$query2->where("m{$i}.meta_id", $f['id']);
								$query2->where("m{$i}.value", $f['operator'], $f['value']);
							});
						}
						else {
							$query->orWhere("m{$i}.meta_id", $f['id']);
						}
					}
				});
				
				if (!$set_distinct) {
					$this->distinct();
					$set_distinct = true;
				}
			}
		}
		
		return $this->meta_filters_applied = true;
	}
22901
public function getFilters(Request $request): Request
    {
        // check for exist filters in request and get filters
        if (isset($request['filters'])) {
            $filters = json_decode($request['filters'], true);
        } else {
            $filters = [];
        }

        $request[$this->getRequestTagName('filter')] = $filters;

        return $request;
    }
973576
public function getFilters()
    {
        if (is_array($this->filters)) {
            // set from cache! (for export)
            return $this->filters;
        }

        $filters = [];

        $optionsRenderer = $this->getOptionsRenderer();
        $parameterNames = $optionsRenderer['parameterNames'];

        $request = $this->getRequest();
        $isSearch = $request->getPost($parameterNames['isSearch'], $request->getQuery($parameterNames['isSearch']));
        if ('true' == $isSearch) {
            // User filtering
            foreach ($this->getColumns() as $column) {
                /* @var $column \ZfcDatagrid\Column\AbstractColumn */
                if ($request->getPost($column->getUniqueId(), $request->getQuery($column->getUniqueId())) != '') {
                    $value = $request->getPost($column->getUniqueId(), $request->getQuery($column->getUniqueId()));

                    $filter = new \ZfcDatagrid\Filter();
                    $filter->setFromColumn($column, $value);

                    $filters[] = $filter;

                    $column->setFilterActive($filter->getDisplayColumnValue());
                }
            }
        }

        if (empty($filters)) {
            // No user sorting -> get default sorting
            $filters = $this->getFiltersDefault();
        }

        $this->filters = $filters;

        return $this->filters;
    }
825666
public function getFilteredPages()
    {
        $pages = Versioned::get_by_stage(SiteTree::class, 'Stage');
        $pages = $this->applyDefaultFilters($pages);
        $pages = $pages->filterByCallback(function (SiteTree $page) {
            // If page exists on stage but not on live
            return $page->isOnDraftOnly();
        });
        return $pages;
    }
250658
public function getFilters()
    {
        //get the model's filter fields
        $configFilters = $this->config->getOption('filters');

        //make sure that the filters array hasn't been created before and that there are supplied filters in the config
        if (empty($this->filters) && $configFilters) {
            //iterate over the filters and create field objects for them
            foreach ($configFilters as $name => $filter) {
                if ($fieldObject = $this->make($name, $filter)) {
                    //the filters array is indexed on the field name and holds the arrayed values for the filters
                    $this->filters[$fieldObject->getOption('field_name')] = $fieldObject;
                }
            }
        }

        return $this->filters;
    }
125404
public function getFilterFormats() {
    $options = [];
    $formats = filter_formats($this->currentUser);
    foreach ($formats as $format) {
      $options[$format->id()] = $format->label();
    }
    return $options;
  }
480183
public function getFilters(): array
    {
        return [
            new TwigFilter('serialize', 'serialize'),
            new TwigFilter('unserialize', 'unserialize'),
            new TwigFilter('md5', 'md5'),
            new TwigFilter('base64_encode', 'base64_encode'),
            new TwigFilter('base64_decode', 'base64_decode'),
            new TwigFilter('nl2br', 'nl2br'),
            new TwigFilter('string', function ($str) {
                return (string)$str;
            }),
        ];
    }
283882
public function onFilterGetOptions()
    {
        $this->defineFilterScopes();

        $searchQuery = post('search');
        if (!$scopeName = post('scopeName')) {
            return;
        }

        $scope = $this->getScope($scopeName);
        $activeKeys = $scope->value ? array_keys($scope->value) : [];
        $available = $this->getAvailableOptions($scope, $searchQuery);
        $active = $searchQuery ? [] : $this->filterActiveOptions($activeKeys, $available);

        return [
            'scopeName' => $scopeName,
            'options' => [
                'available' => $this->optionsToAjax($available),
                'active'    => $this->optionsToAjax($active),
            ]
        ];
    }
119316
protected function getCustomFilters()
    {
        $filters = (array) $this->getOption('custom_filters');

        return array_filter(
            $filters,
            function ($name) {
                return is_string($name);
            },
            ARRAY_FILTER_USE_KEY
        );
    }
841243
public function getFilters()
    {
        $roles = user_roles(true);
        unset($roles[DRUPAL_AUTHENTICATED_RID]);

        return [
            (new Filter('status', $this->t("Active")))->setChoicesMap(
                [
                    0 => $this->t("No"),
                    1 => $this->t("Yes"),
                ]
            ),
            (new Filter('role', $this->t("Role")))->setChoicesMap($roles),
            (new Filter('name', $this->t("Name"))),
        ];
    }
1210608
public function getFilters(): Collection
    {
        $filters = collect();
        foreach ($this->filters() as $filter) {
            $filter = new $filter($this);
            $filters->push($filter);
        }

        return $filters;
    }