public function getFilterQuery(array $default = array(), $allowed = array())
    {
        $query = $this->query;
        foreach ($query as $key => $value) {

            if (!is_string($value)) {
                continue;
            }

            if ($key === 'sort' && strpos($value, '-') !== false) {
                list($sort, $order) = explode('-', $value, 2);
                $query['sort'] = $sort;
                $query['order'] = $order;
            }

            if ($value === 'any') {
                unset($query[$key]);
            }
        }

        $query += $default;

        if (empty($allowed)) {
            return $query;
        }

        return array_intersect_key($query, array_flip($allowed));
    }
public function getFilterQuery(array $default = array(), $allowed = array())
    {
        $query = $this->query;
        foreach ($query as $key => $value) {

            if (!is_string($value)) {
                continue;
            }

            if ($key === 'sort' && strpos($value, '-') !== false) {
                list($sort, $order) = explode('-', $value, 2);
                $query['sort'] = $sort;
                $query['order'] = $order;
            }

            if ($value === 'any') {
                unset($query[$key]);
            }
        }

        $query += $default;

        if (empty($allowed)) {
            return $query;
        }

        return array_intersect_key($query, array_flip($allowed));
    }
public function getFilterQuery ( array $ default = array ( ) , $ allowed = array ( ) ) { $ query = $ this -> query ; foreach ( $ query as $ key => $ value ) { if ( ! is_string ( $ value ) ) { continue ; } if ( $ key === 'sort' && strpos ( $ value , '-' ) !== false ) { list ( $ sort , $ order ) = explode ( '-' , $ value , 2 ) ; $ query [ 'sort' ] = $ sort ; $ query [ 'order' ] = $ order ; } if ( $ value === 'any' ) { unset ( $ query [ $ key ] ) ; } } $ query += $ default ; if ( empty ( $ allowed ) ) { return $ query ; } return array_intersect_key ( $ query , array_flip ( $ allowed ) ) ; }
Returns an array of prepared GET values used for filtering and sorting
@param array $default
@param array $allowed
@return array
Returns an array of prepared GET values used for filtering and sorting