當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Ldap_Dn::toArray方法代碼示例

本文整理匯總了PHP中Zend_Ldap_Dn::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Ldap_Dn::toArray方法的具體用法?PHP Zend_Ldap_Dn::toArray怎麽用?PHP Zend_Ldap_Dn::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Ldap_Dn的用法示例。


在下文中一共展示了Zend_Ldap_Dn::toArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: copy

 /**
  * Copies a LDAP entry from one DN to another DN.
  *
  * @param  string|Zend_Ldap_Dn $from
  * @param  string|Zend_Ldap_Dn $to
  * @param  boolean             $recursively
  * @return Zend_Ldap Provides a fluid interface
  * @throws Zend_Ldap_Exception
  */
 public function copy($from, $to, $recursively = false)
 {
     $entry = $this->getEntry($from, array(), true);
     if ($to instanceof Zend_Ldap_Dn) {
         $toDnParts = $to->toArray();
     } else {
         $toDnParts = Zend_Ldap_Dn::explodeDn($to);
     }
     $this->add($to, $entry);
     if ($recursively === true && $this->countChildren($from) > 0) {
         $children = $this->_getChildrenDns($from);
         foreach ($children as $c) {
             $cDnParts = Zend_Ldap_Dn::explodeDn($c);
             $newChildParts = array_merge(array(array_shift($cDnParts)), $toDnParts);
             $newChild = Zend_Ldap_Dn::implodeDn($newChildParts);
             $this->copy($c, $newChild, true);
         }
     }
     return $this;
 }
開發者ID:jpbender,項目名稱:mage_virtual,代碼行數:29,代碼來源:Ldap.php

示例2: isChildOf

 /**
  * Checks if given $childDn is beneath $parentDn subtree.
  *
  * @param  string|Zend_Ldap_Dn $childDn
  * @param  string|Zend_Ldap_Dn $parentDn
  * @return boolean
  */
 public static function isChildOf($childDn, $parentDn)
 {
     try {
         $keys = array();
         $vals = array();
         if ($childDn instanceof Zend_Ldap_Dn) {
             $cdn = $childDn->toArray(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
         } else {
             $cdn = self::explodeDn($childDn, $keys, $vals, Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
         }
         if ($parentDn instanceof Zend_Ldap_Dn) {
             $pdn = $parentDn->toArray(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
         } else {
             $pdn = self::explodeDn($parentDn, $keys, $vals, Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER);
         }
     } catch (Zend_Ldap_Exception $e) {
         return false;
     }
     $startIndex = count($cdn) - count($pdn);
     if ($startIndex < 0) {
         return false;
     }
     for ($i = 0; $i < count($pdn); $i++) {
         if ($cdn[$i + $startIndex] != $pdn[$i]) {
             return false;
         }
     }
     return true;
 }
開發者ID:conectapb,項目名稱:sysagroweb,代碼行數:36,代碼來源:Dn.php


注:本文中的Zend_Ldap_Dn::toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。