本文整理汇总了PHP中Zend_Ldap_Dn::unescapeValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Ldap_Dn::unescapeValue方法的具体用法?PHP Zend_Ldap_Dn::unescapeValue怎么用?PHP Zend_Ldap_Dn::unescapeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Ldap_Dn
的用法示例。
在下文中一共展示了Zend_Ldap_Dn::unescapeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update LDAP registry
*
* @param string|Zend_Ldap_Dn $dn
* @param array $entry
* @return Zend_Ldap Provides a fluid interface
* @throws Zend_Ldap_Exception
*/
public function update($dn, array $entry)
{
if (!$dn instanceof Zend_Ldap_Dn) {
$dn = Zend_Ldap_Dn::factory($dn, null);
}
self::prepareLdapEntryArray($entry);
$rdnParts = $dn->getRdn(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
foreach ($rdnParts as $key => $value) {
$value = Zend_Ldap_Dn::unescapeValue($value);
if (array_key_exists($key, $entry) && !in_array($value, $entry[$key])) {
$entry[$key] = array_merge(array($value), $entry[$key]);
}
}
$adAttributes = array('distinguishedname', 'instancetype', 'name', 'objectcategory', 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated');
foreach ($adAttributes as $attr) {
if (array_key_exists($attr, $entry)) {
unset($entry[$attr]);
}
}
if (count($entry) > 0) {
$isModified = @ldap_modify($this->getResource(), $dn->toString(), $entry);
if ($isModified === false) {
/**
* @see Zend_Ldap_Exception
*/
#require_once 'Zend/Ldap/Exception.php';
throw new Zend_Ldap_Exception($this, 'updating: ' . $dn->toString());
}
}
return $this;
}
示例2: testUnescapeValues
public function testUnescapeValues()
{
$dnval = '\\20\\20\\16\\20t\\,e\\+s \\"t\\,\\\\v\\<a\\>l\\;u\\#e\\=!\\20\\20\\20\\20';
$expected = ' ' . chr(22) . ' t,e+s "t,\\v<a>l;u#e=! ';
$this->assertEquals($expected, Zend_Ldap_Dn::unescapeValue($dnval));
$this->assertEquals($expected, Zend_Ldap_Dn::unescapeValue(array($dnval)));
$this->assertEquals(array($expected, $expected, $expected), Zend_Ldap_Dn::unescapeValue(array($dnval, $dnval, $dnval)));
}