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


PHP Sanitize::saveHTML方法代码示例

本文整理汇总了PHP中Sanitize::saveHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::saveHTML方法的具体用法?PHP Sanitize::saveHTML怎么用?PHP Sanitize::saveHTML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanitize的用法示例。


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

示例1: save

 public static function save($value, $type, $standard = null)
 {
     $var = $standard;
     if ($value !== null) {
         if ($type == VAR_DB || $type == VAR_ARR_DB) {
             $var = Sanitize::saveDb($value);
         } elseif ($type == VAR_HTML || $type == VAR_ARR_HTML) {
             $var = Sanitize::saveHTML($value);
         } elseif ($type == VAR_INT || $type == VAR_ARR_INT) {
             $var = Sanitize::saveInt($value);
         } elseif ($type == VAR_ALNUM || $type == VAR_ARR_ALNUM) {
             $var = Sanitize::saveAlNum($value, true);
         } elseif ($type == VAR_URI || $type == VAR_ARR_URI) {
             $var = Sanitize::saveAlNum($value, false);
         } else {
             $var = Sanitize::removeNullByte($value);
         }
     } else {
         if ($standard === null) {
             if ($type == VAR_DB || $type == VAR_ALNUM || $type == VAR_HTML || $type == VAR_URI) {
                 $var = '';
             } elseif ($type == VAR_INT) {
                 $var = 0;
             } elseif ($type == VAR_ARR_INT || $type == VAR_ARR_DB || $type == VAR_ARR_ALNUM || $type == VAR_ARR_NONE || $type == VAR_ARR_HTML || $type == VAR_ARR_URI) {
                 $var = array();
             } else {
                 $var = null;
             }
         }
     }
     return $var;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:32,代码来源:class.Sanitize.php

示例2: assign

 public function assign($key, $value, $sanitize = true)
 {
     if ($sanitize) {
         $value = Sanitize::saveHTML($value);
     }
     $this->vars[$key] = $value;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:7,代码来源:class.TemplateBit.php

示例3: write

 public function write($onlyCreate = false, $tpl = null)
 {
     $id = Request::get(1, VAR_INT);
     $isSent = Request::get(2, VAR_URI) == 'send';
     $data = new CustomData($this->position);
     if ($id > 0 && $onlyCreate && Session::getObject()->getSetting('last_added') != $id) {
         CmsPage::error('Die Bearbeitungszeit ist abgelaufen. Bitte wenden Sie sich an den Administrator.');
     } else {
         if ($id > 0 && !$data->load($id)) {
             CmsPage::error('Der gewählte Datensatz wurde leider nicht gefunden.');
         } else {
             if ($id == 0) {
                 $data->setToDefault();
             }
             $fields = $data->getFields();
             if ($isSent) {
                 $options = array();
                 foreach ($fields as $field) {
                     if ($field->canWrite()) {
                         if ($field->getField() instanceof CustomExternalFields) {
                             $options = array_merge($options, $field->getValidation());
                         } else {
                             $options[$field->getFieldName()] = $field->getValidation();
                         }
                     }
                 }
                 $result = Validator::checkRequest($options);
                 foreach ($fields as $field) {
                     if ($field->canWrite()) {
                         $name = $field->getFieldName();
                         if (isset($result['data'][$name])) {
                             $field->setData($result['data'][$name]);
                         }
                     }
                 }
                 if (count($result['error']) > 0) {
                     CmsPage::error($result['error']);
                 } else {
                     $success = false;
                     if ($id > 0) {
                         $success = $data->edit($id);
                     } else {
                         $id = $data->add();
                         if ($onlyCreate) {
                             Session::getObject()->setSetting('last_added', $id);
                         }
                         if ($id > 0) {
                             $success = true;
                         } else {
                             $id = 0;
                             $success = false;
                         }
                     }
                     if ($success) {
                         CmsPage::ok("Der Datensatz wurde erfolgreich gespeichert.");
                     } else {
                         CmsPage::error("Der Datensatz konnt leider nicht gespeichert werden.");
                     }
                 }
             }
             $html = array();
             foreach ($fields as $field) {
                 if ($field->canWrite()) {
                     $html[] = array('field' => Sanitize::saveHTML($field->getFieldName()), 'name' => Sanitize::saveHTML($field->getName()), 'description' => Sanitize::saveHTML($field->getDescription()), 'code' => $field->getInputCode(), 'label' => !$field->noLabel());
                 }
             }
             $tpl = Response::getObject()->appendTemplate($tpl ? $tpl : '/Cms/fields/data_categories_write');
             $tpl->assign('data', $data, false);
             $tpl->assign('fields', $html, false);
             $tpl->assign('id', $id);
             $tpl->assign('baseUri', $this->baseUri);
             $tpl->output();
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:75,代码来源:class.FieldDataPages.php

示例4: echoSave

function echoSave($data)
{
    echo Sanitize::saveHTML($data);
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:4,代码来源:function.core.php


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