diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-10-11 00:37:06 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-10-11 00:37:06 +0200 |
commit | fd275707f6c1a5a63feb8708731d7c97683df765 (patch) | |
tree | 606a03c3241b930303a8c257043c9cd802e6aa71 | |
parent | ccfe9139d574f37163c81d8c7d2c73d6a53d3ab1 (diff) |
modifications to url_title()
-rw-r--r-- | system/helpers/url_helper.php | 19 | ||||
-rw-r--r-- | user_guide/changelog.html | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index acf889007..002090df1 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -479,19 +479,20 @@ if ( ! function_exists('url_title')) }
$trans = array(
- $search => $replace,
- "\s+" => $replace,
- "[^a-z0-9".$replace."]" => '',
- $replace."+" => $replace,
- $replace."$" => '',
- "^".$replace => ''
- );
+ '&\#\d+?;' => '',
+ '&\S+?;' => '',
+ '\s+' => $replace,
+ '[^a-z0-9\-\._]' => '',
+ $replace.'+' => $replace,
+ $replace.'$' => $replace,
+ '^'.$replace => $replace
+ );
- $str = strip_tags(strtolower($str));
+ $str = strip_tags($str);
foreach ($trans as $key => $val)
{
- $str = preg_replace("#".$key."#", $val, $str);
+ $str = preg_replace("#".$key."#i", $val, $str);
}
return trim(stripslashes($str));
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 10c35e75b..75cb819bf 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -91,6 +91,8 @@ SVN Revision: XXXX</p> <li>Removed added newlines ("\n") from most form and html helper functions.</li>
<li>Tightened up validation in the <a href="helpers/date_helper.html">Date helper</a> function <kbd>human_to_unix()</kbd>, and eliminated the POSIX regex.</li>
<li>Updated <a href="helpers/date_helper.html">Date helper</a> to match the world's current time zones and offsets.</li>
+ <li>Modified url_title() in the <a href="helpers/url_helper.html">URL helper</a> to remove characters and digits that are part of
+ character entities, to allow dashes, underscores, and periods regardless of the $separator, and to allow uppercase characters.</li>
</ul>
</li>
<li>Other changes
|