| @@ 1214-1233 (lines=20) @@ | ||
| 1211 | * |
|
| 1212 | * @return string |
|
| 1213 | */ |
|
| 1214 | public static function cleanup($str) |
|
| 1215 | { |
|
| 1216 | $str = (string)$str; |
|
| 1217 | ||
| 1218 | if (!isset($str[0])) { |
|
| 1219 | return ''; |
|
| 1220 | } |
|
| 1221 | ||
| 1222 | // fixed ISO <-> UTF-8 Errors |
|
| 1223 | $str = self::fix_simple_utf8($str); |
|
| 1224 | ||
| 1225 | // remove all none UTF-8 symbols |
|
| 1226 | // && remove diamond question mark (�) |
|
| 1227 | // && remove remove invisible characters (e.g. "\0") |
|
| 1228 | // && remove BOM |
|
| 1229 | // && normalize whitespace chars (but keep non-breaking-spaces) |
|
| 1230 | $str = self::clean($str, true, true, false, true); |
|
| 1231 | ||
| 1232 | return (string)$str; |
|
| 1233 | } |
|
| 1234 | ||
| 1235 | /** |
|
| 1236 | * Accepts a string or a array of strings and returns an array of Unicode code points. |
|
| @@ 5133-5146 (lines=14) @@ | ||
| 5130 | * |
|
| 5131 | * @return string <p>The stripped string.</p> |
|
| 5132 | */ |
|
| 5133 | public static function strip_tags($str, $allowable_tags = null, $cleanUtf8 = false) |
|
| 5134 | { |
|
| 5135 | $str = (string)$str; |
|
| 5136 | ||
| 5137 | if (!isset($str[0])) { |
|
| 5138 | return ''; |
|
| 5139 | } |
|
| 5140 | ||
| 5141 | if ($cleanUtf8 === true) { |
|
| 5142 | $str = self::clean($str); |
|
| 5143 | } |
|
| 5144 | ||
| 5145 | return strip_tags($str, $allowable_tags); |
|
| 5146 | } |
|
| 5147 | ||
| 5148 | /** |
|
| 5149 | * Finds position of first occurrence of a string within another, case insensitive. |
|