Пример #1
0
 /** 
  *  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;
 }