从URL分段信息中获取值
@param $key
@param string $def
@param null $filter
@return mixed|null|string
@throws Exception
765104
public function getParam($key, $def = "", $filter = null)
    {
        $val = $this->params[$key];
        if ($filter) {
            $val = Filter::factory($val, $filter);
        }
        return $val === null ? $def : $val;
    }
875138
public function post($name = '', $default = null, $filter = null) {
        $value = $_POST;
        if ($name) {
            $value = $value[ $name ];
        }
        return $this->value($value, $default, $filter);
    }
1199245
public function route($name = '', $default = null, $filter = '')
    {
        if (is_array($name)) {
            $this->param        = [];
            return $this->route = array_merge($this->route, $name);
        }
        return $this->input($this->route, $name, $default, $filter);
    }
150497
private function buildQuery(string $url, string $apiKey, string $locale = null, string $region = null) : string
    {
        if (null !== $apiKey) {
            $url = sprintf('%s&key=%s', $url, $apiKey);
        }
        if (null !== $locale) {
            $url = sprintf('%s&language=%s', $url, $locale);
        }
        if (null !== $region) {
            $url = sprintf('%s&region=%s', $url, $region);
        }

        return $url;
    }
759059
public function get($name = null, $filter = null, $default = null)
    {
        return $this->getHelper($_REQUEST, $name, $filter, $default);
    }
282582
public static route[] get_filtered(nitro_service service, String filter) throws Exception{
		route obj = new route();
		options option = new options();
		option.set_filter(filter);
		route[] response = (route[]) obj.getfiltered(service, option);
		return response;
	}
720871
public static function toProtobuf($object, $filter = NULL)
	{
		$output = '';

		if (isset($object->error) && ($filter === null || isset($filter['error']))) {
			$output .= "\x0a";
			$output .= Binary::encodeVarint(strlen($object->error));
			$output .= $object->error;
		}

		if (isset($object->file) && ($filter === null || isset($filter['file']))) {
			foreach ($object->file instanceof \Traversable ? $object->file : (array)$object->file as $k => $v) {
				$output .= "\x7a";
				$buffer = FileMeta::toProtobuf($v, $filter === null ? null : $filter['file']);
				$output .= Binary::encodeVarint(strlen($buffer));
				$output .= $buffer;
			}
		}

		return $output;
	}
1352291
public function select(array $filter = [], array $options = [])
    {
        // Create query object from filter and option arrays
        $query = $this->getQuery($filter, $options);

        try {
            $cursor = $this->getInstance()->executeQuery(
                $this->getParam('database') . '.' . $this->getCollection(),
                $query
            );
            $response = $cursor->toArray();

        } catch (MongoException $e) {
            new Exception('Unable to execute query');
        }

        return $response ?? false;
    }
1044714
private static function determineFilterAndOr(array $filter, QueryBuilder $queryBuilder)
    {
        if (!\in_array($filter['operation'], ['AND', 'OR'])) {
            return null;
        }

        static::filterAndOr($filter, $queryBuilder);

        return '';
    }
171107
public function getBody($key, $def = "", $filter = null)
    {
        $val = $this->body[$key];
        if ($filter) {
            $val = Filter::factory($val, $filter);
        }
        return $val === null ? $def : $val;
    }
305872
public function find($re, $filter = null) {
        $result = null;
        $this->each(function($context) use ($re, $filter, &$result) {
            $r = $context->find($re, $filter);
            if (!$r->isEmpty()) {
                $result = $r;
                return false;
            }
        });

        return $result?:Context::getEmptyContext();
    }
476484
function applyFilter($element, $filter)
    {
        if (!is_callable($filter)) {
            return self::raiseError(null, QUICKFORM_INVALID_FILTER, null, E_USER_WARNING, "Callback function does not exist in QuickForm::applyFilter()", 'HTML_QuickForm_Error', true);
        }
        if ($element == '__ALL__') {
            $this->_submitValues = $this->_recursiveFilter($filter, $this->_submitValues);
        } else {
            if (!is_array($element)) {
                $element = array($element);
            }
            foreach ($element as $elName) {
                $value = $this->getSubmitValue($elName);
                if (null !== $value) {
                    if (false === strpos($elName, '[')) {
                        $this->_submitValues[$elName] = $this->_recursiveFilter($filter, $value);
                    } else {
                        $idx  = "['" . str_replace(array(']', '['), array('', "']['"), $elName) . "']";
                        eval("\$this->_submitValues{$idx} = \$this->_recursiveFilter(\$filter, \$value);");
                    }
                }
            }
        }
    }
879574
public function request($name = '', $default = null, $filter = '')
    {
        if (empty($this->request)) {
            $this->request = $_REQUEST;
        }
        if (is_array($name)) {
            $this->param          = [];
            return $this->request = array_merge($this->request, $name);
        }
        return $this->input($this->request, $name, $default, $filter);
    }
114510
private function parseFactory($filter)
    {
        // Define single tasks filter with a callback.
        $callbacks = [
            "bbcode"    => "bbcode2html",
            "clickable" => "makeClickable",
            "shortcode" => "shortCode",
            "markdown"  => "markdown",
            //"geshi"     => "syntaxHighlightGeSHi",
            "nl2br"     => "nl2br",
            "htmlentities" => "htmlentities",
            "purify"    => "purify",
            'anchor4Header' => 'createAnchor4Header',
        ];

        // Do the specific filter
        $text = $this->current->text;
        switch ($filter) {
            case "jsonfrontmatter":
                $res = $this->jsonFrontMatter($text);
                $this->current->text = $res["text"];
                $this->addToFrontmatter($res["frontmatter"]);
                break;

            case "yamlfrontmatter":
                $res = $this->yamlFrontMatter($text);
                $this->current->text = $res["text"];
                $this->addToFrontmatter($res["frontmatter"]);
                break;

            case "titlefromh1":
                $title = $this->getTitleFromFirstH1($text);
                $this->current->text = $text;
                if (!isset($this->current->frontmatter["title"])) {
                    $this->addToFrontmatter(["title" => $title]);
                }
                break;

            case "titlefromheader":
                $title = $this->getTitleFromFirstHeader($text);
                $this->current->text = $text;
                if (!isset($this->current->frontmatter["title"])) {
                    $this->addToFrontmatter(["title" => $title]);
                }
                break;

            case "bbcode":
            case "clickable":
            case "shortcode":
            case "markdown":
            //case "geshi":
            case "nl2br":
            case "htmlentities":
            case "purify":
            case "anchor4Header":
                $this->current->text = call_user_func_array(
                    [$this, $callbacks[$filter]],
                    [$text]
                );
                break;

            default:
                throw new Exception("The filter '$filter' is not a valid filter     string.");
        }
    }
945453
public function getByKey(string $key, AbstractFilter $filter = null)
    {
        return $this->children->getByKey($key, $filter);
    }
262819
private static function determineFilterInOrNotInList(array $filter, QueryBuilder $queryBuilder)
    {
        if (!\in_array($filter['operation'], ['IN', 'NOT IN'])) {
            return null;
        }

        return static::filterInOrNotInList($filter, $queryBuilder);
    }
339811
public function raw($var, $default = '', $filter = null)
    {
        $data = $this->get($var);
        if (is_null($data['data'])) {
            $data['data'] = $this->returnDefault($default);
        }
        if (is_string($filter)) {
            $filter = explode('|', $filter);
        }
        $filters = array_merge($data['filters'], (array) $filter);
        if (empty($filters)) {
            return $data['data'];
        }

        return $this->template()->filter($filters, $data['data']);
    }