当前位置: 首页>>代码示例>>PHP>>正文


PHP SugarCleaner类代码示例

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


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


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