PHP 클래스 Horde_Ldap_Search, horde

Copyright 2009 Jan Wagner, Benedikt Hallinger Copyright 2010-2016 Horde LLC (http://www.horde.org/)
저자: Tarjej Huse ([email protected])
저자: Benedikt Hallinger ([email protected])
저자: Jan Schneider ([email protected])
상속: implements Iterator
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_entry resource Result entry identifier.
$_entry_cache array This currently is only used by {@link pop_entry()}.
$_errorCode integer Some errorcodes might be of interest that should not be considered errors, for example: - 4: LDAP_SIZELIMIT_EXCEEDED - indicates a huge search. Incomplete results are returned. If you just want to check if there is anything returned by the search at all, this could be catched. - 32: no such object - search here returns a count of 0.
$_iteratorCache array Cache for all entries already fetched from iterator interface.
$_ldap Horde_Ldap A reference of the Horde_Ldap object for passing to Horde_Ldap_Entry.
$_link resource LDAP resource link.
$_search resource Search result identifier.
$_searchedAttrs array This variable gets set from the constructor and can be retrieved through {@link searchedAttributes()}.

공개 메소드들

메소드 설명
__construct ( resource $search, Horde_Ldap | resource $ldap, array $attributes = [] ) Constructor.
__destruct ( ) Destructor.
asArray ( ) : array Returns entries as array.
count ( ) : integer Returns the number of entries in the search result.
current ( ) : Horde_Ldap_Entry | false SPL Iterator interface: Returns the current element.
entries ( ) : array Returns all entries from the search result.
getErrorCode ( ) : integer Returns the errorcode from the search.
key ( ) : string | false SPL Iterator interface: Returns the identifying key (DN) of the current entry.
next ( ) SPL Iterator interface: Moves forward to next entry.
popEntry ( ) : Horde_Ldap_Entry | false Retrieve the next entry in the search result, but starting from last entry.
rewind ( ) SPL Iterator interface: Rewinds the Iterator to the first element.
setLink ( resource $link ) Sets the LDAP resource link.
setSearch ( resource $search ) Sets the search objects resource link
shiftEntry ( ) : Horde_Ldap_Entry | false Get the next entry from the search result.
sizeLimitExceeded ( ) : boolean Returns wheter this search exceeded a sizelimit.
sorted ( array $attrs = ['cn'], integer $order = SORT_ASC ) : array Returns entries sorted as objects.
sortedAsArray ( array $attrs = ['cn'], integer $order = SORT_ASC ) : array Return entries sorted as array.
valid ( ) : boolean SPL Iterator interface: Checks if there is a current element after calls to {@link rewind()} or {@link next()}.

보호된 메소드들

메소드 설명
searchedAttributes ( ) : array Returns the attribute names this search selected.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( resource $search, Horde_Ldap | resource $ldap, array $attributes = [] )
$search resource Search result identifier.
$ldap Horde_Ldap | resource Horde_Ldap object or a LDAP link resource
$attributes array The searched attribute names, see {@link $_searchedAttrs}.

__destruct() 공개 메소드

Destructor.
public __destruct ( )

asArray() 공개 메소드

The first array level contains all found entries where the keys are the DNs of the entries. The second level arrays contian the entries attributes such that the keys is the lowercased name of the attribute and the values are stored in another indexed array. Note that the attribute values are stored in an array even if there is no or just one value. The array has the following structure: array( 'cn=foo,dc=example,dc=com' => array( 'sn' => array('foo'), 'multival' => array('val1', 'val2', 'valN')), 'cn=bar,dc=example,dc=com' => array( 'sn' => array('bar'), 'multival' => array('val1', 'valN')))
public asArray ( ) : array
리턴 array Associative result array as described above.

count() 공개 메소드

Returns the number of entries in the search result.
public count ( ) : integer
리턴 integer Number of found entries.

current() 공개 메소드

The SPL Iterator interface allows you to fetch entries inside a foreach() loop: foreach ($search as $dn => $entry) { ... Of course, you may call {@link current()}, {@link key()}, {@link next()}, {@link rewind()} and {@link valid()} yourself. If the search throwed an error, it returns false. False is also returned, if the end is reached. In case no call to next() was made, we will issue one, thus returning the first entry.
public current ( ) : Horde_Ldap_Entry | false
리턴 Horde_Ldap_Entry | false

entries() 공개 메소드

Returns all entries from the search result.
public entries ( ) : array
리턴 array All entries.

getErrorCode() 공개 메소드

Returns the errorcode from the search.
public getErrorCode ( ) : integer
리턴 integer The LDAP error number.

key() 공개 메소드

SPL Iterator interface: Returns the identifying key (DN) of the current entry.
또한 보기: current()
public key ( ) : string | false
리턴 string | false DN of the current entry; false in case no entry is returned by current().

next() 공개 메소드

After a call to {@link next()}, {@link current()} will return the next entry in the result set.
또한 보기: current()
public next ( )

popEntry() 공개 메소드

This is the opposite to {@link shiftEntry()} and is also very useful to be used inside a while loop.
public popEntry ( ) : Horde_Ldap_Entry | false
리턴 Horde_Ldap_Entry | false

rewind() 공개 메소드

After rewinding, {@link current()} will return the first entry in the result set.
또한 보기: current()
public rewind ( )

searchedAttributes() 보호된 메소드

Returns the attribute names this search selected.
protected searchedAttributes ( ) : array
리턴 array

setSearch() 공개 메소드

Sets the search objects resource link
public setSearch ( resource $search )
$search resource Search result identifier.

shiftEntry() 공개 메소드

This will return a valid Horde_Ldap_Entry object or false, so you can use this method to easily iterate over the entries inside a while loop.
public shiftEntry ( ) : Horde_Ldap_Entry | false
리턴 Horde_Ldap_Entry | false Reference to Horde_Ldap_Entry object or false if no more entries exist.

sizeLimitExceeded() 공개 메소드

Returns wheter this search exceeded a sizelimit.
public sizeLimitExceeded ( ) : boolean
리턴 boolean True if the size limit was exceeded.

sorted() 공개 메소드

This returns a array with sorted Horde_Ldap_Entry objects. The sorting is actually done with {@link sortedAsArray()}. Please note that attribute names are case sensitive! Also note that it is (depending on server capabilities) possible to let the server sort your results. This happens through search controls and is described in detail at {@link http://www.ietf.org/rfc/rfc2891.txt} Usage example: To sort entries first by location, then by surname, but descending: $entries = $search->sorted(array('locality', 'sn'), SORT_DESC);
public sorted ( array $attrs = ['cn'], integer $order = SORT_ASC ) : array
$attrs array Attribute names as sort criteria.
$order integer Ordering direction, either constant SORT_ASC or SORT_DESC
리턴 array Sorted entries.

sortedAsArray() 공개 메소드

This returns a array with sorted entries and the values. Sorting is done with PHPs {@link array_multisort()}. This method relies on {@link asArray()} to fetch the raw data of the entries. Please note that attribute names are case sensitive! Usage example: To sort entries first by location, then by surname, but descending: $entries = $search->sortedAsArray(array('locality', 'sn'), SORT_DESC);
public sortedAsArray ( array $attrs = ['cn'], integer $order = SORT_ASC ) : array
$attrs array Attribute names as sort criteria.
$order integer Ordering direction, either constant SORT_ASC or SORT_DESC
리턴 array Sorted entries.

valid() 공개 메소드

Used to check if we've iterated to the end of the collection.
또한 보기: current()
public valid ( ) : boolean
리턴 boolean False if there's nothing more to iterate over.

프로퍼티 상세

$_entry 보호되어 있는 프로퍼티

Result entry identifier.
protected resource $_entry
리턴 resource

$_entry_cache 보호되어 있는 프로퍼티

This currently is only used by {@link pop_entry()}.
protected array $_entry_cache
리턴 array

$_errorCode 보호되어 있는 프로퍼티

Some errorcodes might be of interest that should not be considered errors, for example: - 4: LDAP_SIZELIMIT_EXCEEDED - indicates a huge search. Incomplete results are returned. If you just want to check if there is anything returned by the search at all, this could be catched. - 32: no such object - search here returns a count of 0.
protected int $_errorCode
리턴 integer

$_iteratorCache 보호되어 있는 프로퍼티

Cache for all entries already fetched from iterator interface.
protected array $_iteratorCache
리턴 array

$_ldap 보호되어 있는 프로퍼티

A reference of the Horde_Ldap object for passing to Horde_Ldap_Entry.
protected Horde_Ldap $_ldap
리턴 Horde_Ldap

$_searchedAttrs 보호되어 있는 프로퍼티

This variable gets set from the constructor and can be retrieved through {@link searchedAttributes()}.
protected array $_searchedAttrs
리턴 array