API Documentation

Ldap/Dn.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Ldap
version
$Id: Dn.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Ldap_Dn

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Ldap_Dn

Implements
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Ldap
Constants
ATTR_CASEFOLD_NONE
ATTR_CASEFOLD_UPPER
ATTR_CASEFOLD_LOWER
Properties
$_defaultCaseFold
$_caseFold
$_dn
Methods
factory
fromString
fromArray
__construct
getRdn
getRdnString
getParentDn
get
set
remove
append
prepend
insert
_assertIndex
_assertRdn
setCaseFold
toString
toArray
_caseFoldRdn
_caseFoldDn
__toString
offsetExists
offsetGet
offsetSet
offsetUnset
setDefaultCaseFold
_sanitizeCaseFold
escapeValue
unescapeValue
explodeDn
checkDn
implodeRdn
implodeDn
isChildOf

Description

Zend_Ldap_Dn provides an API for DN manipulation

Constants

ATTR_CASEFOLD_NONE

 ATTR_CASEFOLD_NONE = 'none'

Details

value
none

ATTR_CASEFOLD_UPPER

 ATTR_CASEFOLD_UPPER = 'upper'

Details

value
upper

ATTR_CASEFOLD_LOWER

 ATTR_CASEFOLD_LOWER = 'lower'

Details

value
lower

Properties

$_caseFold

string $_caseFold = ''

The case fold used for this instance

Details

$_caseFold
string
visibility
protected
default
final
false
static
false

$_defaultCaseFold

string $_defaultCaseFold = 'self'

The default case fold to use

Details

$_defaultCaseFold
string
visibility
protected
default
self
final
false
static
true

$_dn

array $_dn = ''

The DN data

Details

$_dn
array
visibility
protected
default
final
false
static
false

Methods

__construct

__construct( array $dn, string|null $caseFold ) :

Constructor

Arguments
$dn
array
$caseFold
stringnull
Details
visibility
protected
final
false
static
false

__toString

__toString( ) : string

Cast to string representation {@see toString()}

Output
string
Details
visibility
public
final
false
static
false

_assertIndex

_assertIndex( mixed $index ) : boolean

Assert index is correct and usable

Arguments
$index
mixed
Output
boolean
Details
visibility
protected
final
false
static
false
throws

_assertRdn

_assertRdn( array $value ) : boolean

Assert if value is in a correct RDN format

Arguments
$value
array
Output
boolean
Details
visibility
protected
final
false
static
true
throws

_caseFoldDn

_caseFoldDn( array $dn, string $caseFold ) : array

Do a case folding on a DN ort part of it

Arguments
$dn
array
$caseFold
string
Output
array
Details
visibility
protected
final
false
static
true

_caseFoldRdn

_caseFoldRdn( array $part, string $caseFold ) : array

Do a case folding on a RDN

Arguments
$part
array
$caseFold
string
Output
array
Details
visibility
protected
final
false
static
true

_sanitizeCaseFold

_sanitizeCaseFold( string $caseFold,  $default ) : string

Sanitizes the case fold

Arguments
$caseFold
string
$default
Output
string
Details
visibility
protected
final
false
static
true

append

append( array $value ) : Zend_Ldap_Dn

Append a DN part

Arguments
$value
array
Output
Zend_Ldap_Dn
Provides a fluent interface
Details
visibility
public
final
false
static
false

checkDn

checkDn( string $dn, array $keys = null, array $vals = null, string $caseFold = self ) : boolean

Arguments
$dn
string
The DN to parse
$keys
array
An optional array to receive DN keys (e.g. CN, OU, DC, ...)
$vals
array
An optional array to receive DN values
$caseFold
string
Output
boolean
True if the DN was successfully parsed or false if the string is not a valid DN.
Details
visibility
public
final
false
static
true

escapeValue

escapeValue( string|array $values = array ) : array

