本文整理汇总了PHP中LanguageManager::saveCache方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::saveCache方法的具体用法?PHP LanguageManager::saveCache怎么用?PHP LanguageManager::saveCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::saveCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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);
}
}