Horde_Ldap::quoteDN PHP Метод

quoteDN() публичный статический Метод

Takes an array of DN elements and properly quotes it according to RFC 1485.
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
Результат string The properly quoted string DN.
    public static function quoteDN($parts)
    {
        return implode(',', array_map('self::_quoteRDNs', $parts));
    }

Usage Example

Пример #1
0
 /**
  * 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);
 }
All Usage Examples Of Horde_Ldap::quoteDN