Пример #1
0
 /**
  * Generates a new filename for a given name
  * and makes sure to handle badly given extensions correctly
  * 
  * @param string $name
  * @return string
  */
 public function createNewFilename($name, $safeName = true)
 {
     $name = basename($safeName ? f::safeName($name) : $name);
     $ext = f::extension($name);
     // remove possible extensions
     if (in_array($ext, f::extensions())) {
         $name = f::name($name);
     }
     return trim($name . '.' . $this->extension(), '.');
 }