Piwik\API\DataTableGenericFilter::applyGenericFilters PHP Метод

applyGenericFilters() защищенный Метод

Disable this feature by setting the parameter disable_generic_filters to 1 in the API call request.
protected applyGenericFilters ( DataTable $datatable ) : boolean
$datatable Piwik\DataTable
Результат boolean
    protected function applyGenericFilters($datatable)
    {
        if ($datatable instanceof DataTable\Map) {
            $tables = $datatable->getDataTables();
            foreach ($tables as $table) {
                $this->applyGenericFilters($table);
            }
            return;
        }
        $genericFilters = $this->getGenericFiltersHavingDefaultValues();
        $filterApplied = false;
        foreach ($genericFilters as $filterMeta) {
            $filterName = $filterMeta[0];
            $filterParams = $filterMeta[1];
            $filterParameters = array();
            $exceptionRaised = false;
            if (in_array($filterName, $this->disabledFilters)) {
                continue;
            }
            foreach ($filterParams as $name => $info) {
                if (!is_array($info)) {
                    // hard coded value that cannot be changed via API, see eg $naturalSort = true in 'Sort'
                    $filterParameters[] = $info;
                } else {
                    // parameter type to cast to
                    $type = $info[0];
                    // default value if specified, when the parameter doesn't have a value
                    $defaultValue = null;
                    if (isset($info[1])) {
                        $defaultValue = $info[1];
                    }
                    try {
                        $value = Common::getRequestVar($name, $defaultValue, $type, $this->request);
                        settype($value, $type);
                        $filterParameters[] = $value;
                    } catch (Exception $e) {
                        $exceptionRaised = true;
                        break;
                    }
                }
            }
            if (!$exceptionRaised) {
                $datatable->filter($filterName, $filterParameters);
                $filterApplied = true;
            }
        }
        return $filterApplied;
    }