public function init() { //缓存静态资源版本 $version = Cache\Cache::ins()->fetch('VERSION'); if ($version === false) { $version = time(); Cache\Cache::ins()->save('VERSION', $version, 604800); } $this->_view->staticVersion = $version; //ace skin $this->_view->aceSkin = htmlspecialchars($this->getRequest()->getCookie('ace_skin', 'no-skin')); $this->_view->config = Yaf\Registry::get('config'); }
/** * Get the path of a file by id, relative to the view * * Note that the resulting path is not guarantied to be unique for the id, multiple paths can point to the same file * * @param int $id * @return string */ public function getPath($id) { list($storage, $internalPath) = Cache\Cache::getById($id); $mounts = Mount::findByStorageId($storage); foreach ($mounts as $mount) { /** * @var \OC\Files\Mount $mount */ $fullPath = $mount->getMountPoint() . $internalPath; if (!is_null($path = $this->getRelativePath($fullPath))) { return $path; } } return null; }