WordPress.org

Make WordPress Core

Changeset 4710


Ignore:
Timestamp:
01/09/07 22:53:14 (8 years ago)
Author:
ryan
Message:

sanitize_file_name(). fixes #3382 #3554

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r4672 r4710  
    287287 
    288288    return $string; 
     289} 
     290 
     291function sanitize_file_name( $name ) { // Like sanitize_title, but with periods 
     292    $name = strtolower( $name ); 
     293    $name = preg_replace('/&.+?;/', '', $name); // kill entities 
     294    $name = str_replace( '_', '-', $name ); 
     295    $name = preg_replace('/[^a-z0-9\s-.]/', '', $name); 
     296    $name = preg_replace('/\s+/', '-', $name); 
     297    $name = preg_replace('|-+|', '-', $name); 
     298    $name = trim($name, '-'); 
     299    return $name; 
    289300} 
    290301 
  • trunk/xmlrpc.php

    r4667 r4710  
    837837        $data        = $args[3]; 
    838838 
    839         $name = sanitize_file( $data['name'] ); 
     839        $name = sanitize_file_name( $data['name'] ); 
    840840        $type = $data['type']; 
    841841        $bits = $data['bits']; 
Note: See TracChangeset for help on using the changeset viewer.