本文整理汇总了PHP中InputFilter::xssAuto方法的典型用法代码示例。如果您正苦于以下问题:PHP InputFilter::xssAuto方法的具体用法?PHP InputFilter::xssAuto怎么用?PHP InputFilter::xssAuto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputFilter
的用法示例。
在下文中一共展示了InputFilter::xssAuto方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializer for InputFilter class.
*
* @param string[] $tagsArray User-provided list of tags to
* either accept or reject. Default: none
* @param string[] $attrArray User-provided list of attributes to
* either accept or reject. Default: none
* @param boolean $tagsMethod How to apply the list of tags in $tagsArray:
* <ul>
* <li>true => Remove those tags which are listed in
* $tagsArray.</li>
* <li>false => Allow only those tags which are listed in
* $tagsArray.</li>
* </ul>
* Default: false
* @param boolean $attrMethod How to apply the list of attributess in $attrArray:
* <ul>
* <li>true => Remove those attributes which are listed in
* $attrArray.</li>
* <li>false => Allow only those attributes which are listed in
* $attrArray.</li>
* </ul>
* Default: false
* @param boolean $xssAuto Behavior of {@link filterTags()}:
* <ul>
* <li>true => Remove tags in {@link $tagBlacklist} and
* attributes in {@link $attrBlacklist}, in
* addition to all other potentially suspect tags
* and attributes.</li>
* <li>false => Remove potentially suspect tags and attributes
* without consulting{@link $tagBlacklist} or
* {@link $attrBlacklist}.</li>
* </ul>
* Default: true
* @uses $attrArray
* @uses $attrMethod
* @uses $tagsArray
* @uses $tagsMethod
*/
public function init($tagsArray = array(), $attrArray = array(), $tagsMethod = true, $attrMethod = true, $xssAuto = true)
{
// make sure user defined arrays are in lowercase
for ($i = 0; $i < count($tagsArray); $i++) {
$tagsArray[$i] = strtolower($tagsArray[$i]);
}
for ($i = 0; $i < count($attrArray); $i++) {
$attrArray[$i] = strtolower($attrArray[$i]);
}
// assign to member vars
self::$tagsArray = (array) $tagsArray;
self::$attrArray = (array) $attrArray;
self::$tagsMethod = $tagsMethod;
self::$attrMethod = $attrMethod;
self::$xssAuto = $xssAuto;
}