$_filters
$_filters : array
Storage for combination of filters.
This variable holds a array of filter objects that should be combined by this filter object.
Object representation of a part of a LDAP filter.
The purpose of this class is to easily build LDAP filters without having to worry about correct escaping etc.
A filter is built using several independent filter objects which are combined afterwards. This object works in two modes, depending how the object is created.
If the object is created using the \create() method, then this is a leaf-object. If the object is created using the \combine() method, then this is a container object.
LDAP filters are defined in RFC 2254.
create(string $attribute, string $match, string $value = '', boolean $escape = true) : \Horde_Ldap_Filter
Creates a new part of an LDAP filter.
The following matching rules exists:
If $escape is set to true then $value will be escaped. If set to false then $value will be treaten as a raw filter value string. You should then escape it yourself using {@link Horde_Ldap_Util::escapeFilterValue()}.
Examples:
// This will find entries that contain an attribute "sn" that ends with
// "foobar":
$filter = Horde_Ldap_Filter::create('sn', 'ends', 'foobar');
// This will find entries that contain an attribute "sn" that has any // value set: $filter = Horde_Ldap_Filter::create('sn', 'any');
string | $attribute | Name of the attribute the filter should apply to. |
string | $match | Matching rule (equals, begins, ends, contains, greater, less, greaterOrEqual, lessOrEqual, approx, any). |
string | $value | If given, then this is used as a filter value. |
boolean | $escape | Should $value be escaped? |
combine(string $operator, array|\Horde_Ldap_Filter|string $filters) : \Horde_Ldap_Filter
Combines two or more filter objects using a logical operator.
Example:
$filter = Horde_Ldap_Filter::combine('or', array($filter1, $filter2));
If the array contains filter strings instead of filter objects, they will be parsed.
string | $operator | The logical operator, either "and", "or", "not" or the logical equivalents "&", "|", "!". |
array|\Horde_Ldap_Filter|string | $filters | Array with Horde_Ldap_Filter objects and/or strings or a single filter when using the "not" operator. |
build(array $params, string $operator = 'and') : \Horde_Ldap_Filter
Builds a filter (commonly for objectClass attributes) from different configuration options.
array | $params | Hash with configuration options that build the search filter. Possible hash keys:
|
string | $operator | How to combine mutliple 'objectclass' entries. 'and' or 'or'. |
A filter matching the specified criteria.
parse(string $filter) : \Horde_Ldap_Filter
Parses a string into a Horde_Ldap_Filter object.
string | $filter | An LDAP filter string. |
__construct(array $params)
Constructor.
Construction of Horde_Ldap_Filter objects should happen through either \create() or \combine() which give you more control. However, you may use the constructor if you already have generated filters.
array | $params | List of object parameters |
_parseCombination(string $filter) : \Horde_Ldap_Filter
Parses combined subfilter strings.
Passes subfilters to parse() and combines the objects using the logical operator detected. Each subfilter could be an arbitary complex subfilter.
string | $filter | An LDAP filter string. |
_parseLeaf(string $filter) : \Horde_Ldap_Filter
Parses a single leaf component.
string | $filter | An LDAP filter string. |