From 49527093ec248b940f5fe5d615fe07628b4c1af1 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Sat, 25 Oct 2003 22:05:38 +0000 Subject: [PATCH] New title functions. git-svn-id: https://develop.svn.wordpress.org/trunk@465 602fd350-edb4-49c9-b593-d223f7449a82 --- b2-include/b2functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index fe29de2fa3..a0621dd391 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -86,6 +86,16 @@ function wpautop($pee, $br=1) { return $pee; } +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 = trim($title); + $title = str_replace(' ', '-', $title); + return $title; +} + function popuplinks($text) { // Comment text in popup windows should be filtered through this. // Right now it's a moderately dumb function, ideally it would detect whether