All pastes #355121 Raw Edit

Lejban

public php v1 · immutable
·published 2007-02-14 09:36 UTC
rendered paste body
class logparser{	var $_error;    function parse($dir)    {        $files = $this->_readFiles($dir);        if($files == false) {            return false;        }        foreach($files as $file) {            $return = array_merge($return, $this->_parseArray(file($file)));        }        return $return;                    }    function _parseArray($array)    {        foreach($line as $no => $array) {            $array[$no] = $this->_cleanLine($line);        }        return $array;    }    function _readFiles($dir)    {        if(!is_dir($dir)) {            $this->_error = 'Directory "' . $dir . '" does not exist.';            return false;        }        if(!is_readable($dir)) {            $this->_error = 'Directory "' . $dir . '" is not readable.';            return false;        }        $fileList = array();        $dirhandle = opendir($dir);        while($file = readdir($dirhandle)) {            if($file != '.' && $file != '..' && is_file($dir.'/'.$file)) {                $fileList[] = $dir.'/'.$file;            }        }    }    function _cleanLine($line) {        return $line;    }    function getError()    {        return $this->_error;    }}