Zend Framework  1.12
Static Public Member Functions | Public Attributes | List of all members
Zend_Ldap_Converter Class Reference

Static Public Member Functions

static ascToHex32 ($string)
 Converts all ASCII chars < 32 to "\HEX".
 
static hex32ToAsc ($string)
 Converts all Hex expressions ("\HEX") to their original ASCII characters.
 
static toLdap ($value, $type=self::STANDARD)
 Convert any value to an LDAP-compatible value.
 
static toLdapDateTime ($date, $asUtc=true)
 Converts a date-entity to an LDAP-compatible date-string.
 
static toLdapBoolean ($value)
 Convert a boolean value to an LDAP-compatible string.
 
static toLdapSerialize ($value)
 Serialize any value for storage in LDAP.
 
static fromLdap ($value, $type=self::STANDARD, $dateTimeAsUtc=true)
 Convert an LDAP-compatible value to a corresponding PHP-value.
 
static fromLdapDateTime ($date, $asUtc=true)
 Convert an LDAP-Generalized-Time-entry into a DateTime-Object.
 
static fromLdapBoolean ($value)
 Convert an LDAP-compatible boolean value into a PHP-compatible one.
 
static fromLdapUnserialize ($value)
 Unserialize a serialized value to return the corresponding object.
 

Public Attributes

const STANDARD = 0
 
const BOOLEAN = 1
 
const GENERALIZED_TIME = 2
 

Member Function Documentation

static ascToHex32 (   $string)
static

Converts all ASCII chars < 32 to "\HEX".

See Also
Net_LDAP2_Util::asc2hex32() from Benedikt Hallinger beni@.nosp@m.php..nosp@m.net Benedikt Hallinger beni@.nosp@m.php..nosp@m.net string $string String to convert string
static fromLdap (   $value,
  $type = self::STANDARD,
  $dateTimeAsUtc = true 
)
static

Convert an LDAP-compatible value to a corresponding PHP-value.

By setting the $type-parameter the conversion of a certain type can be forced

Parameters
string$valueThe value to convert
int$ytpeThe conversion type to use
boolean$dateTimeAsUtcReturn DateTime values in UTC timezone
Returns
mixed
Exceptions
Zend_Ldap_Converter_Exception
static fromLdapBoolean (   $value)
static

Convert an LDAP-compatible boolean value into a PHP-compatible one.

Parameters
string$valueThe value to convert
Returns
boolean
Exceptions
InvalidArgumentException
static fromLdapDateTime (   $date,
  $asUtc = true 
)
static

Convert an LDAP-Generalized-Time-entry into a DateTime-Object.

CAVEAT: The DateTime-Object returned will alwasy be set to UTC-Timezone.

Parameters
string$dateThe generalized-Time
boolean$asUtcReturn the DateTime with UTC timezone
Returns
DateTime
Exceptions
InvalidArgumentExceptionif a non-parseable-format is given
static fromLdapUnserialize (   $value)
static

Unserialize a serialized value to return the corresponding object.

Parameters
string$valueThe value to convert
Returns
mixed
Exceptions
UnexpectedValueException
static hex32ToAsc (   $string)
static

Converts all Hex expressions ("\HEX") to their original ASCII characters.

See Also
Net_LDAP2_Util::hex2asc() from Benedikt Hallinger beni@.nosp@m.php..nosp@m.net, heavily based on work from David.nosp@m.Smit.nosp@m.h@byu.nosp@m..net Benedikt Hallinger beni@.nosp@m.php..nosp@m.net, heavily based on work from David.nosp@m.Smit.nosp@m.h@byu.nosp@m..net string $string String to convert string
static toLdap (   $value,
  $type = self::STANDARD 
)
static

Convert any value to an LDAP-compatible value.

By setting the $type-parameter the conversion of a certain type can be forced

Todo:
write more tests
Parameters
mixed$valueThe value to convert
int$ytpeThe conversion type to use
Returns
string
Exceptions
Zend_Ldap_Converter_Exception
static toLdapBoolean (   $value)
static

Convert a boolean value to an LDAP-compatible string.

This converts a boolean value of TRUE, an integer-value of 1 and a case-insensitive string 'true' to an LDAP-compatible 'TRUE'. All other other values are converted to an LDAP-compatible 'FALSE'.

Parameters
boolean | integer | string$valueThe boolean value to encode
Returns
string
static toLdapDateTime (   $date,
  $asUtc = true 
)
static

Converts a date-entity to an LDAP-compatible date-string.

The date-entity $date can be either a timestamp, a DateTime Object, a string that is parseable by strtotime() or a Zend_Date Object.

Parameters
integer | string | DateTimt | Zend_Date$dateThe date-entity
boolean$asUtcWhether to return the LDAP-compatible date-string as UTC or as local value
Returns
string
Exceptions
InvalidArgumentException
static toLdapSerialize (   $value)
static

Serialize any value for storage in LDAP.

Parameters
mixed$valueThe value to serialize
Returns
string

Member Data Documentation

const BOOLEAN = 1
const GENERALIZED_TIME = 2
const STANDARD = 0