You are here

public static function SimpleLdap::ldap_explode_dn in Simple LDAP 7

Same name and namespace in other branches
  1. 7.2 SimpleLdap.class.php \SimpleLdap::ldap_explode_dn()

Wrapper function for ldap_explode_dn().

@throw SimpleLdapException

Parameters

string $dn: The distinguished name of an LDAP entity.

int $with_attrib: Used to request if the RDNs are returned with only values or their attributes as well. To get RDNs with the attributes (i.e. in attribute=value format) set with_attrib to 0 and to get only values set it to 1.

Return value

array Returns an array of all DN components. The first element in this array has count key and represents the number of returned values, next elements are numerically indexed DN components.

4 calls to SimpleLdap::ldap_explode_dn()
SimpleLdapRole::__set in simple_ldap_role/SimpleLdapRole.class.php
Magic __set() function.
SimpleLdapServer::move in ./SimpleLdapServer.class.php
Move an entry to a new DN.
SimpleLdapUser::__set in simple_ldap_user/SimpleLdapUser.class.php
Magic __set() function.
simple_ldap_user_sync_user_to_ldap in simple_ldap_user/simple_ldap_user.module
Synchronizes Drupal user properties to LDAP.

File

./SimpleLdap.class.php, line 1351
Class defining base Simple LDAP functionallity.

Class

SimpleLdap
Simple LDAP class.

Code

public static function ldap_explode_dn($dn, $with_attrib = 0) {

  // Devel debugging.
  if (variable_get('simple_ldap_devel', FALSE)) {
    dpm(__FUNCTION__);
    dpm(array(
      '$dn' => $dn,
      '$with_attrib' => $with_attrib,
    ));
  }

  // Wrapped function call.
  $return = @ldap_explode_dn($dn, $with_attrib);

  // Debugging.
  if (variable_get('simple_ldap_debug', FALSE)) {
    $message = __FUNCTION__ . '($dn = @dn, $with_attrib = @with_attrib) returns @return';
    $variables = array(
      '@dn' => print_r($dn, TRUE),
      '@with_attrib' => print_r($with_attrib, TRUE),
      '@return' => print_r($return, TRUE),
    );
    watchdog('simple_ldap', $message, $variables, WATCHDOG_DEBUG);
  }

  // Error handling.
  if ($return === FALSE) {
    throw new SimpleLdapException('Invalid parameters were passed to ldap_explode_dn');
  }
  return $return;
}