本文整理汇总了PHP中save_custom_app_list_strings_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP save_custom_app_list_strings_contents函数的具体用法?PHP save_custom_app_list_strings_contents怎么用?PHP save_custom_app_list_strings_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_custom_app_list_strings_contents函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveTabGroups
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveTabGroups($params)
{
$tabGroups = array();
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
for ($count = 0; isset($params['slot_' . $count]); $count++) {
if ($params['delete_' . $count] == 1) {
continue;
}
$index = $params['slot_' . $count];
$labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
$labelValue = $params['tablabel_' . $index];
if (empty($GLOBALS['app_strings'][$labelID]) || $GLOBALS['app_strings'][$labelID] != $labelValue) {
$contents = return_custom_app_list_strings_file_contents($selected_lang);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $selected_lang);
$app_strings[$labelID] = $labelValue;
}
$tabGroups[$labelID] = array('label' => $labelID);
$tabGroups[$labelID]['modules'] = array();
for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
$tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
}
}
sugar_cache_put('app_strings', $GLOBALS['app_strings']);
$newFile = create_custom_directory('include/tabConfig.php');
write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
$GLOBALS['tabStructure'] = $tabGroups;
}
示例2: saveDropDown
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveDropDown($params)
{
$count = 0;
$dropdown = array();
$dropdown_name = $params['dropdown_name'];
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$my_list_strings = return_app_list_strings_language($selected_lang);
while (isset($params['slot_' . $count])) {
$index = $params['slot_' . $count];
$key = isset($params['key_' . $index]) ? $params['key_' . $index] : 'BLANK';
$value = isset($params['value_' . $index]) ? $params['value_' . $index] : '';
if ($key == 'BLANK') {
$key = '';
}
$key = trim($key);
$value = trim($value);
if (empty($params['delete_' . $index])) {
$dropdown[$key] = $value;
}
$count++;
}
if ($selected_lang == $GLOBALS['current_language']) {
$GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
}
$contents = return_custom_app_list_strings_file_contents($selected_lang);
$new_contents = replace_or_add_dropdown_type($dropdown_name, $dropdown, $contents);
save_custom_app_list_strings_contents($new_contents, $selected_lang);
sugar_cache_reset();
}
示例3: loadFullAPIList
/**
* Get the list of available APIs
* @param bool $forceRebuild
* @param bool $ignoreDisabled Should we ignore disabled status?
* @return array
*/
public static function loadFullAPIList($forceRebuild = false, $ignoreDisabled = false)
{
if (inDeveloperMode()) {
static $beenHereBefore = false;
if (!$beenHereBefore) {
$forceRebuild = true;
$beenHereBefore = true;
}
}
$cached = sugar_cached('include/externalAPI.cache.php');
if (!$forceRebuild && file_exists($cached)) {
// Already have a cache file built, no need to rebuild
require $cached;
return $ignoreDisabled ? $fullAPIList : self::filterAPIList($fullAPIList);
}
$apiFullList = array();
$meetingPasswordList = array();
$needUrlList = array();
$baseDirList = array('include/externalAPI/', 'custom/include/externalAPI/');
foreach ($baseDirList as $baseDir) {
$dirList = glob($baseDir . '*', GLOB_ONLYDIR);
foreach ($dirList as $dir) {
if ($dir == $baseDir . '.' || $dir == $baseDir . '..' || $dir == $baseDir . 'Base') {
continue;
}
$apiName = str_replace($baseDir, '', $dir);
if (file_exists($dir . '/ExtAPI' . $apiName . '.php')) {
$apiFullList[$apiName]['className'] = 'ExtAPI' . $apiName;
$apiFullList[$apiName]['file'] = $dir . '/' . $apiFullList[$apiName]['className'] . '.php';
}
if (file_exists($dir . '/ExtAPI' . $apiName . '_cstm.php')) {
$apiFullList[$apiName]['className'] = 'ExtAPI' . $apiName . '_cstm';
$apiFullList[$apiName]['file_cstm'] = $dir . '/' . $apiFullList[$apiName]['className'] . '.php';
}
}
}
$optionList = array('supportedModules', 'useAuth', 'requireAuth', 'supportMeetingPassword', 'docSearch', 'authMethod', 'oauthFixed', 'needsUrl', 'canInvite', 'sendsInvites', 'sharingOptions', 'connector', 'oauthParams', 'restrictUploadsByExtension');
foreach ($apiFullList as $apiName => $apiOpts) {
require_once $apiOpts['file'];
if (!empty($apiOpts['file_cstm'])) {
require_once $apiOpts['file_cstm'];
}
$className = $apiOpts['className'];
$apiClass = new $className();
foreach ($optionList as $opt) {
if (isset($apiClass->{$opt})) {
$apiFullList[$apiName][$opt] = $apiClass->{$opt};
}
}
// Special handling for the show/hide of the Meeting Password field, we need to create a dropdown for the Sugar Logic code.
if (isset($apiClass->supportMeetingPassword) && $apiClass->supportMeetingPassword == true) {
$meetingPasswordList[$apiName] = $apiName;
}
}
create_cache_directory('/include/');
$cached_tmp = sugar_cached('include/externalAPI.cache-tmp.php');
$fd = fopen($cached_tmp, 'w');
fwrite($fd, "<" . "?php\n//This file is auto generated by " . basename(__FILE__) . "\n\$fullAPIList = " . var_export($apiFullList, true) . ";\n\n");
fclose($fd);
rename($cached_tmp, $cached);
$fd = fopen(sugar_cached('include/externalAPI.cache-tmp.js'), 'w');
fwrite($fd, "//This file is auto generated by " . basename(__FILE__) . "\nSUGAR.eapm = " . json_encode($apiFullList) . ";\n\n");
fclose($fd);
rename(sugar_cached('include/externalAPI.cache-tmp.js'), sugar_cached('include/externalAPI.cache.js'));
if (!isset($GLOBALS['app_list_strings']['extapi_meeting_password']) || is_array($GLOBALS['app_list_strings']['extapi_meeting_password']) && count(array_diff($meetingPasswordList, $GLOBALS['app_list_strings']['extapi_meeting_password'])) != 0) {
// Our meeting password list is different... we need to do something about this.
require_once 'modules/Administration/Common.php';
$languages = get_languages();
foreach ($languages as $lang => $langLabel) {
$contents = return_custom_app_list_strings_file_contents($lang);
$new_contents = replace_or_add_dropdown_type('extapi_meeting_password', $meetingPasswordList, $contents);
save_custom_app_list_strings_contents($new_contents, $lang);
}
}
return $ignoreDisabled ? $apiFullList : self::filterAPIList($apiFullList);
}
示例4: saveTabGroups
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveTabGroups($params)
{
//#30205
global $sugar_config;
//Get the selected tab group language
$grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language'];
$tabGroups = array();
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$slot_count = $params['slot_count'];
$completedIndexes = array();
for ($count = 0; $count < $slot_count; $count++) {
if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) {
continue;
}
$index = $params['slot_' . $count];
if (isset($completedIndexes[$index])) {
continue;
}
$labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
$labelValue = $params['tablabel_' . $index];
$app_strings = return_application_language($grouptab_lang);
if (empty($app_strings[$labelID]) || $app_strings[$labelID] != $labelValue) {
$contents = return_custom_app_list_strings_file_contents($grouptab_lang);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
$languages = get_languages();
foreach ($languages as $language => $langlabel) {
if ($grouptab_lang == $language) {
continue;
}
$app_strings = return_application_language($language);
if (!isset($app_strings[$labelID])) {
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
}
$app_strings[$labelID] = $labelValue;
}
$tabGroups[$labelID] = array('label' => $labelID);
$tabGroups[$labelID]['modules'] = array();
for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
$tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
}
$completedIndexes[$index] = true;
}
// Force a rebuild of the app language
sugar_cache_clear('app_strings.' . $grouptab_lang);
$newFile = create_custom_directory('include/tabConfig.php');
write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
$GLOBALS['tabStructure'] = $tabGroups;
}
示例5: synchDropDown
/**
* function synchDropDown
* Ensures that the set of dropdown keys is consistant accross all languages.
*
* @param $dropdown_name The name of the dropdown to be synched
* @param $dropdown array The dropdown currently being saved
* @param $selected_lang String the language currently selected in Studio/MB
* @param $saveLov String the path to the directory to save the new lang file in.
*/
function synchDropDown($dropdown_name, $dropdown, $selected_lang, $saveLoc)
{
$allLanguages = get_languages();
foreach ($allLanguages as $lang => $langName) {
if ($lang != $selected_lang) {
$listStrings = return_app_list_strings_language($lang);
$langDropDown = array();
if (isset($listStrings[$dropdown_name]) && is_array($listStrings[$dropdown_name])) {
$langDropDown = $this->synchDDKeys($dropdown, $listStrings[$dropdown_name]);
} else {
//if the dropdown does not exist in the language, justt use what we have.
$langDropDown = $dropdown;
}
$contents = $this->getNewCustomContents($dropdown_name, $langDropDown, $lang);
save_custom_app_list_strings_contents($contents, $lang, $saveLoc);
}
}
}
示例6: dropdown_item_edit
function dropdown_item_edit($dropdown_type, $language, $key, $value)
{
$app_list_strings_to_edit = return_app_list_strings_language($language);
$dropdown_array = $app_list_strings_to_edit[$dropdown_type];
$dropdown_array[$key] = $value;
$contents = return_custom_app_list_strings_file_contents($language);
// get the contents of the custom app list strings file
$new_contents = replace_or_add_dropdown_type($dropdown_type, $dropdown_array, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
示例7: saveDropDown
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveDropDown($params)
{
$count = 0;
$dropdown = array();
$dropdown_name = $params['dropdown_name'];
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$my_list_strings = return_app_list_strings_language($selected_lang);
while (isset($params['slot_' . $count])) {
$index = $params['slot_' . $count];
$key = isset($params['key_' . $index]) ? SugarCleaner::stripTags($params['key_' . $index]) : 'BLANK';
$value = isset($params['value_' . $index]) ? SugarCleaner::stripTags($params['value_' . $index]) : '';
if ($key == 'BLANK') {
$key = '';
}
$key = trim($key);
$value = trim($value);
if (empty($params['delete_' . $index])) {
$dropdown[$key] = $value;
}
$count++;
}
if ($selected_lang == $GLOBALS['current_language']) {
$GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
}
$contents = return_custom_app_list_strings_file_contents($selected_lang);
//get rid of closing tags they are not needed and are just trouble
$contents = str_replace("?>", '', $contents);
if (empty($contents)) {
$contents = "<?php";
}
//add new drop down to the bottom
if (!empty($params['use_push'])) {
//this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
foreach ($dropdown as $key => $value) {
//only if the value has changed or does not exist do we want to add it this way
if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) {
//clear out the old value
$pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\[\\s*\'' . $key . '\'\\s*\\]\\s*=\\s*[\'\\"]{1}.*?[\'\\"]{1};\\s*/ism';
$contents = preg_replace($pattern_match, "\n", $contents);
//add the new ones
$contents .= "\n\$app_list_strings['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
}
}
} else {
//clear out the old value
$pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\s*=\\s*array\\s*\\([^\\)]*\\)\\s*;\\s*/ism';
$contents = preg_replace($pattern_match, "\n", $contents);
//add the new ones
$contents .= "\n\$app_list_strings['{$dropdown_name}']=" . var_export_helper($dropdown) . ";";
}
// Bug 40234 - If we have no contents, we don't write the file. Checking for "<?php" because above it's set to that if empty
if ($contents != "<?php") {
save_custom_app_list_strings_contents($contents, $selected_lang);
sugar_cache_reset();
}
// Bug38011
$repairAndClear = new RepairAndClear();
$repairAndClear->module_list = array(translate('LBL_ALL_MODULES'));
$repairAndClear->show_output = false;
$repairAndClear->clearJsLangFiles();
// ~~~~~~~~
}
示例8: saveTabGroups
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveTabGroups($params)
{
//#30205
global $sugar_config;
if (strcmp($params['other_group_tab_displayed'], '1') == 0) {
$value = true;
} else {
$value = false;
}
if (!isset($sugar_config['other_group_tab_displayed']) || $sugar_config['other_group_tab_displayed'] != $value) {
require_once 'modules/Configurator/Configurator.php';
$cfg = new Configurator();
$cfg->config['other_group_tab_displayed'] = $value;
$cfg->handleOverride();
}
//Get the selected tab group language
$grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language'];
$tabGroups = array();
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$slot_count = $params['slot_count'];
$completedIndexes = array();
for ($count = 0; $count < $slot_count; $count++) {
if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) {
continue;
}
$index = $params['slot_' . $count];
if (isset($completedIndexes[$index])) {
continue;
}
$labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
$labelValue = $params['tablabel_' . $index];
$appStirngs = return_application_language($grouptab_lang);
if (empty($appStirngs[$labelID]) || $appStirngs[$labelID] != $labelValue) {
$contents = return_custom_app_list_strings_file_contents($grouptab_lang);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
$languages = get_languages();
foreach ($languages as $language => $langlabel) {
if ($grouptab_lang == $language) {
continue;
}
$appStirngs = return_application_language($language);
if (!isset($appStirngs[$labelID])) {
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
}
$app_strings[$labelID] = $labelValue;
}
$tabGroups[$labelID] = array('label' => $labelID);
$tabGroups[$labelID]['modules'] = array();
for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
$tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
}
$completedIndexes[$index] = true;
}
sugar_cache_put('app_strings', $GLOBALS['app_strings']);
$newFile = create_custom_directory('include/tabConfig.php');
write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
$GLOBALS['tabStructure'] = $tabGroups;
}