Beispiel #1
0
 /**
  * Make string safe
  * - Remove UTF-8 chars
  * - Remove all tags
  * - Trim
  * - Addslashes (opt)
  * - To lower (opt)
  *
  * @param string $string
  * @param bool   $toLower
  * @param bool   $addslashes
  * @return string
  */
 public static function clean($string, $toLower = false, $addslashes = false)
 {
     $string = Slug::removeAccents($string);
     $string = strip_tags($string);
     $string = trim($string);
     if ($addslashes) {
         $string = addslashes($string);
     }
     if ($toLower) {
         $string = self::low($string);
     }
     return $string;
 }