Initial commit

Working directory listing. Hardcoded sidebar template.
This commit is contained in:
2011-01-16 22:59:18 +00:00
parent ee1707d86e
commit 65c560cdf0
20 changed files with 558 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<?php
abstract class MediaListing_FileObject {
const TYPE_File = 1;
const TYPE_Directory = 2;
protected $type;
protected $basename;
protected $path;
public static function create($path, $parent = null, $scan = true) {
if ( ! file_exists($path)) {
throw new MediaListing_Exception_FileNotFound($path);
}
switch (filetype($path)) {
case "file": {
return new MediaListing_File($path);
} break;
case "dir": {
return new MediaListing_Directory($path, $parent, $scan);
} break;
}
}
protected function __construct($type, $path) {
$this->type = $type;
$this->path = $path;
$this->basename = basename($path);
}
public function isFile() {
return $this->type == self::TYPE_File;
}
public function isDirectory() {
return $this->type == self::TYPE_Directory;
}
public function type() {
return $this->type;
}
public function path() {
return $this->path;
}
public function basename() {
return $this->basename;
}
}
?>