Add santize_title action.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-05-16 22:14:14 +00:00
parent c454490973
commit d262c2d8cb
1 changed files with 4 additions and 2 deletions

View File

@ -81,16 +81,18 @@ function wpautop($pee, $br = 1) {
function sanitize_title($title) { function sanitize_title($title) {
$title = strtolower($title); $title = strtolower($title);
$title = preg_replace('/&.+?;/', '', $title); // kill entities $title = preg_replace('/&.+?;/', '', $title); // kill entities
$title = preg_replace('/[^a-z0-9 -]/', '', $title); $title = preg_replace('/[^a-z0-9 _-]/', '', $title);
$title = preg_replace('/\s+/', ' ', $title);
$title = do_action('sanitize_title', $title); $title = do_action('sanitize_title', $title);
$title = trim($title); $title = trim($title);
return $title; return $title;
} }
function convert_spaces_to_dashes($content) { function convert_spaces_to_dashes($content) {
$content = preg_replace('/\s+/', ' ', $content);
$content = str_replace(' ', '-', $content); $content = str_replace(' ', '-', $content);
$content = preg_replace('|-+|', '-', $content); $content = preg_replace('|-+|', '-', $content);
return $content;
} }
function convert_chars($content, $flag = 'obsolete') { function convert_chars($content, $flag = 'obsolete') {