/** * @param Ethna_Controller $controller */ public function __construct($controller) { parent::__construct($controller); $this->setTemplateDir($controller->getTemplatedir()); $this->setCompileDir($controller->getDirectory('template_c')); $this->loadEngine($this->config); }
/** * Ethna_Renderer_Rhacoクラスのコンストラクタ * * @access public */ public function __construct($controller) { parent::__construct($controller); $this->template_dir = $controller->getTemplatedir() . '/'; $this->compile_dir = $controller->getDirectory('template_c'); Rhaco::constant('TEMPLATE_PATH', $this->template_dir); $this->engine = new TemplateParser_Ethna(); /* $this->setTemplateDir($template_dir); $this->compile_dir = $compile_dir; */ $this->engine->template_dir = $this->template_dir; $this->engine->compile_dir = $this->compile_dir; $this->engine->compile_id = md5($this->template_dir); // 一応がんばってみる if (is_dir($this->engine->compile_dir) === false) { Ethna_Util::mkdir($this->engine->compile_dir, 0755); } $this->_setDefaultPlugin(); }
/** * プラグインをセットする * * @param string $name プラグイン名 * @param string $type プラグインタイプ * @param mixed $plugin プラグイン本体 * * @access public */ function setPlugin($name, $type, $plugin) { //プラグイン関数の有無をチェック if (is_callable($plugin) === false) { return Ethna::raiseWarning('Does not exists.'); } //プラグインの種類をチェック $register_method = 'register_' . $type; if (method_exists($this->engine, $register_method) === false) { return Ethna::raiseWarning('This plugin type does not exist'); } // フィルタは名前なしで登録 if ($type === 'prefilter' || $type === 'postfilter' || $type === 'outputfilter') { parent::setPlugin($name, $type, $plugin); $this->engine->{$register_method}($plugin); return; } // プラグインの名前をチェック if ($name === '') { return Ethna::raiseWarning('Please set plugin name'); } // プラグインを登録する parent::setPlugin($name, $type, $plugin); $this->engine->{$register_method}($name, $plugin); }
public function test_Name() { $this->assertEqual('mock', $this->renderer->getName()); $r = new Ethna_Renderer(new Ethna_Controller()); $this->assertEqual('ethna', $r->getName()); }