View.php 821 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Public Printer Control System
  4. *
  5. * Copyright © 2018 - 2019, Aaron Speer, aaron.speerfamily.ie ajamesspeer@gmail.com.
  6. * All Rights Reserved.
  7. */
  8. function viewError($name, $content, $type) {
  9. return "<div class='alert alert-" . $type . "'> <a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a>" . "<strong>" . $name . "</strong> " . $content . "</div>";
  10. }
  11. $function = new Twig_SimpleFunction('makeError', 'viewError');
  12. $twig->addFunction($function);
  13. $twig->addFunction(
  14. new \Twig_SimpleFunction(
  15. 'form_token',
  16. function($lock_to = null) {
  17. static $csrf;
  18. if ($csrf === null) {
  19. $csrf = new AntiCSRF;
  20. }
  21. return $csrf->insertToken($lock_to, false);
  22. },
  23. ['is_safe' => ['html']]
  24. )
  25. );