private function __construct() { // set date (need for save cache file in Windows) if (!date_default_timezone_get()) { date_default_timezone_set('Europe/Kiev'); } // set parameters self::$_rootDir = dirname(__FILE__) . '/'; // set template dir if (!isset(self::$_templateDir)) { self::setTemplateDir(self::$_rootDir . 'template'); } // set compile dir if (!isset(self::$_compileDir)) { self::setCompileDir(self::$_rootDir . 'compile'); } self::$_compiler = Templum::factory('Compiler'); // load interfaces and abstract classes self::_include('Component_Abstract'); self::_include('Component_Block_Abstract'); self::_include('Component_Function_Abstract'); self::_include('Component_Filter_Abstract'); self::_include('Component_Processor_Abstract'); }
/** * Execute instruction and return result. * * @param string $instruction Instruction name * @param array $params Parameters for instruction * @return string Parsed instruction content */ protected static function _handle($instruction, array $params, $content = '') { // create handler if (!isset(self::$_handlers[$instruction])) { $class = "Component_{$instruction}"; self::$_handlers[$instruction] = Templum::factory($class); } // handle instruction and return result return self::$_handlers[$instruction]->handle($params, $content); }