| @@ 1239-1258 (lines=20) @@ | ||
| 1236 | * |
|
| 1237 | * @return string |
|
| 1238 | */ |
|
| 1239 | public static function cleanup($str) |
|
| 1240 | { |
|
| 1241 | $str = (string)$str; |
|
| 1242 | ||
| 1243 | if (!isset($str[0])) { |
|
| 1244 | return ''; |
|
| 1245 | } |
|
| 1246 | ||
| 1247 | // fixed ISO <-> UTF-8 Errors |
|
| 1248 | $str = self::fix_simple_utf8($str); |
|
| 1249 | ||
| 1250 | // remove all none UTF-8 symbols |
|
| 1251 | // && remove diamond question mark (�) |
|
| 1252 | // && remove remove invisible characters (e.g. "\0") |
|
| 1253 | // && remove BOM |
|
| 1254 | // && normalize whitespace chars (but keep non-breaking-spaces) |
|
| 1255 | $str = self::clean($str, true, true, false, true); |
|
| 1256 | ||
| 1257 | return (string)$str; |
|
| 1258 | } |
|
| 1259 | ||
| 1260 | /** |
|
| 1261 | * Accepts a string or a array of strings and returns an array of Unicode code points. |
|
| @@ 5216-5229 (lines=14) @@ | ||
| 5213 | * |
|
| 5214 | * @return string <p>The stripped string.</p> |
|
| 5215 | */ |
|
| 5216 | public static function strip_tags($str, $allowable_tags = null, $cleanUtf8 = false) |
|
| 5217 | { |
|
| 5218 | $str = (string)$str; |
|
| 5219 | ||
| 5220 | if (!isset($str[0])) { |
|
| 5221 | return ''; |
|
| 5222 | } |
|
| 5223 | ||
| 5224 | if ($cleanUtf8 === true) { |
|
| 5225 | $str = self::clean($str); |
|
| 5226 | } |
|
| 5227 | ||
| 5228 | return strip_tags($str, $allowable_tags); |
|
| 5229 | } |
|
| 5230 | ||
| 5231 | /** |
|
| 5232 | * Finds position of first occurrence of a string within another, case insensitive. |
|