Escapes a DN value according to RFC 2253

Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs. The characters ",", "+", """, "\", "<", ">", ";", "#", " = " with a special meaning in RFC 2252 are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as \hexpair. Finally all leading and trailing spaces are converted to sequences of \20.

Arguments
$values
stringarray
An array containing the DN values that should be escaped
Output
array
The array $values, but escaped
Details
visibility
public
final
false
static
true
author
Benedikt Hallinger <beni@php.net>
link
http://pear.php.net/package/Net_LDAP2
see
Net_LDAP2_Util::escape_dn_value() from Benedikt Hallinger <beni@php.net>

explodeDn

explodeDn( string $dn, array $keys = null, array $vals = null, string $caseFold = self ) : array

Creates an array containing all parts of the given DN.

Array will be of type array( array("cn" => "name1", "uid" => "user"), array("cn" => "name2"), array("dc" => "example"), array("dc" => "org") ) for a DN of cn=name1+uid=user,cn=name2,dc=example,dc=org.

Arguments
$dn
string
$keys
array
An optional array to receive DN keys (e.g. CN, OU, DC, ...)
$vals
array
An optional array to receive DN values
$caseFold
string
Output
array
Details
visibility
public
final
false
static
true
throws

factory

factory( string|array $dn, string|null $caseFold = null ) : Zend_Ldap_Dn

Creates a DN from an array or a string

Arguments
$dn
stringarray
$caseFold
stringnull
Output
Zend_Ldap_Dn
Details
visibility
public
final
false
static
true
throws

fromArray

fromArray( array $dn, string|null $caseFold = null ) : Zend_Ldap_Dn

Creates a DN from an array

Arguments
$dn
array
$caseFold
stringnull
Output
Zend_Ldap_Dn
Details
visibility
public
final
false
static
true
throws

fromString

fromString( string $dn, string|null $caseFold = null ) : Zend_Ldap_Dn

Creates a DN from a string

Arguments
$dn
string
$caseFold
stringnull
Output
Zend_Ldap_Dn
Details
visibility
public
final
false
static
true
throws

get

get( int $index, int $length = 1, string $caseFold = null ) : array

Get a DN part

Arguments
$index
int
$length
int
$caseFold
string
Output
array
Details
visibility
public
final
false
static
false
throws
if index is illegal

getParentDn

getParentDn( int $levelUp = 1 ) : Zend_Ldap_Dn

Get the parent DN $levelUp levels up the tree

Arguments
$levelUp
int
Output
Zend_Ldap_Dn
Details
visibility
public
final
false
static
false

getRdn

getRdn( string $caseFold = null ) : array

Gets the RDN of the current DN

Arguments
$caseFold
string
Output
array
Details
visibility
public
final
false
static
false
throws
if DN has no RDN (empty array)

getRdnString

getRdnString( string $caseFold = null ) : string

Gets the RDN of the current DN as a string

Arguments
$caseFold
string
Output
string
Details
visibility
public
final
false
static
false
throws
if DN has no RDN (empty array)

implodeDn

implodeDn( array $dnArray, string $caseFold = null, string $separator = , ) : string

Implodes an array in the form delivered by {@link explodeDn()} to a DN string.

$dnArray must be of type array( array("cn" => "name1", "uid" => "user"), array("cn" => "name2"), array("dc" => "example"), array("dc" => "org") )

Arguments
$dnArray
array
$caseFold
string
$separator
string
Output
string
Details
visibility
public
final
false
static
true
throws

implodeRdn

implodeRdn(  $part, string $caseFold = null ) : string

Returns a DN part in the form $attribute = $value

This method supports the creation of multi-valued RDNs $part must contain an even number of elemets.

Arguments
$part
$caseFold
string
Output
string
Details
visibility
public
final
false
static
true
throws

insert

insert( int $index, array $value ) : Zend_Ldap_Dn

Insert a DN part

Arguments
$index
int
$value
array
Output
Zend_Ldap_Dn
Provides a fluent interface
Details
visibility
public
final
false
static
false
throws
if index is illegal

isChildOf

isChildOf( string|Zend_Ldap_Dn $childDn, string|Zend_Ldap_Dn $parentDn ) : boolean

Checks if given $childDn is beneath $parentDn subtree.

Arguments
$childDn
stringZend_Ldap_Dn
$parentDn
stringZend_Ldap_Dn
Output
boolean
Details
visibility
public
final
false
static
true

offsetExists

offsetExists( int $offset ) : boolean

Required by the ArrayAccess implementation

Arguments
$offset
int
Output
boolean
Details
visibility
public
final
false
static
false

offsetGet

offsetGet( int $offset ) : array

Proxy to {@see get()} Required by the ArrayAccess implementation

Arguments
$offset
int
Output
array
Details
visibility
public
final
false
static
false

offsetSet

offsetSet( int $offset, array $value ) :

Proxy to {@see set()} Required by the ArrayAccess implementation

Arguments
$offset
int
$value
array
Details
visibility
public
final
false
static
false

offsetUnset

offsetUnset( int $offset ) :

Proxy to {@see remove()} Required by the ArrayAccess implementation

Arguments
$offset
int
Details
visibility
public
final
false
static
false

prepend

prepend( array $value ) : Zend_Ldap_Dn

Prepend a DN part

Arguments
$value
array
Output
Zend_Ldap_Dn
Provides a fluent interface
Details
visibility
public
final
false
static
false

remove

remove( int $index, int $length = 1 ) : Zend_Ldap_Dn

Remove a DN part

Arguments
$index
int
$length
int
Output
Zend_Ldap_Dn
Provides a fluent interface
Details
visibility
public
final
false
static
false
throws
if index is illegal

set

set( int $index, array $value ) : Zend_Ldap_Dn

Set a DN part

Arguments
$index
int
$value
array
Output
Zend_Ldap_Dn
Provides a fluent interface
Details
visibility
public
final
false
static
false
throws
if index is illegal

setCaseFold

setCaseFold( string|null $caseFold ) :

Sets the case fold

Arguments
$caseFold
stringnull
Details
visibility
public
final
false
static
false

setDefaultCaseFold

setDefaultCaseFold( string $caseFold ) :

Sets the default case fold

Arguments
$caseFold
string
Details
visibility
public
final
false
static
true

toArray

toArray( string $caseFold = null ) : array

Return DN as an array

Arguments
$caseFold
string
Output
array
Details
visibility
public
final
false
static
false

toString

toString( string $caseFold = null ) : string

Return DN as a string

Arguments
$caseFold
string
Output
string
Details
visibility
public
final
false
static
false
throws

unescapeValue

unescapeValue( string|array $values = array ) : array

Undoes the conversion done by {@link escapeValue()}.

Any escape sequence starting with a baskslash - hexpair or special character - will be transformed back to the corresponding character.

Arguments
$values
stringarray
Array of DN Values
Output
array
Same as $values, but unescaped
Details
visibility
public
final
false
static
true
author
Benedikt Hallinger <beni@php.net>
link
http://pear.php.net/package/Net_LDAP2
see
Net_LDAP2_Util::escape_dn_value() from Benedikt Hallinger <beni@php.net>
Documentation was generated by DocBlox.