Changeset 2036
- Timestamp:
- 01/02/2005 09:08:55 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions-formatting.php
r2018 r2036 206 206 207 207 function sanitize_title($title, $fallback_title = '') { 208 209 210 211 212 213 214 215 208 $title = strip_tags($title); 209 $title = apply_filters('sanitize_title', $title); 210 211 if (empty($title)) { 212 $title = $fallback_title; 213 } 214 215 return $title; 216 216 } 217 217 218 218 function sanitize_title_with_dashes($title) { 219 219 $title = strip_tags($title); 220 $title = remove_accents($title); 221 if (seems_utf8($title)) { 222 if (function_exists('mb_strtolower')) { 223 $title = mb_strtolower($title, 'UTF-8'); 224 } 225 $title = utf8_uri_encode($title); 226 } 227 228 $title = strtolower($title); 229 $title = preg_replace('/&.+?;/', '', $title); // kill entities 230 $title = preg_replace('/[^a-z0-9 _-]/', '', $title); 231 $title = preg_replace('/\s+/', '-', $title); 232 $title = preg_replace('|-+|', '-', $title); 233 $title = trim($title, '-'); 234 235 return $title; 220 $title = preg_replace('|%|', '', $title); 221 $title = remove_accents($title); 222 if (seems_utf8($title)) { 223 if (function_exists('mb_strtolower')) { 224 $title = mb_strtolower($title, 'UTF-8'); 225 } 226 $title = utf8_uri_encode($title); 227 } 228 229 $title = strtolower($title); 230 $title = preg_replace('/&.+?;/', '', $title); // kill entities 231 $title = preg_replace('/[^%a-z0-9 _-]/', '', $title); 232 $title = preg_replace('/\s+/', '-', $title); 233 $title = preg_replace('|-+|', '-', $title); 234 $title = trim($title, '-'); 235 236 return $title; 236 237 } 237 238
Note: See TracChangeset
for help on using the changeset viewer.