本文整理汇总了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;
//.........这里部分代码省略.........
示例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;
//.........这里部分代码省略.........