| @@ 3368-3405 (lines=38) @@ | ||
| 3365 | * |
|
| 3366 | * @return string |
|
| 3367 | */ |
|
| 3368 | public static function lcwords($str, $exceptions = array(), $charlist = '', $encoding = 'UTF-8', $cleanUtf8 = false) |
|
| 3369 | { |
|
| 3370 | if (!$str) { |
|
| 3371 | return ''; |
|
| 3372 | } |
|
| 3373 | ||
| 3374 | $words = self::str_to_words($str, $charlist); |
|
| 3375 | $newWords = array(); |
|
| 3376 | ||
| 3377 | if (count($exceptions) > 0) { |
|
| 3378 | $useExceptions = true; |
|
| 3379 | } else { |
|
| 3380 | $useExceptions = false; |
|
| 3381 | } |
|
| 3382 | ||
| 3383 | foreach ($words as $word) { |
|
| 3384 | ||
| 3385 | if (!$word) { |
|
| 3386 | continue; |
|
| 3387 | } |
|
| 3388 | ||
| 3389 | if ( |
|
| 3390 | $useExceptions === false |
|
| 3391 | || |
|
| 3392 | ( |
|
| 3393 | $useExceptions === true |
|
| 3394 | && |
|
| 3395 | !in_array($word, $exceptions, true) |
|
| 3396 | ) |
|
| 3397 | ) { |
|
| 3398 | $word = self::lcfirst($word, $encoding, $cleanUtf8); |
|
| 3399 | } |
|
| 3400 | ||
| 3401 | $newWords[] = $word; |
|
| 3402 | } |
|
| 3403 | ||
| 3404 | return implode('', $newWords); |
|
| 3405 | } |
|
| 3406 | ||
| 3407 | /** |
|
| 3408 | * Strip whitespace or other characters from beginning of a UTF-8 string. |
|
| @@ 7253-7290 (lines=38) @@ | ||
| 7250 | * |
|
| 7251 | * @return string |
|
| 7252 | */ |
|
| 7253 | public static function ucwords($str, $exceptions = array(), $charlist = '', $encoding = 'UTF-8', $cleanUtf8 = false) |
|
| 7254 | { |
|
| 7255 | if (!$str) { |
|
| 7256 | return ''; |
|
| 7257 | } |
|
| 7258 | ||
| 7259 | $words = self::str_to_words($str, $charlist); |
|
| 7260 | $newWords = array(); |
|
| 7261 | ||
| 7262 | if (count($exceptions) > 0) { |
|
| 7263 | $useExceptions = true; |
|
| 7264 | } else { |
|
| 7265 | $useExceptions = false; |
|
| 7266 | } |
|
| 7267 | ||
| 7268 | foreach ($words as $word) { |
|
| 7269 | ||
| 7270 | if (!$word) { |
|
| 7271 | continue; |
|
| 7272 | } |
|
| 7273 | ||
| 7274 | if ( |
|
| 7275 | $useExceptions === false |
|
| 7276 | || |
|
| 7277 | ( |
|
| 7278 | $useExceptions === true |
|
| 7279 | && |
|
| 7280 | !in_array($word, $exceptions, true) |
|
| 7281 | ) |
|
| 7282 | ) { |
|
| 7283 | $word = self::ucfirst($word, $encoding, $cleanUtf8); |
|
| 7284 | } |
|
| 7285 | ||
| 7286 | $newWords[] = $word; |
|
| 7287 | } |
|
| 7288 | ||
| 7289 | return implode('', $newWords); |
|
| 7290 | } |
|
| 7291 | ||
| 7292 | /** |
|
| 7293 | * Multi decode html entity & fix urlencoded-win1252-chars. |
|