1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- /*
- |--------------------------------------------------------------------------
- | template.php 后台管理 功能 模板可视化管理
- |--------------------------------------------------------------------------
- */
- namespace MazeApp\Manage;
- use Maze;
- use Maze\Template\View;
- use MazeApp\Manage\Lib\Visual;
- Maze::load('manage/auth.init');
- class Template
- {
- /**
- * project
- *
- * @var string
- */
- private $project;
- /**
- * dir
- *
- * @var string
- */
- protected $type;
-
- /**
- * config
- *
- * @var array
- */
- protected $config;
- /**
- * __construct
- *
- * @return mixed
- */
- public function __construct()
- {
- $this->project = Maze::input('key');
- $this->type = Maze::input('type', 'config');
-
- $config = Maze::load('manage/project.get');
- if(isset($config[$this->project]))
- {
- $this->config = $config[$this->project];
- }
- }
-
- /**
- * index
- *
- * @return mixed
- */
- public function index()
- {
- # 读取当前的service
- $view = View::getInstance('home', $this->config['path'], $this->project);
- $content = $view->runing();
-
- $config = $view->result();
-
- if(strpos($content, '</body>') >= 0)
- {
- $content = str_replace('</body>', Visual::tool() . '</body>', $content);
- }
- else
- {
- $content = $content . Visual::tool();
- }
-
- return $content;
- }
- }
|