Example #1
0
 public function __construct(Config $config)
 {
     $this->fs = new Filesystem(new Local(__DIR__ . '/../../'));
     $this->latte = new \Latte\Engine();
     $this->latte->setTempDirectory('/tmp');
     $mdParser = '\\cebe\\markdown\\' . $config->syntax;
     $this->mdParser = new $mdParser();
     $this->mdParser->html5 = $config->html5;
 }
Example #2
0
 /**
  * @return  self
  */
 private function configure(array $config)
 {
     $configurator = new Configurator($config);
     $config = $configurator->getConfig();
     //$this->fs = new Filesystem(new Local(__DIR__ . '/../../'));
     $this->fs = new Filesystem(new Local('/'));
     $this->latte = new \Latte\Engine();
     $this->latte->setTempDirectory('/tmp');
     $mdParser = '\\cebe\\markdown\\' . $config['syntax'];
     $this->mdParser = new $mdParser();
     $this->mdParser->html5 = $config['html5'];
     return $this;
 }
Example #3
0
function renderLatte($path, $parameters = array())
{
    global $App;
    global $View;
    global $wp_query;
    global $post;
    $fullParameters = array('App' => $App, 'baseUrl' => toPath(WP_HOME), 'basePath' => toRelativePath(WP_HOME), 'assetsUrl' => toPath(WP_HOME) . '/assets', 'assetsPath' => toRelativePath(WP_HOME) . '/assets', 'wp_query' => $wp_query, 'post' => $post, 'flashes' => getFlashSession()->flash ?: []);
    foreach ($View as $key => $val) {
        $fullParameters[$key] = $val;
    }
    foreach ($parameters as $key => $val) {
        $fullParameters[$key] = $val;
    }
    $latte = new Latte\Engine();
    $latte->setTempDirectory(TEMP_DIR . '/cache/latte');
    MangoPressTemplatingMacroSet::install($latte->getCompiler());
    Nette\Bridges\FormsLatte\FormMacros::install($latte->getCompiler());
    MangoPressTemplatingFilterSet::install($latte);
    return $latte->render($path, (array) $fullParameters);
}
Example #4
0
 public function __construct($path, $cachePath)
 {
     if (is_file($cacheFile = $cachePath . '/routes.php')) {
         $routes = (require $cacheFile);
     } else {
         $routes = $this->scanRoutes($path);
         file_put_contents($cacheFile, '<?php return ' . var_export($routes, TRUE) . ';');
     }
     foreach ($routes as $mask => $file) {
         $this[] = new Routers\Route($mask, function ($presenter) use($file, $cachePath) {
             return $presenter->createTemplate(NULL, function () use($cachePath) {
                 $latte = new Latte\Engine();
                 $latte->setTempDirectory($cachePath . '/cache');
                 $macroSet = new Latte\Macros\MacroSet($latte->getCompiler());
                 $macroSet->addMacro('url', function () {
                 }, NULL, NULL, $macroSet::ALLOWED_IN_HEAD);
                 // ignore
                 return $latte;
             })->setFile($file);
         });
     }
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\xampp\\htdocs\\TransportCompany\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\Users\\Raiper34\\Desktop\\server\\root\\nette\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/richmond/vhosts/nette-test/sandbox/app/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     $service->onCompile = $this->container->getService('events.manager')->createEvent(array('Latte\\Engine', 'onCompile'), $service->onCompile, NULL, FALSE);
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/www/pps-eu.cz/www/asystem.pps-eu.cz/app/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     return $service;
 }
