public function clean($delimiter = '-')
    {
        // The fileextension should not be normalized.
        if (strrpos($this->filename, '.') !== false) {
            list ($name, $extension) = explode('.', $this->filename);
        }

        $normalize = new Normalize($name);

        $name = $normalize->normalize();
        $name = preg_replace('/[^[:alnum:]\-]+/', $delimiter, $name);
        $name = preg_replace('/' . $delimiter . '+/', $delimiter, $name);
        $name = rtrim($name, $delimiter);

        $cleaned = isset($extension) ? $name . '.' . $extension : $name;

        return $cleaned;
    }
public function clean($delimiter = '-')
    {
        // The fileextension should not be normalized.
        if (strrpos($this->filename, '.') !== false) {
            list ($name, $extension) = explode('.', $this->filename);
        }

        $normalize = new Normalize($name);

        $name = $normalize->normalize();
        $name = preg_replace('/[^[:alnum:]\-]+/', $delimiter, $name);
        $name = preg_replace('/' . $delimiter . '+/', $delimiter, $name);
        $name = rtrim($name, $delimiter);

        $cleaned = isset($extension) ? $name . '.' . $extension : $name;

        return $cleaned;
    }
public function clean ( $ delimiter = '-' ) { // The fileextension should not be normalized. if ( strrpos ( $ this -> filename , '.' ) !== false ) { list ( $ name , $ extension ) = explode ( '.' , $ this -> filename ) ; } $ normalize = new Normalize ( $ name ) ; $ name = $ normalize -> normalize ( ) ; $ name = preg_replace ( '/[^[:alnum:]\-]+/' , $ delimiter , $ name ) ; $ name = preg_replace ( '/' . $ delimiter . '+/' , $ delimiter , $ name ) ; $ name = rtrim ( $ name , $ delimiter ) ; $ cleaned = isset ( $ extension ) ? $ name . '.' . $ extension : $ name ; return $ cleaned ; }
Cleans up a filename string from all characters which can make trouble on filesystems.

@param string $name
The string to cleanup
@param string $delimiter

@return string
Cleans up a filename string from all characters which can make trouble on filesystems .