function spawn() { // Main Dwoo object $dwoo = new Dwoo(); // The directory where compiled templates are located $dwoo->setCompileDir($this->_parser_compile_dir); $dwoo->setCacheDir($this->_parser_cache_dir); $dwoo->setCacheTime($this->_parser_cache_time); // Security $security = new MY_Security_Policy(); $security->setPhpHandling($this->_parser_allow_php_tags); $security->allowPhpFunction($this->_parser_allowed_php_functions); $dwoo->setSecurityPolicy($security); return $dwoo; }
/** * Spawns a new instance of Dwoo. * * @return object **/ protected function spawn() { if (is_writable($this->compile_dir)) { // Main Dwoo object $dwoo = new Dwoo(); // Set the directory of where to compile the files $dwoo->setCompileDir($this->compile_dir); // set security policy $security = new MY_Security_Policy(); // no PHP handline $security->setPhpHandling(1); $security->allowPhpFunction($this->allowed_functions); $dwoo->setSecurityPolicy($security); return $dwoo; } }
function spawn() { // try to create directory if it doesn't exist' // added by David McReynolds @ Daylight Studio 9/16/10 to prevent problems of axing the entire directory if (!is_dir($this->_parser_compile_dir)) { @mkdir($this->_parser_compile_dir, 0777, TRUE); chmodr($this->_parser_compile_dir, 0777); } if (is_writable($this->_parser_compile_dir)) { // Main Dwoo object $dwoo = new Dwoo(); // The directory where compiled templates are located $dwoo->setCompileDir($this->_parser_compile_dir); $dwoo->setCacheDir($this->_parser_cache_dir); $dwoo->setCacheTime($this->_parser_cache_time); // Security $security = new MY_Security_Policy(); $security->setPhpHandling($this->_parser_allow_php_tags); $security->allowPhpFunction($this->_parser_allowed_php_functions); $dwoo->setSecurityPolicy($security); return $dwoo; } }
/** * Renders a Dwoo template. * * @param $templateFilename string The name of a template file. * @param $data array Data to pass to the template. * * @see http://dwoo.org/ */ public function renderTemplate($templateFilename, $data) { $dwoo = new Dwoo(); $tpl = new Dwoo_Template_File($templateFilename); $compiler = new Dwoo_Compiler(); if (!file_exists(INSTRUCTIONCONTROL__CONFIG_DWOO_COMPILEDIR)) { mkdir(INSTRUCTIONCONTROL__CONFIG_DWOO_COMPILEDIR); } $dwoo->setCompileDir(INSTRUCTIONCONTROL__CONFIG_DWOO_COMPILEDIR); $dwoo->output($tpl, $data); }