From fd275707f6c1a5a63feb8708731d7c97683df765 Mon Sep 17 00:00:00 2001
From: Derek Jones
Date: Fri, 10 Oct 2008 22:37:06 +0000
Subject: modifications to url_title()
---
system/helpers/url_helper.php | 19 ++++++++++---------
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
Removed added newlines ("\n") from most form and html helper functions.
Tightened up validation in the Date helper function human_to_unix(), and eliminated the POSIX regex.
Updated Date helper to match the world's current time zones and offsets.
+ Modified url_title() in the URL helper 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.
Other changes
--
cgit v1.2.3-24-g4f1b