namespace Cubist\Util\Files;
use Cubist\Util\CommandLine;
+use Cubist\Util\Text;
class Files
{
}
}
+ public static function tidyName($f)
+ {
+ $f = Text::cleanUTF8($f, '-');
+ $path = explode('/', $f);
+ $file = array_pop($path);
+ $f = explode('.', $file);
+ if (count($f) > 1) {
+ $ext = array_pop($f);
+ $name = implode('-', $f);
+ } else {
+ $ext = null;
+ $name = $f[0];
+ }
+
+ $r = [];
+ foreach ($path as $p) {
+ $r[] = Text::str2URL($p);
+ }
+ $n = Text::str2URL($name);
+ if (!is_null($ext)) {
+ $n .= '.' . $ext;
+ }
+ $r[] = $n;
+ return implode('/', $r);
+ }
+
}
\ No newline at end of file