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 5873 to 5903

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 4th December 2024 08:35 Europe/London time based on the source file dated 28th November 2024 12:10 Europe/London time.