Esempio n. 1
0
 public function __construct($path = '')
 {
     parent::__construct();
     if (function_exists('mb_internal_charset')) {
         mb_internal_charset('UTF-8');
     }
     $this->engine = new \Latte\Engine();
     $this->path = $path ?: Manager::getPublicPath() . '/templates';
     $this->engine->setTempDirectory(Manager::getFrameworkPath() . '/var/templates');
     $this->engine->getParser()->defaultSyntax = 'double';
     $this->engine->addFilter('translate', function ($s) {
         return _M($s);
     });
     $this->context = array();
     $this->context('manager', Manager::getInstance());
 }
Esempio n. 2
0
 public function addStyleSheetCode($code)
 {
     if (Manager::isAjaxCall()) {
         $fileName = md5($code) . '.css';
         $file = Manager::getFrameworkPath('var/files/' . $fileName);
         file_put_contents($file, $code);
         $url = Manager::getDownloadURL('cache', $fileName, true);
         $this->onLoad("\$('head').append('<link href=\"{$url}\" type=\"text/css\" rel=\"stylesheet\" />');");
     } else {
         $this->styleSheetCode .= "\n" . $code;
     }
 }