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

PHP SugarCleaner类代码示例

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

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



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

示例1: testEmailCleanup

    function testEmailCleanup()
    {
        $inStr = <<<EOS
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt">hello, <o:p></o:p></SPAN><BR>
<SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt">i recently got Batman Arkham City and tried to get catwoman as an add-on character but when i put the code in it said that my code had already been used. <o:p></o:p></SPAN><BR>
<SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt">what can i do, so that i can play catwoman?<o:p></o:p></SPAN><BR>
 <BR> </div></body>
</html>
EOS;
        $outStr = <<<EOS
<div dir="ltr">
<span style="font-family:Tahoma, 'sans-serif';font-size:10pt;">hello, </span><p></p><br /><span style="font-family:Tahoma, 'sans-serif';font-size:10pt;">i recently got Batman Arkham City and tried to get catwoman as an add-on character but when i put the code in it said that my code had already been used. </span><p></p><br /><span style="font-family:Tahoma, 'sans-serif';font-size:10pt;">what can i do, so that i can play catwoman?</span><p></p><br /><br /></div>
EOS;
        $actual = SugarCleaner::cleanHtml($inStr);
        // Normalize the line endings - Bug #51227
        $outStr = str_replace("\r\n", "\n", $outStr);
        $actual = str_replace("\r\n", "\n", $actual);
        $this->assertEquals(trim($outStr), trim($actual));
    }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:33,代码来源:Bug50241Test.php


