Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

filter_match()

Description

In the given filter string, does name/value match?
Returns:
0 = no match for name
1 = matched name but value was not present
2 = matched name and value was correct

Parameters

ColumnTypeDefaultDescription
$filter string Sring to for which filtering is to be applied
$name string Name to match
$value string Value to match

Return

int

Location

include/resource_functions.php lines 4819 to 4849

Definition

 
function filter_match($filter,$name,$value)
    {
    
$s=explode(";",$filter);
    foreach (
$s as $condition)
        {
        
$s=explode("=",$condition);
        
# Support for "NOT" matching. Return results only where the specified value or values are NOT set.
        
$checkname=$s[0];$filter_not=false;
        if (
substr($checkname,-1)=="!")
            {
            
$filter_not=true;
            
$checkname=substr($checkname,0,-1);# Strip off the exclamation mark.
            
}
        if (
$checkname==$name)
            {
            
$checkvalues=$s[1];
            
            
$s=explode("|",strtoupper($checkvalues));
            
$v=trim_array(explode(",",strtoupper($value)));
            foreach (
$s as $checkvalue)
                {
                if (
in_array($checkvalue,$v))
                    {
                    return 
$filter_not 2;
                    }
                }
            return 
$filter_not 1;
            }
        }
    return 
0;
    }

This article was last updated 12th July 2020 04:05 Europe/London time based on the source file dated 10th July 2020 16:06 Europe/London time.