Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 5869 to 5899

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 17th November 2024 15:35 Europe/London time based on the source file dated 15th November 2024 18:30 Europe/London time.