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


PHP icms_core_DataFilter::htmlSpecialchars方法代码示例

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


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

示例1: getVar

 /**
  * returns a specific variable for the object in a proper format
  *
  * @access public
  * @param string $key key of the object's variable to be returned
  * @param string $format format to use for the output
  * @return mixed formatted value of the variable
  */
 public function getVar($key, $format = 's')
 {
     $ret = $this->vars[$key]['value'];
     switch ($this->vars[$key]['data_type']) {
         case XOBJ_DTYPE_TXTBOX:
             switch (strtolower($format)) {
                 case 's':
                 case 'show':
                 case 'e':
                 case 'edit':
                     return icms_core_DataFilter::htmlSpecialchars($ret);
                     break 1;
                 case 'p':
                 case 'preview':
                 case 'f':
                 case 'formpreview':
                     return icms_core_DataFilter::htmlSpecialchars(icms_core_DataFilter::stripSlashesGPC($ret));
                     break 1;
                 case 'n':
                 case 'none':
                 default:
                     break 1;
             }
             break;
         case XOBJ_DTYPE_TXTAREA:
             switch (strtolower($format)) {
                 case 's':
                 case 'show':
                     $html = !empty($this->vars['dohtml']['value']) ? 1 : 0;
                     $xcode = !isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1 ? 1 : 0;
                     $smiley = !isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1 ? 1 : 0;
                     $image = !isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1 ? 1 : 0;
                     $br = !isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1 ? 1 : 0;
                     if ($html) {
                         if ($br) {
                             // have to use this whilst ever there's a zillion editors in the core
                             return icms_core_DataFilter::filterHTMLdisplay($ret, $xcode, $br);
                         } else {
                             return icms_core_DataFilter::checkVar($ret, 'html', 'output');
                         }
                     } else {
                         return icms_core_DataFilter::checkVar($ret, 'text', 'output');
                     }
                     break 1;
                 case 'e':
                 case 'edit':
                     return icms_core_DataFilter::checkVar($ret, 'html', 'edit');
                     break 1;
                 case 'p':
                 case 'preview':
                     $html = !empty($this->vars['dohtml']['value']) ? 1 : 0;
                     $xcode = !isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1 ? 1 : 0;
                     $smiley = !isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1 ? 1 : 0;
                     $image = !isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1 ? 1 : 0;
                     $br = !isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1 ? 1 : 0;
                     if ($html) {
                         return icms_core_DataFilter::checkVar($ret, 'html', 'input');
                     } else {
                         return icms_core_DataFilter::checkVar($ret, 'text', 'input');
                     }
                     break 1;
                 case 'f':
                 case 'formpreview':
                     $filtered = strpos($ret, '<!-- input filtered -->');
                     if ($filtered !== FALSE) {
                         $ret = str_replace('<!-- input filtered -->', '', $ret);
                         $ret = str_replace('<!-- filtered with htmlpurifier -->', '', $ret);
                     }
                     return htmlspecialchars(icms_core_DataFilter::stripSlashesGPC($ret), ENT_QUOTES);
                     break 1;
                 case 'n':
                 case 'none':
                 default:
                     break 1;
             }
             break;
         case XOBJ_DTYPE_ARRAY:
             $ret =& unserialize($ret);
             break;
         case XOBJ_DTYPE_SOURCE:
             switch (strtolower($format)) {
                 case 's':
                 case 'show':
                     break 1;
                 case 'e':
                 case 'edit':
                     return icms_core_DataFilter::checkVar($ret, 'html', 'edit');
                     break 1;
                 case 'p':
                 case 'preview':
                     return icms_core_DataFilter::stripSlashesGPC($ret);
                     break 1;
//.........这里部分代码省略.........
开发者ID:nao-pon,项目名称:impresscms,代码行数:101,代码来源:Object.php

示例2: getVar

 /**
  * returns a specific variable for the object in a proper format
  *
  * @access public
  * @param string $key key of the object's variable to be returned
  * @param string $format format to use for the output
  * @return mixed formatted value of the variable
  */
 public function getVar($key, $format = 's')
 {
     $ret = $this->vars[$key]['value'];
     switch ($this->vars[$key]['data_type']) {
         case XOBJ_DTYPE_TXTBOX:
             switch (strtolower($format)) {
                 case 's':
                 case 'show':
                 case 'e':
                 case 'edit':
                     return icms_core_DataFilter::htmlSpecialchars($ret);
                     break 1;
                 case 'p':
                 case 'preview':
                 case 'f':
                 case 'formpreview':
                     return icms_core_DataFilter::htmlSpecialchars(icms_core_DataFilter::stripSlashesGPC($ret));
                     break 1;
                 case 'n':
                 case 'none':
                 default:
                     break 1;
             }
             break;
         case XOBJ_DTYPE_TXTAREA:
             switch (strtolower($format)) {
                 case 's':
                 case 'show':
                     $ts =& icms_core_Textsanitizer::getInstance();
                     $html = !empty($this->vars['dohtml']['value']) ? 1 : 0;
                     $xcode = !isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1 ? 1 : 0;
                     $smiley = !isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1 ? 1 : 0;
                     $image = !isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1 ? 1 : 0;
                     $br = !isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1 ? 1 : 0;
                     if ($html) {
                         return $ts->displayTarea($ret, $html, $smiley, $xcode, $image, $br);
                     } else {
                         return icms_core_DataFilter::checkVar($ret, 'text', 'output');
                     }
                     break 1;
                 case 'e':
                 case 'edit':
                     return htmlspecialchars($ret, ENT_QUOTES);
                     break 1;
                 case 'p':
                 case 'preview':
                     $ts =& icms_core_Textsanitizer::getInstance();
                     $html = !empty($this->vars['dohtml']['value']) ? 1 : 0;
                     $xcode = !isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1 ? 1 : 0;
                     $smiley = !isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1 ? 1 : 0;
                     $image = !isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1 ? 1 : 0;
                     $br = !isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1 ? 1 : 0;
                     if ($html) {
                         return $ts->previewTarea($ret, $html, $smiley, $xcode, $image, $br);
                     } else {
                         return icms_core_DataFilter::checkVar($ret, 'text', 'output');
                     }
                     break 1;
                 case 'f':
                 case 'formpreview':
                     return htmlspecialchars(icms_core_DataFilter::stripSlashesGPC($ret), ENT_QUOTES);
                     break 1;
                 case 'n':
                 case 'none':
                 default:
                     break 1;
             }
             break;
         case XOBJ_DTYPE_ARRAY:
             $ret =& unserialize($ret);
             break;
         case XOBJ_DTYPE_SOURCE:
             switch (strtolower($format)) {
                 case 's':
                 case 'show':
                     break 1;
                 case 'e':
                 case 'edit':
                     return htmlspecialchars($ret, ENT_QUOTES);
                     break 1;
                 case 'p':
                 case 'preview':
                     return icms_core_DataFilter::stripSlashesGPC($ret);
                     break 1;
                 case 'f':
                 case 'formpreview':
                     return htmlspecialchars(icms_core_DataFilter::stripSlashesGPC($ret), ENT_QUOTES);
                     break 1;
                 case 'n':
                 case 'none':
                 default:
                     break 1;
//.........这里部分代码省略.........
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:101,代码来源:Object.php


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