当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Ldap_Dn::implodeRdn方法代码示例

本文整理汇总了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);
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:30,代码来源:ChildrenIterationTest.php

示例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;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:52,代码来源:Ldap.php

示例3: testImplodeRdnInvalidThree

 /**
  * @expectedException Zend_Ldap_Exception
  */
 public function testImplodeRdnInvalidThree()
 {
     $a = array('cn' => 'value', 'ou');
     Zend_Ldap_Dn::implodeRdn($a);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:8,代码来源:ImplodingTest.php


注:本文中的Zend_Ldap_Dn::implodeRdn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。