| @@ 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. |
|
| @@ 7239-7276 (lines=38) @@ | ||
| 7236 | * |
|
| 7237 | * @return string |
|
| 7238 | */ |
|
| 7239 | public static function ucwords($str, $exceptions = array(), $charlist = '', $encoding = 'UTF-8', $cleanUtf8 = false) |
|
| 7240 | { |
|
| 7241 | if (!$str) { |
|
| 7242 | return ''; |
|
| 7243 | } |
|
| 7244 | ||
| 7245 | $words = self::str_to_words($str, $charlist); |
|
| 7246 | $newWords = array(); |
|
| 7247 | ||
| 7248 | if (count($exceptions) > 0) { |
|
| 7249 | $useExceptions = true; |
|
| 7250 | } else { |
|
| 7251 | $useExceptions = false; |
|
| 7252 | } |
|
| 7253 | ||
| 7254 | foreach ($words as $word) { |
|
| 7255 | ||
| 7256 | if (!$word) { |
|
| 7257 | continue; |
|
| 7258 | } |
|
| 7259 | ||
| 7260 | if ( |
|
| 7261 | $useExceptions === false |
|
| 7262 | || |
|
| 7263 | ( |
|
| 7264 | $useExceptions === true |
|
| 7265 | && |
|
| 7266 | !in_array($word, $exceptions, true) |
|
| 7267 | ) |
|
| 7268 | ) { |
|
| 7269 | $word = self::ucfirst($word, $encoding, $cleanUtf8); |
|
| 7270 | } |
|
| 7271 | ||
| 7272 | $newWords[] = $word; |
|
| 7273 | } |
|
| 7274 | ||
| 7275 | return implode('', $newWords); |
|
| 7276 | } |
|
| 7277 | ||
| 7278 | /** |
|
| 7279 | * Multi decode html entity & fix urlencoded-win1252-chars. |
|