clearCacheFiles() 공개 메소드

Clears the template cache files on the filesystem.
public clearCacheFiles ( )
예제 #1
0
 public function render($name, array $values = array())
 {
     if (defined('ENV_DEV')) {
         $this->engine->clearCacheFiles();
         $this->engine->clearTemplateCache();
     }
     return $this->engine->render($name . $this->suffix, $values);
 }
예제 #2
0
 /**
  * Initialise Twig
  *
  * @return void
  */
 protected function initTemplateEngine()
 {
     $this->loader = new \Twig_Loader_Filesystem($this->getTemplateDir());
     $this->twig = new \Twig_Environment($this->loader, array('cache' => $this->cacheDir));
     if ($this->isDev) {
         $this->twig->clearCacheFiles();
     }
 }
예제 #3
0
 /**
  * Clear the cache
  *
  * @return \phpbb\template\template
  */
 public function clear_cache()
 {
     if (is_dir($this->cachepath)) {
         $this->twig->clearCacheFiles();
     }
     return $this;
 }
예제 #4
0
 /**
  * sends content to the browser
  */
 function render($string, $template_vars = array())
 {
     $loader = new \Twig_Loader_Filesystem($this->templates);
     $twig = new \Twig_Environment($loader, array('cache' => __ROOT__ . '/cache/twig'));
     if (__DEV__) {
         $twig->clearCacheFiles();
     }
     echo $twig->render($string, $template_vars);
 }
예제 #5
0
 /**
  * @param $rootDir
  * @param $loader
  * @return Twig_Environment
  */
 protected function getTwig($rootDir, $loader)
 {
     $twig = new Twig_Environment($loader, array('cache' => $rootDir . '/cache/'));
     $twig->clearCacheFiles();
     $f = new Twig_SimpleFunction("querify", function ($data) {
         $string = array();
         foreach ($data as $d) {
             $string[] = urlencode($d->key) . "=" . urlencode($d->value);
         }
         return implode("&", $string);
     });
     $twig->addFunction("querify", $f);
     $f = new Twig_SimpleFunction("prettify", function ($data) {
         return json_encode(json_decode($data), JSON_PRETTY_PRINT);
     });
     $twig->addFunction("prettify", $f);
     return $twig;
 }
예제 #6
0
 */
include_once '../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\DomCrawler\Crawler;
use Evista\Perform\Service;
use Evista\Perform\Exception\FormFieldException;
date_default_timezone_set('Europe/Budapest');
$router = new League\Route\RouteCollection();
$loader = new Twig_Loader_Filesystem('../src/views');
$crawler = new Crawler();
// Initialize form transpilation service (dependency injection friendly interface)
$formService = new Service($crawler, '../var/uploads');
$twig = new Twig_Environment($loader, array('cache' => '../var/cache'));
$twig->clearCacheFiles();
$router->addRoute('GET', '/', function (Request $request, Response $response) use($twig) {
    // do something clever
    $response = new Response($twig->render('form.twig.html', []));
    return $response;
});
$router->addRoute('POST', '/displayform', function (Request $request, Response $response) use($twig, $crawler, $formService) {
    $formMarkup = $request->request->get('serform');
    $form = $formService->transpileForm($formMarkup);
    // Dump the object
    $response = new JsonResponse(['dump' => var_export($form, true)]);
    return $response;
});
// Use form data
$router->addRoute('POST', '/multiple-file-uploads', function (Request $request, Response $response) use($twig, $crawler, $formService) {
    $formMarkup = urldecode($request->request->get('serform'));
예제 #7
0
 /**
  * Очистка кеша шаблонов
  */
 public static function clearCacheFiles()
 {
     self::$twigEnvironment->clearCacheFiles();
 }
예제 #8
0
 /**
  * [clearCacheFiles description]
  * @return [type] [description]
  */
 public function clearCacheFiles()
 {
     $this->twig->clearCacheFiles();
 }
예제 #9
0
 /**
  * @return void
  */
 public function clearCache()
 {
     $E = new \Twig_Environment(null, array('cache' => realpath(__DIR__ . self::$Cache)));
     $E->clearCacheFiles();
     $E->clearTemplateCache();
 }
예제 #10
0
 /**
  * {@inheritdoc}
  */
 public function reset()
 {
     $this->twig->clearCacheFiles();
     $this->twig->clearTemplateCache();
 }