summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/url_helper.php27
1 files changed, 7 insertions, 20 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 9f4b85248..cdb6dae9c 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -478,27 +478,14 @@ if ( ! function_exists('url_title'))
{
function url_title($str, $separator = 'dash', $lowercase = FALSE)
{
- if ($separator == 'dash')
- {
- $search = '_';
- $replace = '-';
- }
- else
- {
- $search = '-';
- $replace = '_';
- }
+ $replace = $separator == 'dash' ? '-' : '_';
$trans = array(
- '&\#\d+?;' => '',
- '&\S+?;' => '',
- '\s+' => $replace,
- '[^a-z0-9\-\._]' => '',
- $replace.'+' => $replace,
- $replace.'$' => $replace,
- '^'.$replace => $replace,
- '\.+$' => ''
- );
+ '&.+?;' => '',
+ '[^a-z0-9 _-]' => '',
+ '\s+' => $replace,
+ $replace.'+' => $replace
+ );
$str = strip_tags($str);
@@ -512,7 +499,7 @@ if ( ! function_exists('url_title'))
$str = strtolower($str);
}
- return trim(stripslashes($str));
+ return trim($str, $replace);
}
}