getAttribute() public static method

Gets a LDAP attribute.
public static getAttribute ( array $data, string $attribName, integer $index = null ) : array | mixed
$data array
$attribName string
$index integer
return array | mixed
コード例 #1
0
ファイル: AttributeTest.php プロジェクト: travisj/zf
 public function testPasswordSettingCustomAttribute()
 {
     $data = array();
     Zend_Ldap_Attribute::setPassword($data, 'pa$$w0rd', Zend_Ldap_Attribute::PASSWORD_HASH_SHA, 'myAttribute');
     $password = Zend_Ldap_Attribute::getAttribute($data, 'myAttribute', 0);
     $this->assertNotNull($password);
 }
コード例 #2
0
 /**
  * Gets a LDAP attribute.
  *
  * This is an offline method.
  *
  * @param  string  $name
  * @param  integer $index
  * @return mixed
  * @throws Zend_Ldap_Exception
  */
 public function getAttribute($name, $index = null)
 {
     if ($name == 'dn') {
         return $this->getDnString();
     } else {
         return Zend_Ldap_Attribute::getAttribute($this->_currentData, $name, $index);
     }
 }
コード例 #3
0
ファイル: Ldap.php プロジェクト: RKathees/is-connectors
 /**
  * Returns the value for the given LDAP attribute.
  * 
  * @param array  $entry      LDAP entry
  * @param string $attribName Attribute name.
  * 
  * @return mixed LDAP attribute value
  */
 protected function _getLDAPAttribute($entry, $attribName, $index = 0)
 {
     $attribName = strtolower($attribName);
     if (!isset($entry[$attribName])) {
         return null;
     } else {
         if (is_array($entry[$attribName])) {
             return Zend_Ldap_Attribute::getAttribute($entry, $attribName, $index);
         } else {
             return $entry[$attribName];
         }
     }
 }