public function filter()
    {
        $count  = 0;

        $tags = $this->getParameter('Tags');
        if($tags === null)
            $tags = $this->getLocal('LinkTags');

        $maxRows = $this->getParameter('MaxRows');

        $partial = $this->getParameter('Partial');

        $partials = array();
        if(!empty($partial)) {
            $partialsStr = explode(',',$partial);
            foreach($partialsStr as $partial)
                $partials[] = new TagPartial($partial);
        }

        $return = $this->getParameter('Return');
        if(empty($return))
            $return = 'TagLinkTitle';

        $value = '';

        if (empty($tags)) return;
        foreach ((array)$tags as $tag) {
            if (!empty($partials)) {
                    $found = false;
                    foreach($partials as $partial) {
                        if($this->TagsHelper->matchPartial($partial, $tag))
                        {
                            $found = true;
                            break;
                        }
                    }
                    if(!$found)
                        continue;
            }

            if (($this->getParameter('Status.eq') != null) && $tag['TagLinkStatus'] != $this->getParameter('Status.eq'))
                continue;
            if (($this->getParameter('Status.isActive') != null) && empty($tag['TagLinkURL']))
                continue;

            $count++;

            if ($return != 'count' && ($tag instanceof Tag || is_array($tag))) {
                $value .= $tag[$return] . ', ';
            }

            if(!empty($maxRows) && $count == $maxRows)
                break;

        }
        if ($return == 'count')
            return $count;
        if ($this->getParameter('ReturnString') != null)
            $value = str_replace("%ReturnValue%", $value, $this->getParameter('ReturnString'));

        return substr($value, 0, -2);

    }
public function filter()
    {
        $count  = 0;

        $tags = $this->getParameter('Tags');
        if($tags === null)
            $tags = $this->getLocal('LinkTags');

        $maxRows = $this->getParameter('MaxRows');

        $partial = $this->getParameter('Partial');

        $partials = array();
        if(!empty($partial)) {
            $partialsStr = explode(',',$partial);
            foreach($partialsStr as $partial)
                $partials[] = new TagPartial($partial);
        }

        $return = $this->getParameter('Return');
        if(empty($return))
            $return = 'TagLinkTitle';

        $value = '';

        if (empty($tags)) return;
        foreach ((array)$tags as $tag) {
            if (!empty($partials)) {
                    $found = false;
                    foreach($partials as $partial) {
                        if($this->TagsHelper->matchPartial($partial, $tag))
                        {
                            $found = true;
                            break;
                        }
                    }
                    if(!$found)
                        continue;
            }

            if (($this->getParameter('Status.eq') != null) && $tag['TagLinkStatus'] != $this->getParameter('Status.eq'))
                continue;
            if (($this->getParameter('Status.isActive') != null) && empty($tag['TagLinkURL']))
                continue;

            $count++;

            if ($return != 'count' && ($tag instanceof Tag || is_array($tag))) {
                $value .= $tag[$return] . ', ';
            }

            if(!empty($maxRows) && $count == $maxRows)
                break;

        }
        if ($return == 'count')
            return $count;
        if ($this->getParameter('ReturnString') != null)
            $value = str_replace("%ReturnValue%", $value, $this->getParameter('ReturnString'));

        return substr($value, 0, -2);

    }
public function filter ( ) { $ count = 0 ; $ tags = $ this -> getParameter ( 'Tags' ) ; if ( $ tags === null ) $ tags = $ this -> getLocal ( 'LinkTags' ) ; $ maxRows = $ this -> getParameter ( 'MaxRows' ) ; $ partial = $ this -> getParameter ( 'Partial' ) ; $ partials = array ( ) ; if ( ! empty ( $ partial ) ) { $ partialsStr = explode ( ',' , $ partial ) ; foreach ( $ partialsStr as $ partial ) $ partials [ ] = new TagPartial ( $ partial ) ; } $ return = $ this -> getParameter ( 'Return' ) ; if ( empty ( $ return ) ) $ return = 'TagLinkTitle' ; $ value = '' ; if ( empty ( $ tags ) ) return ; foreach ( ( array ) $ tags as $ tag ) { if ( ! empty ( $ partials ) ) { $ found = false ; foreach ( $ partials as $ partial ) { if ( $ this -> TagsHelper -> matchPartial ( $ partial , $ tag ) ) { $ found = true ; break ; } } if ( ! $ found ) continue ; } if ( ( $ this -> getParameter ( 'Status.eq' ) != null ) && $ tag [ 'TagLinkStatus' ] != $ this -> getParameter ( 'Status.eq' ) ) continue ; if ( ( $ this -> getParameter ( 'Status.isActive' ) != null ) && empty ( $ tag [ 'TagLinkURL' ] ) ) continue ; $ count ++ ; if ( $ return != 'count' && ( $ tag instanceof Tag || is_array ( $ tag ) ) ) { $ value .= $ tag [ $ return ] . ', ' ; } if ( ! empty ( $ maxRows ) && $ count == $ maxRows ) break ; } if ( $ return == 'count' ) return $ count ; if ( $ this -> getParameter ( 'ReturnString' ) != null ) $ value = str_replace ( "%ReturnValue%" , $ value , $ this -> getParameter ( 'ReturnString' ) ) ; return substr ( $ value , 0 , - 2 ) ; }
Returns a subset of tags filtered according to the params passed.

Expected Params:
Tags                array  An Array of tags that we want to filter
Partial             string (optional) A CSV string of types that we want
FilterElement       string (required only with FilterType. Optional otherwise) The tag element to filter for
FilterSlug          string (optional) The slug to filter for
FilterRole          string (optional) The TagRole to match
FilterLinkStatus    string (optional) The TagLinkStatus to match
FilterLinkURLExists string (optional) If set, then a value is required in TagLinkURL
return              string If set to 'count', the function will return a count of the number of tags matched.
Otherwise should be set to Type, Element, Slug, Role, (any other Tag* attribute)
which specifies what will be returned.
ReturnString        string If specified and Param 'return' is not set to 'count', then this string will be returned
with '%ReturnValue%' in the string replaced with the value the value from the tag.

@return string
Returns a subset of tags filtered according to the params passed .