From: <var...@us...> - 2014-10-15 16:14:51
|
Revision: 9268 http://sourceforge.net/p/phpwiki/code/9268 Author: vargenau Date: 2014-10-15 16:14:43 +0000 (Wed, 15 Oct 2014) Log Message: ----------- Revert __construct; remove unused class ListRegexExpand Modified Paths: -------------- trunk/lib/stdlib.php Modified: trunk/lib/stdlib.php =================================================================== --- trunk/lib/stdlib.php 2014-10-15 16:14:03 UTC (rev 9267) +++ trunk/lib/stdlib.php 2014-10-15 16:14:43 UTC (rev 9268) @@ -56,8 +56,6 @@ sort_file_mtime ($a, $b) class fileSet {fileSet($directory, $filepattern = false), getFiles($exclude='', $sortby='', $limit='') } - class ListRegexExpand { listMatchCallback($item, $key), - expandRegex ($index, &$pages) } glob_to_pcre ($glob) glob_match ($glob, $against, $case_sensitive = true) @@ -668,7 +666,7 @@ class Stack { - function __construct() + function Stack() { $this->items = array(); $this->size = 0; @@ -1349,7 +1347,7 @@ class fileSet { - function __construct($directory, $filepattern = false) + function fileSet($directory, $filepattern = false) { $this->_fileList = array(); $this->_pattern = $filepattern; @@ -1359,11 +1357,11 @@ $this->_case = !isWindows(); $this->_pathsep = '/'; - if (empty($directory)) { + if (empty($directory) or !file_exists($directory) or !is_dir($directory)) { return; // early return } - @$dir_handle = opendir($dir = $directory); + $dir_handle = opendir($dir = $directory); if (empty($dir_handle)) { return; // early return } @@ -1424,40 +1422,6 @@ } } -// File globbing - -// expands a list containing regex's to its matching entries -class ListRegexExpand -{ - public $match, $list, $index, $case_sensitive; - - function __construct(&$list, $match, $case_sensitive = true) - { - $this->match = $match; - $this->list = &$list; - $this->case_sensitive = $case_sensitive; - //$this->index = false; - } - - function listMatchCallback($item, $key) - { - $quoted = str_replace('/', '\/', $item); - if (preg_match('/' . $this->match . ($this->case_sensitive ? '/' : '/i'), - $quoted) - ) { - unset($this->list[$this->index]); - $this->list[] = $item; - } - } - - function expandRegex($index, &$pages) - { - $this->index = $index; - array_walk($pages, array($this, 'listMatchCallback')); - return $this->list; - } -} - // Convert fileglob to regex style: // Convert some wildcards to pcre style, escape the rest // Escape . \\ + * ? [ ^ ] $ ( ) { } = ! < > | : / This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |