public function getDocBookStack() { if (!isset($this->cache['docbook_stack'])) { $truefile = $this; $filepath = $truefile->getRealPath(); if ($this->isLink() || $this->isRootLink()) { if ($this->isLink()) { try { $rp_tmp = realpath($this->getLinkTarget()); } catch (\Exception $e) { } if (empty($rp_tmp)) { $rp_tmp = $this->getRealPath(); } $truefile = new WebFileInfo($rp_tmp); } elseif ($this->isRootLink()) { try { $rp_tmp = @readlink($this->getPathname()); } catch (\Exception $e) { } if (empty($rp_tmp)) { $rp_tmp = $this->getRealPath(); } $truefile = new WebFileInfo($rp_tmp); } } $_size = $truefile->isDir() ? Helper::getDirectorySize($truefile->getPathname()) : $truefile->getSize(); $this->cache['docbook_stack'] = array('path' => $this->getDocBookPath(), 'type' => $this->getType(), 'route' => Helper::getRoute($this->getRealPath()), 'name' => $this->getHumanReadableFilename(), 'size' => WebFilesystem::getTransformedFilesize($_size), 'plainsize' => $_size, 'mtime' => WebFilesystem::getDateTimeFromTimestamp($truefile->getMTime()), 'description' => $this->getDescription(), 'trans' => $this->isDir() ? array() : $this->findTranslations(), 'dirpath' => dirname($this->getPathname()), 'lines_nb' => $this->isDir() ? null : Helper::getFileLinesCount($this->getRealPath()), 'extension' => $this->getExtension()); } return $this->cache['docbook_stack']; }
public function getChapters() { $www_http = $this->getPath('base_dir_http'); $dir = new DocBookRecursiveDirectoryIterator($www_http); $paths = array(); foreach ($dir as $file) { if ($file->isDir()) { $paths[] = array('path' => Helper::getSecuredRealpath($file->getRealPath()), 'route' => Helper::getRoute($file->getDocBookPath()), 'name' => $file->getHumanReadableFilename()); } } return $paths; }