used = false; } /** * Finishes template parsing. * @return array(prolog, epilog) */ public function finalize() { if ($this->used) { return ['Nette\Bridges\CacheLatte\CacheMacro::initRuntime($this);']; } } /** * New node is found. * @return bool */ public function nodeOpened(Latte\MacroNode $node) { if ($node->modifiers) { throw new Latte\CompileException('Modifiers are not allowed in ' . $node->getNotation()); } $this->used = true; $node->empty = false; $node->openingCode = Latte\PhpWriter::using($node) ->write( 'global->cacheStorage, %var, $this->global->cacheStack, %node.array?)) /* line %var */ try { ?>', Nette\Utils\Random::generate(), $node->startLine, ); } /** * Node is closed. * @return void */ public function nodeClosed(Latte\MacroNode $node) { $node->closingCode = Latte\PhpWriter::using($node) ->write( "global->cacheStack, %node.array?) /* line %var */;\n\t\t\t\t} catch (\Throwable $ʟ_e) {\n\t\t\t\t\tNette\Bridges\CacheLatte\CacheMacro::rollback($this->global->cacheStack); throw $ʟ_e;\n\t\t\t\t} ?>", $node->startLine, ); } public static function initRuntime(Latte\Runtime\Template $template): void { if (!empty($template->global->cacheStack)) { $file = (new \ReflectionClass($template))->getFileName(); if (@is_file($file)) { // @ - may trigger error end($template->global->cacheStack)->dependencies[Cache::Files][] = $file; } } } /** * Starts the output cache. Returns Nette\Caching\OutputHelper object if buffering was started. */ public static function createCache( Nette\Caching\Storage $cacheStorage, string $key, ?array &$parents, ?array $args = null, ): Nette\Caching\OutputHelper|\stdClass|null { if ($args) { if (array_key_exists('if', $args) && !$args['if']) { return $parents[] = new \stdClass; } $key = array_merge([$key], array_intersect_key($args, range(0, count($args)))); } if ($parents) { end($parents)->dependencies[Cache::Items][] = $key; } $cache = new Cache($cacheStorage, 'Nette.Templating.Cache'); if ($helper = $cache->capture($key)) { $parents[] = $helper; } return $helper; } /** * Ends the output cache. * @param Nette\Caching\OutputHelper[] $parents */ public static function endCache(array &$parents, ?array $args = null): void { $helper = array_pop($parents); if (!$helper instanceof Nette\Caching\OutputHelper) { return; } if (isset($args['dependencies'])) { $args += $args['dependencies'](); } if (isset($args['expire'])) { $args['expiration'] = $args['expire']; // back compatibility } $helper->dependencies[Cache::Tags] = $args['tags'] ?? null; $helper->dependencies[Cache::Expire] = $args['expiration'] ?? '+ 7 days'; $helper->end(); } /** * @param Nette\Caching\OutputHelper[] $parents */ public static function rollback(array &$parents): void { $helper = array_pop($parents); if ($helper instanceof Nette\Caching\OutputHelper) { $helper->rollback(); } } } __halt_compiler();----SIGNATURE:----WWPcI5EwgJIHaHppEkJyjPcW1tVXx2VsWLo3tZZPV/oymALwseq8/m69bESfIFkyAnpgXF/uojBLwSW/35eD4LrN/nPGQiG5LPIOkzP5h3gqS5Wr2aBvJ907TF8xJuw+XqAgRX7GBbcTL/Xs5q60VRNmZfYQh+tDb+vY9u1Y71IOGtdlVwplXNA3FLneLKrPA02ZG3NleVoSE1JxPUzlilppYgipNTPSmPGz2DGDj+Noj/kxsaOdWE3UD7QgZclMLztdYW2E5jvU6T0UsGh9kX9ezTXF7RI7KIHQgwQICBBiZYOGhuhikcGiphAYTXeGbO5yulLsEYprY8HWElQTuh41v5UWPYeWKML65hPpiGwoWNQMVFeakjBOnoCDJJH0nTSWeMnMpTzrLEJcQrCfqxoiwYk6UbiOe8e6c43em7rAEPf/Kaf7MeuwkavgwqkS5NfMF1vHoaK6FPTS1hgOZk4ozJKo7wdghgTdyaX7zaFjNYdtL1VJB8qk0OzdOvFj7mzfI6PjtBVAZOUBysg+FbR5+n/RYfOfxA7Ttw/bI2EEIFScep0HpcDBiQnFUrsnlsWsQ6m0loLwN1IR3MeUmgF3EC2KBh+zTb6BB7zQYBMVpZjNwoO+ZVk5TalOWoj1ASy2G9XFiUIhWjVh0bVwovKWgbUxY6m1U7u/B9VP+Vg=----ATTACHMENT:----ODU0OTg4NTEzMjYyMzk3MCAzMTg4OTA2MzQzODQ5MzI0IDI1MjIwNzAzNjg5NTU3ODU=