Example #1
0
 public static function create()
 {
     if (self::$instance === null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 protected function makeCompileFile($template, $compiledPath)
 {
     if ((ENVIRONMENT & PRODUCTION) > 0) {
         if (is_readable($compiledPath)) {
             return;
         }
     }
     $regex = '/<\\?(.)?\\s(.+)\\s\\?>/U';
     $template = Renderer_Sabel_Replacer::create()->execute($template);
     $template = preg_replace_callback($regex, '_sbl_tpl_pipe_to_func', $template);
     if (defined("URI_IGNORE")) {
         $images = "jpg|gif|bmp|tiff|png|swf|jpeg|css|js";
         $quote = '"|\'';
         $pat = "@(({$quote})/[\\w-_/.]*(\\.({$images}))({$quote}))@";
         $template = preg_replace($pat, '"<?= linkto($1) ?>"', $template);
     }
     $template = str_replace('<?=', '<? echo', $template);
     $template = preg_replace('/<\\?(?!xml|php)/', '<?php', $template);
     $template = str_replace('<?xml', '<<?php echo "?" ?>xml', $template);
     $fs = new Sabel_Util_FileSystem();
     if ($fs->isFile($compiledPath)) {
         $fs->remove($compiledPath);
     }
     $fs->mkfile($compiledPath)->write($template)->save();
 }