• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sugarArrayMergeRecursive函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中sugarArrayMergeRecursive函数的典型用法代码示例。如果您正苦于以下问题:PHP sugarArrayMergeRecursive函数的具体用法?PHP sugarArrayMergeRecursive怎么用?PHP sugarArrayMergeRecursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sugarArrayMergeRecursive函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testSugarArrayMergeMergesTwoArraysWithLikeKeysOverwritingExistingKeys

 public function testSugarArrayMergeMergesTwoArraysWithLikeKeysOverwritingExistingKeys()
 {
     $foo = array('one' => 123, 'two' => 123, 'foo' => array('int' => 123, 'foo' => 'bar'));
     $bar = array('one' => 123, 'two' => 321, 'foo' => array('int' => 123, 'bar' => 'foo'));
     $expected = array('one' => 123, 'two' => 321, 'foo' => array('int' => 123, 'foo' => 'bar', 'bar' => 'foo'));
     $this->assertEquals(sugarArrayMergeRecursive($foo, $bar), $expected);
     // insure that internal functions can't duplicate behavior
     $this->assertNotEquals(array_merge($foo, $bar), $expected);
     $this->assertNotEquals(array_merge_recursive($foo, $bar), $expected);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:10,代码来源:SugarArrayMergeRecursiveTest.php


示例2: handleOverride

 function handleOverride($fromParseLoggerSettings = false)
 {
     global $sugar_config, $sugar_version;
     $sc = SugarConfig::getInstance();
     $overrideArray = $this->readOverride();
     $this->previous_sugar_override_config_array = $overrideArray;
     $diffArray = deepArrayDiff($this->config, $sugar_config);
     $overrideArray = sugarArrayMergeRecursive($overrideArray, $diffArray);
     // To remember checkbox state
     if (!$this->useAuthenticationClass && !$fromParseLoggerSettings) {
         if (isset($overrideArray['authenticationClass']) && $overrideArray['authenticationClass'] == 'SAMLAuthenticate') {
             unset($overrideArray['authenticationClass']);
         }
     }
     $overideString = "<?php\n/***CONFIGURATOR***/\n";
     sugar_cache_put('sugar_config', $this->config);
     $GLOBALS['sugar_config'] = $this->config;
     //print_r($overrideArray);
     //Bug#53013: Clean the tpl cache if action menu style has been changed.
     if (isset($overrideArray['enable_action_menu']) && (!isset($this->previous_sugar_override_config_array['enable_action_menu']) || $overrideArray['enable_action_menu'] != $this->previous_sugar_override_config_array['enable_action_menu'])) {
         require_once 'modules/Administration/QuickRepairAndRebuild.php';
         $repair = new RepairAndClear();
         $repair->module_list = array();
         $repair->clearTpls();
     }
     foreach ($overrideArray as $key => $val) {
         if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
             if (strcmp("{$val}", 'true') == 0) {
                 $val = true;
                 $this->config[$key] = $val;
             }
             if (strcmp("{$val}", 'false') == 0) {
                 $val = false;
                 $this->config[$key] = false;
             }
         }
         $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val);
     }
     $overideString .= '/***CONFIGURATOR***/';
     $this->saveOverride($overideString);
     if (isset($this->config['logger']['level']) && $this->logger) {
         $this->logger->setLevel($this->config['logger']['level']);
     }
 }
开发者ID:nicolasbui,项目名称:sugarcrm_dev,代码行数:44,代码来源:Configurator.php


示例3: handleOverride

 function handleOverride($fromParseLoggerSettings = false)
 {
     global $sugar_config, $sugar_version;
     $sc = SugarConfig::getInstance();
     $overrideArray = $this->readOverride();
     $this->previous_sugar_override_config_array = $overrideArray;
     $diffArray = deepArrayDiff($this->config, $sugar_config);
     $overrideArray = sugarArrayMergeRecursive($overrideArray, $diffArray);
     // To remember checkbox state
     if (!$this->useAuthenticationClass && !$fromParseLoggerSettings) {
         if (isset($overrideArray['authenticationClass']) && $overrideArray['authenticationClass'] == 'SAMLAuthenticate') {
             unset($overrideArray['authenticationClass']);
         }
     }
     $overideString = "<?php\n/***CONFIGURATOR***/\n";
     sugar_cache_put('sugar_config', $this->config);
     $GLOBALS['sugar_config'] = $this->config;
     //print_r($overrideArray);
     foreach ($overrideArray as $key => $val) {
         if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
             if (strcmp("{$val}", 'true') == 0) {
                 $val = true;
                 $this->config[$key] = $val;
             }
             if (strcmp("{$val}", 'false') == 0) {
                 $val = false;
                 $this->config[$key] = false;
             }
         }
         $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val);
     }
     $overideString .= '/***CONFIGURATOR***/';
     $this->saveOverride($overideString);
     if (isset($this->config['logger']['level']) && $this->logger) {
         $this->logger->setLevel($this->config['logger']['level']);
     }
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:37,代码来源:Configurator.php


示例4: sugarArrayMergeRecursive

/**
 * Similiar to sugarArrayMerge except arrays of N depth are merged.
 *
 * @param array gimp the array whose values will be overloaded
 * @param array dom the array whose values will pwn the gimp's
 * @return array beaten gimp
 */
function sugarArrayMergeRecursive($gimp, $dom)
{
    if (is_array($gimp) && is_array($dom)) {
        foreach ($dom as $domKey => $domVal) {
            if (array_key_exists($domKey, $gimp)) {
                if (is_array($domVal) && is_array($gimp[$domKey])) {
                    $gimp[$domKey] = sugarArrayMergeRecursive($gimp[$domKey], $domVal);
                } else {
                    $gimp[$domKey] = $domVal;
                }
            } else {
                $gimp[$domKey] = $domVal;
            }
        }
    } elseif (is_array($dom)) {
        return $dom;
    }
    return $gimp;
}
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:26,代码来源:utils.php


