*/ /** * @class pageView * @author NAVER (developers@xpressengine.com) * @brief page view class of the module */ class pageView extends page { var $module_srl = 0; var $list_count = 20; var $page_count = 10; var $cache_file; var $interval; var $path; /** * @brief Initialization */ function init() { switch($this->module_info->page_type) { case 'WIDGET' : { $this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", RX_BASEDIR, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus()); $this->interval = (int)($this->module_info->page_caching_interval ?? 0); break; } case 'OUTSIDE' : { $this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", RX_BASEDIR, $this->module_info->module_srl, Context::getSslStatus()); $this->interval = (int)($this->module_info->page_caching_interval ?? 0); $this->path = $this->module_info->path; break; } } } /** * @brief General request output */ function dispPageIndex() { // Variables used in the template Context:: set() if($this->module_srl) Context::set('module_srl',$this->module_srl); $page_type_name = strtolower($this->module_info->page_type); $method = '_get' . ucfirst($page_type_name) . 'Content'; if(method_exists($this, $method)) { $page_content = $this->{$method}(); } else { throw new Rhymix\Framework\Exception(sprintf('%s method is not exists', $method)); } Context::set('module_info', $this->module_info); Context::set('page_content', $page_content); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('content'); } function _getWidgetContent() { if($this->interval>0) { if(!file_exists($this->cache_file)) $mtime = 0; else $mtime = filemtime($this->cache_file); if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME']) { $page_content = FileHandler::readFile($this->cache_file); $page_content = str_replace('' . PHP_EOL; $contents = sprintf($sign, 'start') . $contents . sprintf($sign, 'end'); } return $contents; } function _replacePath($matches) { $val = trim($matches[3]); // Pass if the path is external or starts with /, #, { characters // /=absolute path, #=hash in a page, {=Template syntax if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val)) { return $matches[0]; // In case of .. , get a path } else if(strncasecmp('..', $val, 2) === 0) { $p = Context::pathToUrl($this->path); return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); } if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2); $p = Context::pathToUrl($this->path); $path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); return $path; } } /* End of file page.view.php */ /* Location: ./modules/page/page.view.php */