Filters a post magic tag

@since 0.0.1

@return    string 	converted tag value
167693
public function filter_post( $in_params ){

		// check if there is a third
		$params = explode( ':', $in_params );

		if( isset( $params[1] ) ){
			// a third e.g {post:24:post_title} indicates post ID 24 value post_title
			$post = get_post( $params[0] );
			$field = $params[1];

		}else{
			// stic to current post
			global $post;
			$field = $params[0];

		}

		// try object
		return $this->get_post_value( $field, $in_params, $post );

	}
809461
public function getFilter()
    {
        if (false === $this->filter) {
            return '';
        }
        if (is_array($this->filter)) {
            return Form::get()->select($this->dataProvider->filtersKey . '[' . $this->name . ']', $this->filter, null, array(), '');
        }
        
        if (is_string($this->filter) && (strlen($this->filter) > 10)){
            return $this->filter;
        }
        
        return Form::get()->input($this->dataProvider->filtersKey . '[' . $this->name . ']');
    }
1167056
private function input_filter($args) {
		static $magic_quotes_gpc = NULL;
		
		if ($magic_quotes_gpc === NULL)
			$magic_quotes_gpc = (version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc());
		
		if (is_array($args)) {
			return array_map(array(& $this, 'input_filter'), $args);
		}
		$res = str_replace("\0", '', $args);
		$magic_quotes_gpc && ($res = stripslashes($res));
		return $res;
	}
889676
protected function filter()
    {
        $filter = null;

        if (   (!$filter = $this->is("classFilter"))
            && (!$filter = $this->is("idFilter"))
            && (!$filter = $this->is("attrFilter"))
            && (!$filter = $this->is("pseudoFilter"))
        ) {
            return false;
        }
        return $filter;
    }
4632
protected function getInputTag()
    {
        // We do not use a 'button' element because it is broken differently in
        // different versions of Internet Explorer

        $tag = new SwatHtmlTag('input');

        $tag->type = 'submit';
        $tag->name = $this->id;
        $tag->id = $this->id;
        $tag->value = $this->title;
        $tag->class = $this->getCSSClassString();
        $tag->tabindex = $this->tab_index;
        $tag->accesskey = $this->access_key;

        if (!$this->isSensitive()) {
            $tag->disabled = 'disabled';
        }

        return $tag;
    }
663047
public function getTagFiltersExpanded()
    {
        $tagFilters = $this->getTagFilters();
        if ($tagFilters === null) {
            $result = null;
        } else {
            $result = [];
            $m = null;
            foreach ($tagFilters as $tagFilter) {
                if (preg_match('/^\s*([<>=]+)\s*(\d+(?:\.\d+)?)\s*$/', $tagFilter, $m)) {
                    switch ($m[1]) {
                        case '<=':
                        case '<':
                        case '=':
                        case '>=':
                        case '>':
                            $result[] = ['operator' => $m[1], 'version' => $m[2]];
                            break;
                    }
                }
            }
        }

        return $result;
    }
973222
public function filterPosters()
    {
        return $this->filter(
            function ($key, $value) {
                if ($value instanceof ImageFilter && $value instanceof Image\PosterImage) {
                    return true;
                }
            }
        );
    }
828
public function getFilterString()
    {
        $filter_querystring = '';

        if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) {
            foreach ($_REQUEST['prepopulate'] as $field_id => $value) {
                $handle = FieldManager::fetchHandleFromID($field_id);
                // Properly decode and re-encode value for output
                $value = rawurlencode(rawurldecode($value));
                $filter_querystring .= sprintf('filter[%s]=%s&', $handle, $value);
            }
            $filter_querystring = trim($filter_querystring, '&');
        }

        // This is to prevent the value being interpreted as an additional GET
        // parameter. eg. filter[cat]=Minx&June, would come through as:
        // $_GET['cat'] = Minx
        // $_GET['June'] = ''
        $filter_querystring = preg_replace("/&amp;$/", '', $filter_querystring);

        return $filter_querystring ? '?' . $filter_querystring : null;
    }