示例5: refreshLanguage

 /**
  * Given a module, search all of the specified locations, and any others as specified
  * in order to refresh the cache file
  *
  * @param string $module the given module we want to load the vardefs for
  * @param string $lang the given language we wish to load
  * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search
  */
 function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null)
 {
     // Some of the vardefs do not correctly define dictionary as global.  Declare it first.
     $lang_paths = array('modules/' . $module . '/language/' . $lang . '.lang.php', 'modules/' . $module . '/language/' . $lang . '.lang.override.php', 'custom/modules/' . $module . '/Ext/Language/' . $lang . '.lang.ext.php', 'custom/modules/' . $module . '/language/' . $lang . '.lang.php');
     #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files.
     static $createdModules;
     if (empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])) {
         $object = $GLOBALS['beanList'][$module];
         if ($object == 'aCase') {
             $object = 'Case';
         }
         if (!empty($GLOBALS["dictionary"]["{$object}"]["templates"])) {
             $templates = $GLOBALS["dictionary"]["{$object}"]["templates"];
             $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings);
             $createdModules[$module] = true;
         }
     }
     //end of fix #27023
     // Add in additional search paths if they were provided.
     if (!empty($additional_search_paths) && is_array($additional_search_paths)) {
         $lang_paths = array_merge($lang_paths, $additional_search_paths);
     }
     //search a predefined set of locations for the vardef files
     foreach ($lang_paths as $path) {
         if (file_exists($path)) {
             require $path;
             if (!empty($mod_strings)) {
                 if (function_exists('sugarArrayMergeRecursive')) {
                     $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings);
                 } else {
                     $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings);
                 }
             }
         }
     }
     //great! now that we have loaded all of our vardefs.
     //let's go save them to the cache file.
     if (!empty($loaded_mod_strings)) {
         LanguageManager::saveCache($module, $lang, $loaded_mod_strings);
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:49,代码来源:LanguageManager.php


示例6: genConfigs

 /**
  * Compare 3 configs and generate one to be saved to the config.php file.
  *
  * @param array $old  : the old configs from "config.php" before upgrade.
  * @param array $over : the override configs from "config_override.php".
  * @param array $new  : the new configs generated during the upgrade.
  *
  * @return array the array to be saved.
  */
 public function genConfigs($old, $over, $new)
 {
     //remove the override configs from the new configs
     $diffArray = deepArrayDiff($new, $over);
     $saveArray = sugarArrayMergeRecursive($old, $diffArray);
     return $saveArray;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:16,代码来源:UpgradeDriver.php


示例7: getIndexSetting

 /**
  *
  * Read default and specific index settings from config
  * @param string  $indexName
  * @param array   $params
  * @param boolean $addDefaults
  * @return array
  */
 protected function getIndexSetting($indexName, $params = array(), $addDefaults = true)
 {
     $indexSettings = array('index' => array('analysis' => array('analyzer' => array('core_email_lowercase' => array('type' => 'custom', 'tokenizer' => 'uax_url_email', 'filter' => array('lowercase'))))));
     if (empty($params['index_settings']) || !is_array($params['index_settings'])) {
         return $indexSettings;
     }
     $settings = $params['index_settings'];
     if ($addDefaults && isset($settings['default']) && is_array($settings['default'])) {
         $indexSettings = sugarArrayMergeRecursive($indexSettings, $settings['default']);
     }
     if (isset($settings[$indexName]) && is_array($settings[$indexName])) {
         $indexSettings = sugarArrayMergeRecursive($indexSettings, $settings[$indexName]);
     }
     $GLOBALS['log']->info("Index settings for {$indexName} -> " . var_export($indexSettings, true));
     return $indexSettings;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:24,代码来源:SugarSearchEngineElasticIndexStrategyBase.php


示例8: refreshLanguage

 /**
  * Given a module, search all of the specified locations, and any others as specified
  * in order to refresh the cache file
  *
  * @param string $module the given module we want to load the vardefs for
  * @param string $lang the given language we wish to load
  * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search
  */
 public static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null)
 {
     // Some of the vardefs do not correctly define dictionary as global.  Declare it first.
     $lang_paths = self::getModuleLanguageFilePaths($module, $lang);
     $object = BeanFactory::getObjectName($module);
     if ($object && !empty($GLOBALS['dictionary'][$object]['templates'])) {
         $templates = $GLOBALS['dictionary'][$object]['templates'];
         $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings);
     }
     // Add in additional search paths if they were provided.
     if (!empty($additional_search_paths) && is_array($additional_search_paths)) {
         $lang_paths = array_merge($lang_paths, $additional_search_paths);
     }
     //search a predefined set of locations for the vardef files
     foreach (SugarAutoLoader::existing($lang_paths) as $path) {
         require $path;
         if (!empty($mod_strings)) {
             if (function_exists('sugarArrayMergeRecursive')) {
                 $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings);
             } else {
                 $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings);
             }
         }
     }
     //great! now that we have loaded all of our vardefs.
     //let's go save them to the cache file.
     if (!empty($loaded_mod_strings)) {
         LanguageManager::saveCache($module, $lang, $loaded_mod_strings);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:38,代码来源:LanguageManager.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sugarLangArrayMerge函数代码示例发布时间:2022-05-23
下一篇:
PHP sugarArrayMerge函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap