Esempio n. 1
0
 function __construct($file = null, $vars = null, $devTemplate = true, $devJs = true, $devCss = true, $devImg = false, Di $di, $httpMtime = false, $httpEtag = false, $httpExpireTime = false)
 {
     parent::__construct($file, $vars, $devTemplate, $devJs, $devCss, $devImg);
     $this->di = $di;
     $this->httpMtime = $httpMtime;
     $this->httpEtag = $httpEtag;
     $this->httpExpireTime = $httpExpireTime;
     $this->toolbox = $this->di->get(Toolbox::class);
     $this->onCompile(function ($tml) {
         if ($tml->templix->getParent()) {
             return;
         }
         if (!$tml->devTemplate) {
             $this->toolbox->autoMIN($tml);
         }
     });
     $this->setCleanCallback([$this, 'cleanMin']);
 }
Esempio n. 2
0
 function getClass($n)
 {
     $n = str_replace(' ', '_', ucwords(preg_replace("/[^A-Za-z0-9 ]/", ' ', $n)));
     if ($this->templix) {
         $prefixs = $this->templix->getPluginPrefix();
     } else {
         $prefixs = Templix::getPluginPrefixDefault();
     }
     foreach ($prefixs as $ns) {
         if (false !== ($p = strrpos($n, ':'))) {
             $c = $ns . ucfirst(str_replace(' ', '\\', ucwords(str_replace('.', ' ', substr($n, 0, $p))))) . '\\' . self::prefixClassName(ucfirst(substr($n, $p + 1)));
             if (class_exists($c)) {
                 return $c;
             }
         } elseif (class_exists($c = $ns . self::prefixClassName(ucfirst($n)))) {
             return $c;
         }
     }
     return __NAMESPACE__ . '\\Markup';
 }