Ejemplo n.º 1
0
 /**
  * Cleans the file name
  *
  * @param $filename
  *
  * @return string
  */
 public function clean_file_name($filename)
 {
     // Remove bad chars
     $filename = parent::clean_file_name($filename);
     // Spaces
     if ($this->remove_spaces == TRUE) {
         $filename = preg_replace("/\\s+/", "_", $filename);
     }
     // Foreign chars
     if ($this->clean_foreign_chars) {
         $filename = convert_accented_characters($filename);
     }
     $filename = preg_replace('/[^a-zA-Z0-9\\/_.|+ -]/', "_", $filename);
     $filename = preg_replace("/[\\/_|+ -]+/", "_", $filename);
     // Remove first and last not wanted chars
     $filename = trim($filename, '_-. ');
     return $filename;
 }