本文整理汇总了PHP中Zend_Ldap_Dn::implodeRdn方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Ldap_Dn::implodeRdn方法的具体用法?PHP Zend_Ldap_Dn::implodeRdn怎么用?PHP Zend_Ldap_Dn::implodeRdn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Ldap_Dn
的用法示例。
在下文中一共展示了Zend_Ldap_Dn::implodeRdn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSimpleRecursiveIteration
public function testSimpleRecursiveIteration()
{
$node = $this->_getLdap()->getBaseNode();
$ri = new RecursiveIteratorIterator($node, RecursiveIteratorIterator::SELF_FIRST);
$i = 0;
foreach ($ri as $rdn => $n) {
$dn = $n->getDn()->toString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
$rdn = Zend_Ldap_Dn::implodeRdn($n->getRdnArray(), Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
if ($i == 0) {
$this->assertEquals(Zend_Ldap_Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE)->toString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER), $dn);
} else {
if ($i == 1) {
$this->assertEquals('ou=Node', $rdn);
$this->assertEquals($this->_createDn('ou=Node,'), $dn);
} else {
if ($i < 4) {
$j = $i - 1;
$base = $this->_createDn('ou=Node,');
} else {
$j = $i - 3;
$base = Zend_Ldap_Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE)->toString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
}
$this->assertEquals('ou=Test' . $j, $rdn);
$this->assertEquals('ou=Test' . $j . ',' . $base, $dn);
}
}
$i++;
}
$this->assertEquals(9, $i);
}
示例2: rename
/**
* Renames a LDAP entry from one DN to another DN.
*
* This method implicitely moves the entry to another location within the tree.
*
* @param string|Zend_Ldap_Dn $from
* @param string|Zend_Ldap_Dn $to
* @param boolean $recursively
* @param boolean $alwaysEmulate
* @return Zend_Ldap Provides a fluid interface
* @throws Zend_Ldap_Exception
*/
public function rename($from, $to, $recursively = false, $alwaysEmulate = false)
{
$emulate = (bool) $alwaysEmulate;
if (!function_exists('ldap_rename')) {
$emulate = true;
} else {
if ($recursively) {
$emulate = true;
}
}
if ($emulate === false) {
if ($from instanceof Zend_Ldap_Dn) {
$from = $from->toString();
}
if ($to instanceof Zend_Ldap_Dn) {
$newDnParts = $to->toArray();
} else {
$newDnParts = Zend_Ldap_Dn::explodeDn($to);
}
$newRdn = Zend_Ldap_Dn::implodeRdn(array_shift($newDnParts));
$newParent = Zend_Ldap_Dn::implodeDn($newDnParts);
$isOK = @ldap_rename($this->getResource(), $from, $newRdn, $newParent, true);
if ($isOK === false) {
/**
* @see Zend_Ldap_Exception
*/
#require_once 'Zend/Ldap/Exception.php';
throw new Zend_Ldap_Exception($this, 'renaming ' . $from . ' to ' . $to);
} else {
if (!$this->exists($to)) {
$emulate = true;
}
}
}
if ($emulate) {
$this->copy($from, $to, $recursively);
$this->delete($from, $recursively);
}
return $this;
}
示例3: testImplodeRdnInvalidThree
/**
* @expectedException Zend_Ldap_Exception
*/
public function testImplodeRdnInvalidThree()
{
$a = array('cn' => 'value', 'ou');
Zend_Ldap_Dn::implodeRdn($a);
}