WordPress.org

Make WordPress Core

Ticket #3382: patch.txt

File patch.txt, 680 bytes (added by donncha, 8 years ago)
Line 
1--- formatting.bak      2006-11-22 16:42:16.000000000 +0000
2+++ formatting.php      2006-11-23 11:17:18.105179850 +0000
3@@ -278,6 +278,17 @@
4        return $string;
5 }
6 
7+function sanitize_file( $name ) { // Like sanitize_title, but with periods
8+       $name = strtolower( $name );
9+       $name = preg_replace('/&.+?;/', '', $name); // kill entities
10+       $name = str_replace( '_', '-', $name );
11+       $name = preg_replace('/[^a-z0-9\s-.]/', '', $name);
12+       $name = preg_replace('/\s+/', '-', $name);
13+       $name = preg_replace('|-+|', '-', $name);
14+       $name = trim($name, '-');
15+       return $name;
16+}
17+
18 function sanitize_user( $username, $strict = false ) {
19        $raw_username = $username;
20        $username = strip_tags($username);