Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function macroTimestamp(Latte\MacroNode $node, Latte\PhpWriter $writer)
- {
- $class = get_called_class();
- return $writer->write('echo %escape(' . $class . '::timestamp(%node.arg, $_presenter->context->parameters['wwwDir']);');
- }
- public static function timestamp($file, $wwwDir)
- {
- $filepath = realpath($wwwDir . '/' . $node->args);
- if (file_exists($filepath)) {
- $mtime = filemtime($filepath);
- $mtime = dechex($mtime);
- } else {
- $mtime = 0; // Fail silently
- }
- return $filepath . '?' . $mtime;
- }
Advertisement
Add Comment
Please, Sign In to add comment