From d262c2d8cb2a6d0df8162025aa58259e1023649f Mon Sep 17 00:00:00 2001 From: rboren Date: Sun, 16 May 2004 22:14:14 +0000 Subject: [PATCH] Add santize_title action. git-svn-id: http://svn.automattic.com/wordpress/trunk@1290 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 21f70b5b4..c3862beee 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -81,16 +81,18 @@ function wpautop($pee, $br = 1) { function sanitize_title($title) { $title = strtolower($title); $title = preg_replace('/&.+?;/', '', $title); // kill entities - $title = preg_replace('/[^a-z0-9 -]/', '', $title); - $title = preg_replace('/\s+/', ' ', $title); + $title = preg_replace('/[^a-z0-9 _-]/', '', $title); $title = do_action('sanitize_title', $title); $title = trim($title); return $title; } function convert_spaces_to_dashes($content) { + $content = preg_replace('/\s+/', ' ', $content); $content = str_replace(' ', '-', $content); $content = preg_replace('|-+|', '-', $content); + + return $content; } function convert_chars($content, $flag = 'obsolete') {