Example #9
0
use Zend\ServiceManager\ServiceLocatorInterface;
return array('factories' => array('Zf2Latte\\LatteStrategy' => function (ServiceLocatorInterface $sl) {
    return new \Zf2Latte\LatteStrategy($sl->get('Zf2Latte\\LatteRenderer'), $sl->get('Zf2Latte\\LatteResolver'), $sl->get('Zf2Latte\\LatteConfig'));
}, 'Zf2Latte\\LatteRenderer' => function (ServiceLocatorInterface $sl) {
    return new \Zf2Latte\LatteRenderer($sl->get('Latte\\Engine'), $sl->get('Zf2Latte\\LatteResolver'), $sl->get('Zf2Latte\\ZendHelpers'));
}, 'Zf2Latte\\ZendHelpers' => function (ServiceLocatorInterface $sl) {
    return new \Zf2Latte\ZendHelpers($sl->get('ViewHelperManager'));
}, 'Zf2Latte\\LatteResolver' => function (ServiceLocatorInterface $sl) {
    $config = $sl->get('config');
    return new \Zf2Latte\LatteResolver($config['view_manager'], $sl->get('Zf2Latte\\LatteConfig'));
}, 'Zf2Latte\\LatteConfig' => function (ServiceLocatorInterface $sl) {
    $config = $sl->get('config');
    $latteConfig = new \Zf2Latte\LatteConfig();
    foreach ($config['zf2_latte'] as $name => $value) {
        $latteConfig->{$name} = $value;
    }
    return $latteConfig;
}, 'Latte\\Engine' => function (ServiceLocatorInterface $sl) {
    /** @var \Zf2Latte\LatteConfig $config */
    $config = $sl->get('Zf2Latte\\LatteConfig');
    $engine = new \Latte\Engine();
    $engine->addFilter('translate', array($sl->get($config->translator_callback[0]), $config->translator_callback[1]));
    $engine->onCompile[] = function ($engine) {
        $set = \Latte\Macros\MacroSet::install($engine->getCompiler());
        $set->addMacro('href', NULL, NULL, 'echo \' href="\' . $helper->url(%node.args) . \'"\'');
    };
    $engine->setTempDirectory($config->temp_directory);
    $engine->setAutoRefresh($config->auto_refresh);
    return $engine;
}));
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/Applications/MAMP/htdocs/orbinet/app/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\Users\\prcharom\\Desktop\\EasyPHP-DevServer-14.1VC9\\data\\localweb\\nastenka\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\Program Files (x86)\\EasyPHP-DevServer-13.1VC11\\data\\localweb\\projects\\vcelyweb\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/fuca/Projects/www/sportsclub/tests/tmp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Kdyby\Translation\Latte\TranslateMacros::install($service->getCompiler());
     $service->addFilter('translate', array($this->container->getService('translation.helpers'), 'translate'));
     $service->addFilter('getTranslator', array($this->container->getService('translation.helpers'), 'getTranslator'));
     $service->onCompile = $this->container->getService('events.manager')->createEvent(array('Latte\\Engine', 'onCompile'), $service->onCompile);
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/users/mauricioschmitz/Sites/zf2-tutorial/public/mauricioschmitz/php/temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/www/jvitasek.cz/priority.jvitasek.cz/app/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\Users\\Hadi.k\\Dropbox\\vyvojraskaSekce\\WebDesign\\BrowserGameLikeRust\\src\\buildModule\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
Example #17
0
<?php

require __DIR__ . '/vendor/autoload.php';
define('TEMP_DIR', __DIR__ . '/temp');
define('TEMPLATES_DIR', __DIR__ . '/templates');
$latte = new Latte\Engine();
$latte->setTempDirectory(__DIR__ . '/temp');
$params = ['name' => 'Dominik', 'surname' => 'Harmim', 'birth' => '1997', 'users' => [['name' => 'Jan', 'email' => '*****@*****.**'], ['name' => 'Petr', 'email' => '*****@*****.**'], ['name' => 'David', 'email' => '*****@*****.**']]];
$latte->render(TEMPLATES_DIR . '/example.latte', $params);
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/vencs88/public_html/import_time/app/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
Example #19
0
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('E:\\xampp\\htdocs\\pskeleton\\tests/../temp/cache/latte');
     $service->setAutoRefresh(FALSE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/var/www/fakturace/app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
Example #21
0
 public function actionDoc($articleId)
 {
     try {
         $article = $this->articleFacade->findOneById($articleId);
         $latte = new \Latte\Engine();
         $latte->setTempDirectory("../temp/cache");
         $content["article"] = $article;
         $content["basePath"] = $this->getHttpRequest()->getUrl()->getBaseUrl();
         $result = $latte->renderToString(__DIR__ . "/templates/export/article/default.latte", $content);
         $fileName = \Nette\Utils\Strings::webalize($article->url);
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Content-Type: application/force-download");
         header("Content-Type: application/octet-stream");
         header("Content-Type: application/download");
         header("Content-Disposition: attachment;filename={$fileName}.doc");
         header("Content-Transfer-Encoding: binary ");
         echo $result;
         exit;
     } catch (EntityNotFoundException $ex) {
         \Tracy\Debugger::log($ex);
         $this->flashMessage("Požadovaný článek nebyl nalezen.", "alert-danger");
         $this->redirect("Articles:default");
     }
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\xampp\\htdocs\\MyWallet\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
Example #23
0
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/home/www/Git/nette/app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }
Example #24
0
 /**
  * Returns HTML code of panel.
  * @return mixed
  */
 public function getPanel()
 {
     if ($this->countAll === 0 && $this->hideEmpty) {
         return;
     }
     $this->processMessage();
     $latte = new \Latte\Engine();
     $latte->setTempDirectory($this->fileMailer->getTempDirectory());
     return $latte->renderToString(__DIR__ . '/MailPanel.latte', ['messages' => $this->messages, 'countNew' => $this->countNew, 'countAll' => $this->countAll, 'show' => $this->show]);
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('C:\\wamp\\www\\rocnikovy_projekt\\app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     return $service;
 }
 public function create()
 {
     $service = new Latte\Engine();
     $service->setTempDirectory('/www/plavbyolomouc.cz/rezervace.plavbyolomouc.cz/app/../temp/cache/latte');
     $service->setAutoRefresh(TRUE);
     $service->setContentType('html');
     Nette\Utils\Html::$xhtml = FALSE;
     return $service;
 }