本文整理汇总了PHP中SugarCleaner::stripTags方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarCleaner::stripTags方法的具体用法?PHP SugarCleaner::stripTags怎么用?PHP SugarCleaner::stripTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarCleaner
的用法示例。
在下文中一共展示了SugarCleaner::stripTags方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveDropDown
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveDropDown($params)
{
require_once 'modules/Administration/Common.php';
$emptyMarker = translate('LBL_BLANK');
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$type = $_REQUEST['view_package'];
$dir = '';
$dropdown_name = $params['dropdown_name'];
$json = getJSONobj();
$list_value = str_replace('"":""', '"__empty__":""', $params['list_value']);
//Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
$temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES));
$dropdown = array();
// dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order
// we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered
if (is_array($temp)) {
foreach ($temp as $item) {
$dropdown[SugarCleaner::stripTags(from_html($item[0]), false)] = SugarCleaner::stripTags(from_html($item[1]), false);
}
}
if (array_key_exists($emptyMarker, $dropdown)) {
$output = array();
foreach ($dropdown as $key => $value) {
if ($emptyMarker === $key) {
$output[''] = '';
} else {
$output[$key] = $value;
}
}
$dropdown = $output;
}
if ($type != 'studio') {
$mb = new ModuleBuilder();
$module = $mb->getPackageModule($params['view_package'], $params['view_module']);
$this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
//Can't use synch on selected lang as we want to overwrite values, not just keys
$module->mblanguage->appListStrings[$selected_lang . '.lang.php'][$dropdown_name] = $dropdown;
$module->mblanguage->save($module->key_name);
// tyoung - key is required parameter as of
} else {
$contents = return_custom_app_list_strings_file_contents($selected_lang);
$my_list_strings = return_app_list_strings_language($selected_lang);
if ($selected_lang == $GLOBALS['current_language']) {
$GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
}
//write to contents
$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\$GLOBALS['app_list_strings']['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
}
}
} else {
//Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
$this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
$contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
}
if (!empty($dir) && !is_dir($dir)) {
$continue = mkdir_recursive($dir);
}
save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
}
sugar_cache_reset();
clearAllJsAndJsLangFilesWithoutOutput();
}
示例2: getChangedModules
/**
* Determine which modules have been updated and return an array with the module name as the key
* and the singular/plural entries as the value.
*
* @return array
*/
private function getChangedModules()
{
$count = 0;
$allModuleEntries = array();
$results = array();
$params = $_REQUEST;
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$current_app_list_string = 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]) : '';
$svalue = isset($params['svalue_' . $index]) ? SugarCleaner::stripTags($params['svalue_' . $index]) : $value;
if ($key == 'BLANK') {
$key = '';
}
$key = trim($key);
$value = trim($value);
$svalue = trim($svalue);
//If the module key dne then do not continue with this rename.
if (isset($current_app_list_string['moduleList'][$key])) {
$allModuleEntries[$key] = array('s' => $svalue, 'p' => $value);
} else {
$_REQUEST['delete_' . $count] = TRUE;
}
$count++;
}
foreach ($allModuleEntries as $k => $e) {
$svalue = $e['s'];
$pvalue = $e['p'];
$prev_plural = $current_app_list_string['moduleList'][$k];
$prev_singular = isset($current_app_list_string['moduleListSingular'][$k]) ? $current_app_list_string['moduleListSingular'][$k] : $prev_plural;
if (strcmp($prev_plural, $pvalue) != 0 || strcmp($prev_singular, $svalue) != 0) {
$results[$k] = array('singular' => $svalue, 'plural' => $pvalue, 'prev_singular' => $prev_singular, 'prev_plural' => $prev_plural, 'key_plural' => $k, 'key_singular' => $this->getModuleSingularKey($k));
}
}
return $results;
}
示例3: 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();
// ~~~~~~~~
}
示例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 = SugarCleaner::stripTags(from_html($params['tablabel_' . $index]), false);
$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
global $current_user;
include get_custom_file_if_exists('modules/Administration/RebuildJSLang.php');
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: savePageTitle
function savePageTitle()
{
global $current_user;
$pages = $current_user->getPreference('pages', $this->type);
$json = getJSONobj();
$newPageName = $json->decode(html_entity_decode($_REQUEST['newPageTitle']));
$pages[$_REQUEST['pageId']]['pageTitle'] = SugarCleaner::stripTags(from_html($newPageName), false);
$current_user->setPreference('pages', $pages, 0, $this->type);
return to_html($pages[$_REQUEST['pageId']]['pageTitle'], ENT_QUOTES);
}
示例6: getAllModulesFromRequest
/**
* Gets all modules from the request. This is used to build the singular
* module list for changes so that the entire list is set properly into the
* global array after save. This is also used to get all changed modules.
*
* @return array
*/
protected function getAllModulesFromRequest()
{
// We really only want to get this once
if (!empty($this->requestModules)) {
return $this->requestModules;
}
global $locale;
$count = 0;
$allModuleEntries = array();
$results = array();
$params = $_REQUEST;
if (!empty($_REQUEST['dropdown_lang'])) {
$selected_lang = $_REQUEST['dropdown_lang'];
} else {
$selected_lang = $locale->getAuthenticatedUserLanguage();
}
$current_app_list_string = 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]) : '';
$svalue = isset($params['svalue_' . $index]) ? SugarCleaner::stripTags($params['svalue_' . $index]) : $value;
if ($key == 'BLANK') {
$key = '';
}
$key = trim($key);
$value = trim($value);
$svalue = trim($svalue);
//If the module key dne then do not continue with this rename.
if (isset($current_app_list_string['moduleList'][$key])) {
$allModuleEntries[$key] = array('s' => $svalue, 'p' => $value);
} else {
$_REQUEST['delete_' . $count] = true;
}
$count++;
}
foreach ($allModuleEntries as $k => $e) {
$svalue = $e['s'];
$pvalue = $e['p'];
$prev_plural = $current_app_list_string['moduleList'][$k];
$prev_singular = isset($current_app_list_string['moduleListSingular'][$k]) ? $current_app_list_string['moduleListSingular'][$k] : $prev_plural;
$results[$k] = array('singular' => $svalue, 'plural' => $pvalue, 'prev_singular' => $prev_singular, 'prev_plural' => $prev_plural, 'key_plural' => $k, 'key_singular' => $this->getModuleSingularKey($k), 'changed' => strcmp($prev_plural, $pvalue) != 0 || strcmp($prev_singular, $svalue) != 0);
}
$this->requestModules = $results;
return $results;
}
示例7: saveDropDown
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
public function saveDropDown($params)
{
global $locale;
$emptyMarker = translate('LBL_BLANK');
if (!empty($_REQUEST['dropdown_lang'])) {
$selected_lang = $_REQUEST['dropdown_lang'];
} else {
$selected_lang = $locale->getAuthenticatedUserLanguage();
}
$type = $_REQUEST['view_package'];
$dropdown_name = $params['dropdown_name'];
$json = getJSONobj();
$list_value = str_replace('"":""', '"__empty__":""', $params['list_value']);
//Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
$temp = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES));
$dropdown = array();
// dropdown is received as an array of (name,value) pairs - now extract to name=>value format preserving order
// we rely here on PHP to preserve the order of the received name=>value pairs - associative arrays in PHP are ordered
if (is_array($temp)) {
foreach ($temp as $item) {
$dropdown[SugarCleaner::stripTags(from_html($item[0]), false)] = SugarCleaner::stripTags(from_html($item[1]), false);
}
}
if (array_key_exists($emptyMarker, $dropdown)) {
$output = array();
foreach ($dropdown as $key => $value) {
if ($emptyMarker === $key) {
$output[''] = '';
} else {
$output[$key] = $value;
}
}
$dropdown = $output;
}
if ($type != 'studio') {
$mb = new ModuleBuilder();
$module = $mb->getPackageModule($params['view_package'], $params['view_module']);
$this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
//Can't use synch on selected lang as we want to overwrite values, not just keys
$module->mblanguage->appListStrings[$selected_lang . '.lang.php'][$dropdown_name] = $dropdown;
$module->mblanguage->save($module->key_name, false, true);
// tyoung - key is required parameter as of
} else {
$contents = return_custom_app_list_strings_file_contents($selected_lang);
$my_list_strings = return_app_list_strings_language($selected_lang);
if ($selected_lang == $GLOBALS['current_language']) {
$GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
}
//write to contents
$contents = str_replace("?>", '', $contents);
if (empty($contents)) {
$contents = "<?php";
}
// Skip saveExemptDropdowns on upgrades
if (empty($params['skipSaveExemptDropdowns'])) {
$dropdown = $this->saveExemptDropdowns($dropdown, $dropdown_name, $my_list_strings, $selected_lang);
}
//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
$app_list_strings = array();
$filePath = $this->getExtensionFilePath($dropdown_name, $selected_lang);
//Include the original extension to ensure any values sourced from it are kept.
if (sugar_is_file($filePath)) {
include $filePath;
}
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) {
$app_list_strings[$dropdown_name][$key] = $value;
}
}
//Now that we have all the values, save the overrides to the extension
if (!empty($app_list_strings[$dropdown_name])) {
$contents = "<?php\n //created: " . date('Y-m-d H:i:s') . "\n";
foreach ($app_list_strings[$dropdown_name] as $key => $value) {
$contents .= "\n\$app_list_strings['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
}
$this->saveContents($dropdown_name, $contents, $selected_lang);
}
} else {
if (empty($params['skip_sync'])) {
// Now synch up the keys in other languages to ensure that removed/added
// Drop down values work properly under all langs.
// If skip_sync, we don't want to sync ALL languages
$this->synchDropDown($dropdown_name, $dropdown, $selected_lang);
}
$contents = $this->getExtensionContents($dropdown_name, $dropdown);
$this->saveContents($dropdown_name, $contents, $selected_lang);
}
}
$this->finalize($selected_lang);
}