added Str::ascii method and fixed accented character problem in URL::slug.

This commit is contained in:
Taylor Otwell
2011-07-30 09:52:49 -05:00
parent 86075c2765
commit 481d2aa7ec
3 changed files with 90 additions and 0 deletions

View File

@@ -109,6 +109,8 @@ class URL {
*/
public static function slug($title, $separator = '-')
{
$title = html_entity_decode(Str::ascii($title), ENT_QUOTES, Config::get('application.encoding'));
// Remove all characters that are not the separator, letters, numbers, or whitespace.
$title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', Str::lower($title));