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


PHP CRM_Utils_Array::multiArrayDiff方法代碼示例

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


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

示例1: getItem

 /**
  * Retrieve the value of a setting from the DB table.
  *
  * @param string $group
  *   (required) The group name of the item.
  * @param string $name
  *   (required) The name under which this item is stored.
  * @param int $componentID
  *   The optional component ID (so componenets can share the same name space).
  * @param string $defaultValue
  *   The default value to return for this setting if not present in DB.
  * @param int $contactID
  *   If set, this is a contactID specific setting, else its a global setting.
  *
  * @param int $domainID
  *
  * @return mixed
  *   The data if present in the setting table, else null
  */
 public static function getItem($group, $name = NULL, $componentID = NULL, $defaultValue = NULL, $contactID = NULL, $domainID = NULL)
 {
     $overrideGroup = array();
     if (NULL !== ($override = self::getOverride($group, $name, NULL))) {
         if (isset($name)) {
             return $override;
         } else {
             $overrideGroup = $override;
         }
     }
     if (empty($domainID)) {
         $domainID = CRM_Core_Config::domainID();
     }
     $cacheKey = self::inCache($group, $name, $componentID, $contactID, TRUE, $domainID);
     if ($group && !isset($name) && $cacheKey) {
         // check value against the cache, and unset key if values are different
         $valueDifference = CRM_Utils_Array::multiArrayDiff($overrideGroup, self::$_cache[$cacheKey]);
         if (!empty($valueDifference)) {
             $cacheKey = '';
         }
     }
     if (!$cacheKey) {
         $dao = self::dao($group, NULL, $componentID, $contactID, $domainID);
         $dao->find();
         $values = array();
         while ($dao->fetch()) {
             if (NULL !== ($override = self::getOverride($group, $dao->name, NULL))) {
                 $values[$dao->name] = $override;
             } elseif ($dao->value) {
                 $values[$dao->name] = unserialize($dao->value);
             } else {
                 $values[$dao->name] = NULL;
             }
         }
         $dao->free();
         if (!isset($name)) {
             // merge db and override group values
             // When no $name is present, the getItem() function should return an array
             // consisting of the sum of all override settings + all settings present in
             // the database for the given $group (with the overrides taking precedence,
             // and applying even if the setting is not defined in the database).
             //
             $values = array_merge($values, $overrideGroup);
         }
         $cacheKey = self::setCache($values, $group, $componentID, $contactID, $domainID);
     }
     return $name ? CRM_Utils_Array::value($name, self::$_cache[$cacheKey], $defaultValue) : self::$_cache[$cacheKey];
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:67,代碼來源:Setting.php


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