Base::clean PHP Method

clean() public method

Remove HTML tags (except those enumerated) and non-printable characters to mitigate XSS/code injection attacks
public clean ( $arg, $tags = NULL ) : mixed
$arg mixed
$tags string
return mixed
    function clean($arg, $tags = NULL)
    {
        $fw = $this;
        return $this->recursive($arg, function ($val) use($fw, $tags) {
            if ($tags != '*') {
                $val = trim(strip_tags($val, '<' . implode('><', $fw->split($tags)) . '>'));
            }
            return trim(preg_replace('/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]/', '', $val));
        });
    }

Usage Example

Example #1
0
 /**
  * Return the current element. Implementation of the Iterator interface.
  *
  * @return mixed
  */
 public function current()
 {
     return $this->base->clean($this->response['_embedded'][$this->entity][$this->position]);
 }