Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
 public function testTemplateGetSet()
 {
     $dwoo = new Dwoo(DWOO_COMPILE_DIR, DWOO_CACHE_DIR);
     $dwoo->setCacheTime(10);
     $tpl = new Dwoo_Template_String('foo');
     $tpl2 = new Dwoo_Template_File('./resources/test.html');
     $this->assertEquals(false, $tpl->getResourceIdentifier());
     $this->assertEquals('string', $tpl->getResourceName());
     $this->assertEquals('file', $tpl2->getResourceName());
     $this->assertEquals(hash('md4', 'foo'), $tpl->getUid());
 }