From: Marcus Boerger Date: Sun, 30 Nov 2003 16:14:56 +0000 (+0000) Subject: Remove old files X-Git-Tag: php-5.0.0b3RC1~485 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01f52770028dd6a9c576c829205d46938d76b93a;p=php Remove old files --- diff --git a/ext/spl/examples/filter.inc b/ext/spl/examples/filter.inc deleted file mode 100755 index d01dd62845..0000000000 --- a/ext/spl/examples/filter.inc +++ /dev/null @@ -1,98 +0,0 @@ -rewind(); - } - $this->it = $it; - $this->regex = $regex; - $this->fetch(); - } - - /** - * Destruct the iterator. - */ - function __destruct() { - unset($this->it); - } - - /** - * Check whether a value can be accepted. - * - * @param value used to test - * @return whether input is acceptable - */ - protected function accept($value) { - return ereg($this->regex, $value); - } - - /** - * Fetch next element and store it. - */ - protected function fetch() { - $this->curr = false; - while ($this->it->hasMore()) { - $curr = $this->it->current(); - if ($this->accept($curr)) { - $this->curr = $curr; - return; - } - $this->it->next(); - }; - } - - /** - * Move to next element - */ - function next() { - $this->it->next(); - $this->fetch(); - } - - /** - * @return Whether more elements are available - */ - function hasMore() { - return $this->curr !== false; - } - - /** - * @return The current value - */ - function current() { - return $this->curr; - } - - /** - * hidden __clone - */ - protected function __clone() { - // disallow clone - } -} - -?> \ No newline at end of file diff --git a/ext/spl/examples/filter_tree.php b/ext/spl/examples/filter_tree.php deleted file mode 100755 index 8ee4cef556..0000000000 --- a/ext/spl/examples/filter_tree.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * Simply specify the path to tree with parameter . - * The regular expression is used to filter the tree. - * - * (c) Marcus Boerger - */ - -require_once("sub_dir.inc"); -require_once("filter.inc"); - -foreach(new filter(new sub_dir($argv[1]), $argv[2]) as $f) { - echo "$f\n"; -} - -?> \ No newline at end of file diff --git a/ext/spl/examples/sub_dir.inc b/ext/spl/examples/sub_dir.inc deleted file mode 100755 index 2e869e78d4..0000000000 --- a/ext/spl/examples/sub_dir.inc +++ /dev/null @@ -1,134 +0,0 @@ -cnt = 0; - $this->path = $path; - $this->nodots = $nodots; - $this->graph = $graph; - } - - /** - * Rewind the directory. - * - * @return void - */ - function rewind() { - while($this->cnt) { - unset($this->adir[$this->cnt--]); - } - $dir = new spl_dir($this->path); - $dir->path = ""; - $this->adir[1] = $dir; - $this->cnt = 1; - if ($this->nodots) { - while ($dir->hasMore()) { - $ent = $dir->current(); - if ($ent != '.' && $ent != '..') { - break; - } - $dir->next(); - } - } - } - - /** - * Move to net dir or file entry. - * - * @return void - */ - function next() { - if ($this->cnt) { - $dir = $this->adir[$this->cnt]; - $ent = $dir->current(); - $path = $dir->getPath().'/'.$ent; - if ($ent != '.' && $ent != '..' && is_dir($path)) { - $new = new spl_dir($path); - $new->path = $dir->path.$ent.'/'; - $new->cnt = $this->cnt++; - $this->adir[$this->cnt] = $new; - if ($this->nodots) { - $dir->has_more = false; - while ($new->hasMore()) { - $ent = $new->current(); - if ($ent != '.' && $ent != '..') { - $dir->has_more = true; - break; - } - $new->next(); - } - } else { - $dir->has_more = $dir->hasMore(); - } - } - $dir->next(); - } - } - - /** - * @return Whether more dirs or files entries are available. - */ - function hasMore() { - while ($this->cnt) { - $dir = $this->adir[$this->cnt]; - if ($dir->hasMore()) { - return true; - } - unset($this->adir[$this->cnt--]); - } - return false; - } - - /** - * @return The current dir or file entry. - */ - function current() { - if ($this->cnt) { - if ($this->graph) { - $prefix = ''; - for ($i = 1; $i < $this->cnt; $i++) { - $dir = $this->adir[$i]; - $prefix .= $dir->hasMore() ? '| ' : ' '; - } - $dir = $this->adir[$this->cnt]; - $ent = $dir->current(); - $prefix .= $dir->hasMore() ? '+-' : '\-'; - return $prefix . $ent; - } else { - $dir = $this->adir[$this->cnt]; - return $dir->path . $dir->current(); - } - } - throw new exception("No more elements available"); - } - - /** - * Hidden __clone - */ - protected function __clone() { - // disallow clone - } -} - -?> \ No newline at end of file