public static quoteDN ( array $parts ) : string | ||
$parts | array | An array of tuples containing the attribute
name and that attribute's value which make
up the DN. Example:
$parts = array(
array('cn', 'John Smith'),
array('dc', 'example'),
array('dc', 'com')
);
Nested arrays are supported since 2.1.0, to form
multi-valued RDNs. Example:
$parts = array(
array(
array('cn', 'John'),
array('sn', 'Smith'),
array('o', 'Acme Inc.'),
),
array('dc', 'example'),
array('dc', 'com')
);
which will result in
cn=John+sn=Smith+o=Acme Inc.,dc=example,dc=com |
return | string | The properly quoted string DN. |
public static function quoteDN($parts)
{
return implode(',', array_map('self::_quoteRDNs', $parts));
}
/** * Build a RDN based on a set of attributes and what attributes * make a RDN for the current source. * * @param array $attributes The attributes (in driver keys) of the * object being added. * * @return string The RDN for the new object. */ protected function _makeRDN(array $attributes) { if (!is_array($this->_params['dn'])) { return ''; } $pairs = array(); foreach ($this->_params['dn'] as $param) { if (isset($attributes[$param])) { $pairs[] = array($param, $attributes[$param]); } } return Horde_Ldap::quoteDN($pairs); }