1199150
private function cleanPost()
    {
        $this->post = $_POST;
        // Sanitize global data
        if (is_array($_POST)) {
            foreach ($_POST as $key => $value) {
                $_POST[$this->cleanKeys($key)] = $this->sanitize($value);
            }
        } else {
            $_POST = [];
        }

        return $_POST;
    }
1200286
protected function _filterParams()
    {
        $params = Hash::filter((array)$this->request->getData());

        foreach ((array)$this->getConfig('queryStringBlacklist') as $field) {
            unset($params[$field]);
        }

        foreach ((array)$this->getConfig('emptyValues') as $field => $value) {
            if (!isset($params[$field])) {
                continue;
            }

            if ($params[$field] === (string)$value) {
                unset($params[$field]);
            }
        }

        foreach ((array)$this->getConfig('queryStringWhitelist') as $field) {
            $value = $this->request->getQuery($field);
            if ($value !== null && !isset($params[$field])) {
                $params[$field] = $value;
            }
        }

        return $params;
    }
641355
public function postFormatMeta()
    {
        $output = [];

        $format = get_post_format();
        if (current_theme_supports('post-formats', $format)) {
            $output[] = '<div class="meta-format">';
            $output[] = sprintf(
                '<span class="entry-format">%s<a href="%s">%s</a></span>',
                sprintf('<span class="sr-only">%s</span>', _x('Format', 'Used before post format', 'novusopress')),
                esc_url(get_post_format_link($format)),
                get_post_format_string($format)
            );
            $output[] = '</div>';
        }

        return apply_filters('novusopress_view_post_format_meta_output', implode('', $output));
    }
372187
public function tagged()
    {
        $out = '';

        // call stream filters.
        foreach ($this->streamFilters as $f) {
            $this->tokens = call_user_func($f[1], $this->tokens);
        }
        foreach ($this->tokens as $t) {
            $type = $t[0];

            // speed is roughly 10% faster if we process the filters inside this
            // loop instead of separately.
            if (isset($this->filters[$type])) {
                foreach ($this->filters[$type] as $filter) {
                    $t = call_user_func($filter[1], $t);
                }
            }
            list($type, $string, $esc) = $t;

            if (!$esc) {
                $string = Utils::escapeString($string);
            }
            if ($type !== null) {
                $out .= Utils::tagBlock($type, $string);
            } else {
                $out .= $string;
            }
        }
        return $out;
    }
159368
public function filter(string $string): string
    {
        $result = '';

        $string = $this->filterEntities($string);
        $string = $this->filterMetaTags($string);

        // Current/last tag name
        $tagName = null;
        // Current/last attribute name
        $attrName = null;
        // Current context
        $context = self::CTX_TAG_CONTENT;
        // Expected context
        $expecting = null;

        // By default tag content treated as text.
        $ignoreTagContent = false;
        // By default attribute values NOT treated as text.
        $ignoreAttrValue = true;

        $length = mb_strlen($string);
        for ($i = 0; $i < $length; $i++) {
            $char = mb_substr($string, $i, 1);
            switch (true) {
                case '<' === $char:
                    $context = self::CTX_TAG_NAME;
                    $tagName = null;
                    $char = ' ';
                    break;

                case '>' === $char:
                    if ($this->isIgnoredTag($tagName)) {
                        $ignoreTagContent = true;
                    } elseif ('/' === $tagName[0]) {
                        $ignoreTagContent = false; // Restore to default state.
                    }
                    $context = self::CTX_TAG_CONTENT;
                    $expecting = null;
                    $char = ' ';
                    break;

                case ' ' === $char:
                case "\n" === $char:
                case "\t" === $char:
                    switch ($context) {
                        case self::CTX_TAG_NAME:
                            $context = self::CTX_TAG_ATTRS;
                            break;

                        case self::CTX_ATTR_NAME:
                            $context = self::CTX_TAG_ATTRS;
                            break;
                    }
                    break;

                case '=' === $char
                    && (self::CTX_ATTR_NAME === $context || self::CTX_TAG_ATTRS === $context):
                    $expecting = self::CTX_ATTR_VALUE;
                    $char = ' ';
                    break;

                case '"' === $char:
                case "'" === $char:
                    switch (true) {
                        case self::CTX_ATTR_VALUE === $expecting:
                            $context = self::CTX_ATTR_VALUE;
                            $ignoreAttrValue
                                = !in_array(strtolower($attrName), self::$textAttrs, true);
                            $expecting = null;
                            $char = ' ';
                            break;

                        case self::CTX_ATTR_VALUE === $context:
                            $context = self::CTX_TAG_ATTRS;
                            $char = ' ';
                            break;
                    }
                    break;

                default:
                    switch ($context) {
                        case self::CTX_TAG_NAME:
                            $tagName .= $char;
                            $char = ' ';
                            break;

                        /** @noinspection PhpMissingBreakStatementInspection */
                        case self::CTX_TAG_ATTRS:
                            $context = self::CTX_ATTR_NAME;
                            $attrName = null;
                        // no break needed
                        case self::CTX_ATTR_NAME:
                            $attrName .= $char;
                            $char = ' ';
                            break;

                        case self::CTX_ATTR_VALUE:
                            if ($ignoreAttrValue) {
                                $char = ' ';
                            }
                            break;

                        case self::CTX_TAG_CONTENT:
                            if ($ignoreTagContent) {
                                $char = ' ';
                            }
                            break;
                    }
            }
            $result .= $char;
        }

        return $result;
    }
