Exemple #1
0
 public static function _xssClean(&$item, &$key)
 {
     $item = htmlspecialchars($item, ENT_QUOTES);
     $item = preg_replace_callback('!&#((?:[0-9]+)|(?:x(?:[0-9A-F]+)));?!i', array(__CLASS__, 'decode'), $item);
     // PERL
     $item = preg_replace('!<([A-Z]\\w*)
         (?:\\s* (?:\\w+) \\s* = \\s* (?(?=["\']) (["\'])(?:.*?\\2)+ | (?:[^\\s>]*) ) )*
         \\s* (\\s/)? >!ix', '<\\1\\5>', strip_tags(html_entity_decode($item)));
     self::$cleaned = $item;
 }
Exemple #2
0
 /**
  * Gets the instance of the Security class.
  *
  * @param callable| Closure $callback
  * @return object Instance of Security
  */
 public function create(Closure $callback = null)
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     if ($callback instanceof Closure) {
         return $callback(self::$instance);
     }
     return self::$instance;
 }