示例2: handleSave

 /**
  * Takes in the request params from a save request and processes
  * them for the save.
  * @param REQUEST $params       Labels as "label_".System label => Display label pairs
  * @param string $language      Language key, for example 'en_us'
  */
 function handleSave($params, $language)
 {
     $labels = array();
     foreach ($params as $key => $value) {
         if (preg_match('/^label_/', $key) && strcmp($value, 'no_change') != 0) {
             $labels[strtoupper(substr($key, 6))] = SugarCleaner::cleanHtml(from_html($value), false);
         }
     }
     if (!empty($this->packageName)) {
         return self::addLabels($language, $labels, $this->moduleName, "custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/language");
     } else {
         $addLabelsResult = true;
         $addExtLabelsResult = true;
         $extLabels = array();
         $extFile = "custom/modules/" . $this->moduleName . "/Ext/Language/" . $language . ".lang.ext.php";
         if (is_file($extFile)) {
             include $extFile;
             foreach ($labels as $key => $value) {
                 if (isset($mod_strings[$key])) {
                     $extLabels[$key] = $value;
                     unset($labels[$key]);
                 }
             }
         }
         if (!empty($labels)) {
             $addLabelsResult = self::addLabels($language, $labels, $this->moduleName);
         }
         if (!empty($extLabels)) {
             $addExtLabelsResult = self::addLabels($language, $extLabels, $this->moduleName, null, true);
         }
         return $addLabelsResult && $addExtLabelsResult;
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:39,代码来源:parser.label.php


示例3: save

 function save($df)
 {
     $this->ext3 = 'text';
     // clean the field of any dangerous html tags like the script tag, etc
     $this->ext4 = SugarCleaner::cleanHtml($this->ext4, true);
     parent::save($df);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:7,代码来源:TemplateHTML.php


示例4: save

 /**
  * Saves the current comment.
  * @param  boolean $check_notify
  * @return string|bool           GUID of saved comment or false.
  */
 public function save($check_notify = false)
 {
     //if a string convert to object
     if (is_string($this->data)) {
         $this->data = json_decode($this->data, true);
     }
     if (!empty($this->data['value'])) {
         $this->data['value'] = SugarCleaner::cleanHtml($this->data['value']);
     }
     if (!is_string($this->data)) {
         $this->data = json_encode($this->data);
     }
     $activity = BeanFactory::getBean('Activities', $this->parent_id);
     if (!empty($activity) && $activity->id) {
         $isNew = empty($this->id) || $this->new_with_id;
         if (parent::save($check_notify)) {
             if ($isNew) {
                 $activity->addComment($this);
                 $this->processCommentTags($activity);
             }
             return $this->id;
         }
     }
     return false;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:Comment.php


示例5: testEmailCleanup

 /**
  * @dataProvider getUrls
  * @param string $url
  */
 function testEmailCleanup($url, $imgShouldBeRemoved)
 {
     $data = "Test: <img src=\"{$url}\">";
     if ($imgShouldBeRemoved) {
         $res = str_replace("<img />", "", SugarCleaner::cleanHtml($data));
         $this->assertNotContains("<img", $res);
     } else {
         $this->assertContains("<img", SugarCleaner::cleanHtml($data));
     }
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:14,代码来源:Bug43554Test.php


示例6: handleSave

 /**
  * Takes in the request params from a save request and processes
  * them for the save.
  * @param REQUEST $params       Labels as "label_".System label => Display label pairs
  * @param string $language      Language key, for example 'en_us'
  */
 function handleSave($params, $language)
 {
     $labels = array();
     foreach ($params as $key => $value) {
         if (preg_match('/^label_/', $key) && strcmp($value, 'no_change') != 0) {
             $labels[strtoupper(substr($key, 6))] = SugarCleaner::cleanHtml(from_html($value), false);
         }
     }
     if (!empty($this->packageName)) {
         return self::addLabels($language, $labels, $this->moduleName, "custom/modulebuilder/packages/{$this->packageName}/modules/{$this->moduleName}/language");
     } else {
         return self::addLabels($language, $labels, $this->moduleName);
     }
 }
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:20,代码来源:parser.label.php


示例7: save

 function save($check_notify = false)
 {
     $this->name = SugarCleaner::cleanHtml($this->name);
     $this->description = SugarCleaner::cleanHtml($this->description);
     global $current_user, $sugar_config;
     parent::save($check_notify);
     $email_template = new EmailTemplate();
     if ($_REQUEST['module'] == 'Import') {
         //Don't send email on import
         return;
     }
     if (!isAOPEnabled()) {
         return;
     }
     if ($this->internal) {
         return;
     }
     $signature = array();
     $addDelimiter = true;
     $aop_config = $sugar_config['aop'];
     if ($this->assigned_user_id) {
         if ($aop_config['contact_email_template_id']) {
             $email_template = $email_template->retrieve($aop_config['contact_email_template_id']);
             $signature = $current_user->getDefaultSignature();
         }
         if ($email_template) {
             foreach ($this->getContacts() as $contact) {
                 $GLOBALS['log']->info("AOPCaseUpdates: Calling send email");
                 $emails = array();
                 $emails[] = $contact->emailAddress->getPrimaryAddress($contact);
                 $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter, $contact->id);
             }
         }
     } else {
         $emails = $this->getEmailForUser();
         if ($aop_config['user_email_template_id']) {
             $email_template = $email_template->retrieve($aop_config['user_email_template_id']);
         }
         $addDelimiter = false;
         if ($emails && $email_template) {
             $GLOBALS['log']->info("AOPCaseUpdates: Calling send email");
             $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter, $this->contact_id);
         }
     }
     if ($emails && $email_template) {
         $GLOBALS['log']->info("AOPCaseUpdates: Calling send email");
         $res = $this->sendEmail($emails, $email_template, $signature, $this->case_id, $addDelimiter);
     }
 }
开发者ID:omusico,项目名称:suitecrm-docker,代码行数:49,代码来源:AOP_Case_Updates.php


示例8: save

 function save($check_notify = false)
 {
     $this->name = SugarCleaner::cleanHtml($this->name);
     $this->description = SugarCleaner::cleanHtml($this->description);
     parent::save($check_notify);
     if (file_exists('custom/modules/AOP_Case_Updates/CaseUpdatesHook.php')) {
         require_once 'custom/modules/AOP_Case_Updates/CaseUpdatesHook.php';
     } else {
         require_once 'modules/AOP_Case_Updates/CaseUpdatesHook.php';
     }
     if (class_exists('CustomCaseUpdatesHook')) {
         $hook = new CustomCaseUpdatesHook();
     } else {
         $hook = new CaseUpdatesHook();
     }
     $hook->sendCaseUpdate($this);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:17,代码来源:AOP_Case_Updates.php


示例9: clean

 protected function clean($str)
 {
     return SugarCleaner::cleanHtml($str, false);
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:4,代码来源:XssTest.php


示例10: 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;
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:44,代码来源:RenameModules.php


示例11: save

 function save($check_notify = false)
 {
     global $current_user;
     if ($this->isDuplicate) {
         $GLOBALS['log']->debug("EMAIL - tried to save a duplicate Email record");
     } else {
         if (empty($this->id)) {
             $this->id = create_guid();
             $this->new_with_id = true;
         }
         $this->from_addr_name = $this->cleanEmails($this->from_addr_name);
         $this->to_addrs_names = $this->cleanEmails($this->to_addrs_names);
         $this->cc_addrs_names = $this->cleanEmails($this->cc_addrs_names);
         $this->bcc_addrs_names = $this->cleanEmails($this->bcc_addrs_names);
         $this->reply_to_addr = $this->cleanEmails($this->reply_to_addr);
         $this->description = SugarCleaner::cleanHtml($this->description);
         $this->description_html = SugarCleaner::cleanHtml($this->description_html, true);
         $this->raw_source = SugarCleaner::cleanHtml($this->raw_source, true);
         $this->saveEmailText();
         $this->saveEmailAddresses();
         $GLOBALS['log']->debug('-------------------------------> Email called save()');
         // handle legacy concatenation of date and time fields
         //Bug 39503 - SugarBean is not setting date_sent when seconds missing
         if (empty($this->date_sent)) {
             global $timedate;
             $date_sent_obj = $timedate->fromUser($timedate->merge_date_time($this->date_start, $this->time_start), $current_user);
             if (!empty($date_sent_obj) && $date_sent_obj instanceof SugarDateTime) {
                 $this->date_sent = $date_sent_obj->asDb();
             }
         }
         parent::save($check_notify);
         if (!empty($this->parent_type) && !empty($this->parent_id)) {
             if (!empty($this->fetched_row) && !empty($this->fetched_row['parent_id']) && !empty($this->fetched_row['parent_type'])) {
                 if ($this->fetched_row['parent_id'] != $this->parent_id || $this->fetched_row['parent_type'] != $this->parent_type) {
                     $mod = strtolower($this->fetched_row['parent_type']);
                     $rel = array_key_exists($mod, $this->field_defs) ? $mod : $mod . "_activities_emails";
                     //Custom modules rel name
                     if ($this->load_relationship($rel)) {
                         $this->{$rel}->delete($this->id, $this->fetched_row['parent_id']);
                     }
                 }
             }
             $mod = strtolower($this->parent_type);
             $rel = array_key_exists($mod, $this->field_defs) ? $mod : $mod . "_activities_emails";
             //Custom modules rel name
             if ($this->load_relationship($rel)) {
                 $this->{$rel}->add($this->parent_id);
             }
         }
     }
     $GLOBALS['log']->debug('-------------------------------> Email save() done');
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:52,代码来源:Email.php


示例12: filterHTML

 public function filterHTML($bean, $event, $arguments)
 {
     $bean->description = SugarCleaner::cleanHtml($bean->description, true);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:4,代码来源:CaseUpdatesHook.php


示例13: remove_xss

/**
 * Remove potential xss vectors from strings
 * @param string str String to search for XSS attack vectors
 * @deprecated
 * @return string
 */
function remove_xss($str)
{
    return SugarCleaner::cleanHtml($str, false);
}
开发者ID:pikkoui,项目名称:suitecrm,代码行数:10,代码来源:utils.php


示例14: cleanBean

 /**
  * Cleans char, varchar, text, etc. fields of XSS type materials
  */
 function cleanBean()
 {
     foreach ($this->field_defs as $key => $def) {
         if (isset($def['type'])) {
             $type = $def['type'];
         }
         if (isset($def['dbType'])) {
             $type .= $def['dbType'];
         }
         if ($def['type'] == 'html' || $def['type'] == 'longhtml') {
             $this->{$key} = SugarCleaner::cleanHtml($this->{$key}, true);
         } elseif ((strpos($type, 'char') !== false || strpos($type, 'text') !== false || $type == 'enum') && !empty($this->{$key})) {
             $this->{$key} = SugarCleaner::cleanHtml($this->{$key});
         }
     }
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:19,代码来源:SugarBean.php


示例15: 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;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:60,代码来源:TabGroupHelper.php


示例16: 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);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:10,代码来源:MySugar.php


示例17: 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;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:53,代码来源:RenameModules.php


示例18: testEmailCleanup

 /**
  * @dataProvider getData
  * @param string $url
  */
 function testEmailCleanup($data, $res)
 {
     $this->assertEquals($res, SugarCleaner::cleanHtml($data));
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:8,代码来源:Bug44009Test.php


示例19: 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('&quot;&quot;:&quot;&quot;', '&quot;__empty__&quot;:&quot;&quot;', $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);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:99,代码来源:parser.dropdown.php


示例20: retrieve

 function retrieve($id, $encoded = true, $deleted = true)
 {
     // cn: bug 11915, return SugarBean's retrieve() call bean instead of $this
     $ret = parent::retrieve($id, $encoded, $deleted);
     if ($ret) {
         $ret->retrieveEmailText();
         $ret->raw_source = SugarCleaner::cleanHtml($ret->raw_source);
         $ret->description = to_html($ret->description);
         $ret->description_html = SugarCleaner::cleanHtml($ret->description_html);
         $ret->retrieveEmailAddresses();
         $ret->date_start = '';
         $ret->time_start = '';
         $dateSent = explode(' ', $ret->date_sent);
         if (!empty($dateSent)) {
             $ret->date_start = $dateSent[0];
             if (isset($dateSent[1])) {
                 $ret->time_start = $dateSent[1];
             }
         }
         // for Email 2.0
         foreach ($ret as $k => $v) {
             $this->{$k} = $v;
         }
     }
     return $ret;
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:26,代码来源:Email.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP SugarConfig类代码示例发布时间:2022-05-23
下一篇:
PHP SugarChartFactory类代码示例发布时间: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