/** * Set base meta data and read the comment lines from the file head * * Usage example: * <code> * <?php * $file = '/phpdoc/en/reference/array/functions/next.xml'; * $FDEn = new FileData($file, false); * $file = '/phpdoc/de/reference/array/functions/next.xml'; * $FDTrans = new FileData($file, true); * ?> * </code> * * @param string $file File name to inspect * @param bool $isTrans Define if the specified file is a translation * @return void */ public function __construct($file, $isTrans) { self::$tags = implode('|', array('EN-Revision', 'Revision', 'Maintainer', 'Status', 'Credits', 'Rev-Revision', 'Reviewer')); $this->isTranslation = (bool) $isTrans; $this->data = array(); $handle = fopen($file, 'r'); for ($i = 0; $i <= 9 || feof($handle); ++$i) { $rawFile = trim(fgets($handle)); switch (substr($rawFile, 0, 4)) { case '<!--': $this->setMetaData($rawFile); break; case '<?xm': break; default: $i = 9; break; } } fclose($handle); $this->data['size'] = round(filesize($file) / 1024, 0); $this->data['mtime'] = filemtime($file); clearstatcache(); return; }