HTTP GET checker

@param string $id GET key to check
@param int $filter Filter type - http://php.net/manual/en/filter.filters.sanitize.php
@param array $filterOptions Filter options
@return mixed boolean if no filter is set
325376
public function isQuery($id=false,$filter=null,$filterOptions=array())
		{
			if(!$id)
			{
				return (isset($_SERVER['REQUEST_METHOD']) && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') ? true : false;
			}
			else
			{
				if(isset($_GET[$id]))
				{
					return $filter ? filter_var($_GET[$id],$filter,$filterOptions) : true;
				}
				else
				{
					return false;
				}
			}
		}
328243
public function getFilter($id, $counterId, $params = [])
    {
        $resource = 'counter/' . $counterId . '/filter/' . $id;
        $response = $this->sendGetRequest($resource, $params);
        $filterResponse = new Models\GetFilterResponse($response);
        return $filterResponse->getFilter();
    }
28881
private function createFilter($filter, $options = null)
    {
        $params = [];
        $data = $this->classmap[$filter];
        if (isset($options)) {
            if (!isset($data['options'])) {
                throw new InvalidConfigException('Filter "' . $filter . '" has no options.');
            }
            foreach ($options as $option => $value) {
                if (!isset($data['options'][$option])) {
                    throw new InvalidConfigException('Option "' . $option . '" is not defined for filter "' . $filter . '".');
                }
                $o = array_merge(['accept' => 'item', 'call' => 'param'], $data['options'][$option]);
                $ref = $o['reference'];
                if (!isset($params[$ref])) {
                    $params[$ref] = [];
                }
                if (isset($o['method']) && $o['call'] == 'param') {
                    $o['call'] = 'method';
                }
                if (!isset($o['method']) && $o['call'] == 'method') {
                    $o['method'] = $option;
                }
                if ($o['accept'] == 'items') {
                    if (!is_array($value)) {
                        throw new InvalidConfigException('Expects option "' . $option . '" to be array, ' .
                            gettype($value) . ' given in filter "' . $filter . '".');
                    }
                }
                if (isset($o['filter'])) {
                    if ($o['accept'] == 'items') {
                        foreach ($value as $k => &$v) {
                            $v = $o['filter']($v);
                        }
                    }
                    else {
                        $value = $o['filter']($value);
                    }
                }
                switch ($o['call']) {
                    case 'compact':
                        $key = isset($o['method']) ? 'method' : 'param';
                        if (!isset($params[$ref][$key])) {
                            $params[$ref][$key] = [];
                        }
                        if (isset($o['method'])) {
                            if (!isset($params[$ref][$key][$o['method']])) {
                                $params[$ref][$key][$o['method']] = [$option => $value];
                            } else {
                                array_push($params[$ref][$key][$o['method']], [$option => $value]);
                            }
                        } else {
                            $params[$ref][$key] = array_merge_recursive($params[$ref][$key], [$option => $value]);
                        }
                        break;
                    case 'method':
                        if (!isset($params[$ref]['method'])) {
                            $params[$ref]['method'] = [];
                        }
                        $params[$ref]['method'][] = [$o['method'], $value];
                        break;
                    case 'property':
                        if (!isset($params[$ref]['property'])) {
                            $params[$ref]['property'] = [];
                        }
                        $params[$ref]['property'][isset($o['property']) ? $o['property'] : $option] = $value;
                        break;
                    case 'param':
                        $params[$ref]['param'] = $value;
                        break;
                }
            }
        }
        foreach (['parser', 'renderer', 'filter'] as $type) {
            if (isset($data[$type])) {
                $args = [];
                if ($type == 'filter') {
                    array_push($args, $data['parser']);
                    if (isset($data['renderer'])) {
                        array_push($args, $data['renderer']);
                    }
                }
                if (isset($params[$type]['param'])) {
                    if (isset($data[$type.'_params_offset'])) {
                        $args += $data[$type.'_params_offset'];
                    }
                    array_push($args, $params[$type]['param']);
                }
                $object = (new ReflectionClass($data[$type]))->newInstanceArgs($args);
                if (!empty($params[$type]['method'])) {
                    foreach ($params[$type]['method'] as $name => $opt) {
                        if (is_numeric($name)) {
                            $object->$opt[0]($opt[1]);
                        } else {
                            $object->$name($opt);
                        }
                    }
                }
                if (!empty($params[$type]['property'])) {
                    foreach ($params[$type]['property'] as $property => $value) {
                        $object->$property = $value;
                    }
                }
                $data[$type] = $object;
            }
        }
        if (isset($params['self']) && !empty($params['self']['method'])) {
            foreach ($params['self']['method'] as $name => $opt) {
                if (is_numeric($name)) {
                    $this->$opt[0]($data, $opt[1]);
                } else {
                    $this->$name($data, $opt);
                }
            }
        }
        return $data['filter'];
    }
1154389
protected function prepareFilter(array $filter)
    {
        foreach ($filter as $code => &$value) {
            if ($code === 'id') {
                intval($value);

                if ($value <= 0) {
                    throw new ArgumentNullException($code);
                }
            } elseif ($code === 'base') {

                if (!is_bool($value)) {
                    throw new ArgumentNullException($code);
                }

            } else {
                trim(htmlspecialchars($value));

                if (strlen($value) <= 0) {
                    throw new ArgumentNullException($code);
                }
            }
        }

        return $filter;
    }
1120896
public function buildFilterRulesForUsedOnly($filter, $idList = [])
    {
        $result = $this
            ->getConnection()
            ->createQueryBuilder()
            ->select('value_id AS id')
            ->from('tl_metamodel_tag_relation')
            ->where('att_id=:attId')
            ->groupBy('value_id')
            ->setParameter('attId', $this->get('id'));

        if (!empty($idList)) {
            $result
                ->andWhere('item_id IN (:itemIds)')
                ->setParameter('itemIds', $idList, Connection::PARAM_STR_ARRAY);
        }

        $filter->addFilterRule(SimpleQuery::createFromQueryBuilder($result));
    }
1221800
public function isPost($id=false,$filter=null,$filterOptions=array())
		{
			if(!$id)
			{
				return (isset($_SERVER['REQUEST_METHOD']) && strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') ? true : false;
			}
			else
			{
				if(isset($_POST[$id]))
				{
					return $filter ? filter_var($_POST[$id],$filter,$filterOptions) : true;
				}
				else
				{
					return false;
				}
			}
		}
486615
public function getFilter($column, $filter = null)
    {
        if (null === $filter) {
            return $this->filters[$column] ?? null;
        }
        return $this->filters[$column][$filter] ?? null;
    }
915561
public function findFilterOptionsToDisplay($filter)
    {
        $options = array();

        foreach ($filter['options'] as $option) {
            // should we check if the filter option is available in
            // the current search result?

            if ($this->conf['checkFilterCondition'] != 'none') {
                // Once one filter option has been selected, don't display the
                // others anymore since this leads to a strange behaviour (options are
                // only displayed if they have BOTH tags: the selected and the other filter option.
                if ((!count($filter['selectedOptions'])
                        || in_array($option['uid'], $filter['selectedOptions'])
                    ) && $this->filters->checkIfTagMatchesRecords($option['tag'])
                ) {
                    // build link which selects this option and keeps all the other selected filters
                    unset($linkconf);
                    $linkconf['parameter'] = $GLOBALS['TSFE']->id;
                    $linkconf['additionalParams'] = '&tx_kesearch_pi1[sword]='
                        . $this->piVars['sword']
                        . '&tx_kesearch_pi1[filter]['
                        . $filter['uid']
                        . ']='
                        . $option['tag'];
                    $linkconf['useCacheHash'] = false;
                    if (is_array($this->piVars['filter']) && count($this->piVars['filter'])) {
                        foreach ($this->piVars['filter'] as $key => $value) {
                            if ($key != $filter['uid']) {
                                $linkconf['additionalParams'] .= '&tx_kesearch_pi1[filter][' . $key . ']=' . $value;
                            }
                        }
                    }
                    $optionLink = $this->cObj->typoLink_URL($linkconf);

                    $options[$option['uid']] = array(
                        'title' => $option['title'],
                        'value' => $option['tag'],
                        'results' => $this->tagsInSearchResult[$option['tag']],
                        'selected' => is_array($filter['selectedOptions'])
                            && in_array($option['uid'], $filter['selectedOptions']),
                        'link' => $optionLink
                    );
                }
            } else {
                // do not process any checks; show all filter options
                $options[$option['uid']] = array(
                    'title' => $option['title'],
                    'value' => $option['tag'],
                    'selected' =>
                        is_array($filter['selectedOptions'])
                        && !empty($filter['selectedOptions'])
                        && in_array($option['uid'], $filter['selectedOptions']),
                );
            }
        }

        return $options;
    }
50058
private static function validateFilter($value, $filter, $options, Validator $validator)
    {
        if (!is_string($value) || filter_var($value, $filter, $options) !== false) {
            return null;
        }

        // This workaround allows otherwise valid protocol relative urls to pass.
        // @see https://bugs.php.net/bug.php?id=72301
        if ($filter === FILTER_VALIDATE_URL && is_string($value) && strpos($value, '//') === 0) {
            if (filter_var('http:' . $value, $filter, $options) !== false) {
                return null;
            }
        }

        return error('The value must match the format {parameter}.', $validator);
    }
741266
public function getFilteredOptions(string $filter) : array
    {
        $options = call_user_func($this->fieldOptionsLoader, $filter);
        return (new ArrayFieldOptions($options))->getAll();
    }
589260
public function getParameter($name, $filter = FILTER_SANITIZE_STRING)
    {
        $parameterMap = $this->getParameterMap();
        if (isset($parameterMap[$name])) {
            return filter_var($parameterMap[$name], $filter);
        }
    }
506929
public function setFromFilterId( models\ParentalControl\FilterPlanning $filterPlanning, $filterId) {
        $service = sprintf( self::API_PARENTAL_FILTER_PLANNING, $filterId);
        $rest = $this->getService( $service);
        $rest->PUT( $filterPlanning);

        return $rest->getResult( models\ParentalControl\FilterPlanning::class);
    }
33073
protected function getFilterParams(array &$filters, $filter)
    {
        $fragments = preg_split('%;%', $filter, -1, PREG_SPLIT_NO_EMPTY);

        $name = array_shift($fragments);
        $params = [];

        foreach ($fragments as $param) {
            list($key, $value)  = explode('=', $param);
            $params[$key] = $value;
        }

        $filters[$name] = $params;
    }
106630
public function getFilterData($filterId = null)
    {
        if ($filterId !== null) {
            foreach ($this->filterData as $filter) {
                if ($filter->getId() == $filterId) {
                    return $filter;
                }
            }
            return null;
        } else {
            return $this->filterData;
        }
    }
834269
public static function getOptions($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/options' . $filter->toQuery(), 'Option');
    }
1215606
public static function updateId($id, $data, $params=[], $filter=false) {
        return static::dao()->updateId($id, $data, $params, $filter);
    }
353087
private function applyFilter(Filter $filter)
    {
        list($filtered, $errors) = $filter->apply($this->value);
        if (count($errors) === 0) {
            return $filtered;
        }

        foreach ($errors as $error) {
            $this->paramErrors->append($this->paramName, $error);
        }

        return null;
    }