public function compile($key, $content) { $viewTemplate = Wind::getComponent('template'); $this->_router(); list($pageName, $unique) = $this->_pageName(); if (!$pageName && !$unique) { $content = str_replace('<pw-start/>', '', $content); $content = str_replace('<pw-end/>', '', $content); return $viewTemplate->compileStream($content, $this->windViewerResolver); } foreach ($this->windViewTemplate->getCompiledBlockData() as $key => $value) { $content = str_replace('#' . $key . '#', $value ? $value : '', $content); } Wind::import('SRV:design.srv.PwDesignCompile'); $this->srv = PwDesignCompile::getInstance(); //$this->srv = Wekit::load('design.srv.PwDesignCompile'); $this->srv->setIsDesign($this->getRequest()->getPost('design')); $_pk = $unique ? $this->getRequest()->getGet($unique) : ''; $this->srv->beforeDesign($this->_router, $pageName, $_pk); $pageBo = $this->srv->getPageBo(); $this->srv->setPermission(); //对模版进行编译 $portalSrv = new PwPortalCompile($pageBo); $isPortalCompile = $this->srv->isPortalCompile(); //对自定义页编辑 if ($isPortalCompile == 1) { $content = $portalSrv->compilePortal($content); } //对系统页编辑 if ($isPortalCompile == 2) { $content = $portalSrv->compileTpl($content, true); } else { $content = $portalSrv->compileTpl($content); } //$content = $portalSrv->doCompile($content); //转换Pw标签 $content = $this->compileStart($content, $_pk, $this->_url); $content = $this->compileSign($content); $content = $this->compileTemplate($content); //自定义页 $content = $this->compileDrag($content); $content = $this->compileTitle($content); $content = $this->compileList($content); $content = $this->compileCss($content, $pageBo); $content = $this->compileEnd($content, $pageBo); $content = $viewTemplate->compileStream($content, $this->windViewerResolver); /*if ($isPortalCompile > 0) { $this->srv->refreshPage(); }*/ return $content; }
private function _beforeDesign() { Wind::import('SRV:design.srv.PwDesignCompile'); $this->service = PwDesignCompile::getInstance(); //$this->service = Wekit::load('design.srv.PwDesignCompile'); //纠结的template标签 if (!isset($this->_router)) { $this->_router(); list($pageName, $unique) = $this->_pageName(); if (!$pageName && !$unique) { return false; } $this->service->setIsDesign($this->getRequest()->getPost('design')); $this->pk = $unique ? $this->getRequest()->getGet($unique) : ''; $this->service->beforeDesign($this->_router, $pageName, $this->pk); $this->service->setPermission(); } return true; }
public static function getInstance() { !isset(self::$_instance) && (self::$_instance = new self()); return self::$_instance; }