413066
public function paramTags()
    {
        if (isset($this->_tags['@param'])) {
            if (is_array($this->_tags['@param'])) {
                return $this->_tags['@param'];
            } else {
                return array($this->_tags['@param']);
            }
        } else {
            return NULL;
        }
    }
220630
public function getAllowedPublicTags()
    {
        $return_list = ['*' => 'All'];
        $hail_list = $this->List();
        $tags = $hail_list->getPublicTagsList();
        //Only include allowed Public Tags
        if (!empty($hail_list->IncludedPublicTagsIDs) && $hail_list->IncludedPublicTagsIDs !== "null") {
            $allowed_tags = json_decode($hail_list->IncludedPublicTagsIDs);
            foreach ($tags as $hail_id => $tag_name) {
                if (in_array($hail_id, $allowed_tags)) {
                    $return_list[$hail_id] = $tag_name;
                }
            }
        } else {
            $return_list = array_merge($return_list, $tags);
        }

        //Remove excluded public tags from list
        if (!empty($hail_list->ExcludedPublicTagsIDs) && $hail_list->ExcludedPublicTagsIDs !== "null") {
            $excluded_tags = json_decode($hail_list->ExcludedPublicTagsIDs);
            foreach ($return_list as $hail_id => $tag_name) {
                if (in_array($hail_id, $excluded_tags)) {
                    unset($return_list[$hail_id]);
                }
            }
        }

        return $return_list;
    }
1058131
public function filter($filter)
    {
        preg_match_all("/(#\w+)/", $filter, $entityNames);
        preg_match_all("/(:\w+)/", $filter, $positions);

        $entityName = is_array($entityNames[0]) && isset($entityNames[0][0]) ? ltrim($entityNames[0][0], '#') : null;
        $position   = is_array($positions[0]) && isset($positions[0][0]) ? $positions[0][0] : null;

        $i = 0;

        $filtered = [];

        foreach ($this->entities as $name => $entity) {
            if ($i === 0 && ($entityName === $name || $entityName === null) && ($position === ':first' || $position === ':highest' || $position === null)) {
                $filtered[] = $entity;
            }

            if ($position === ':any' && ($entityName === $name || $entityName === null)) {
                $filtered[] = $entity;
            }

            if ($i + 1 === $this->entities->count() && ($entityName === $name || $entityName === null) && ($position === ':last' || $position === ':lowest')) {
                $filtered[] = $entity;
            }

            $i++;
        }

        $this->filtered = $filtered;

        return $this;
    }
45810
public function getPostsByTag($tag)
    {
        if (false === array_key_exists($tag, $this->tagsIndex)) {
            return [];
        }

        $postNames = $this->tagsIndex[$tag];

        return $this->getPostsByName($postNames);
    }