PHP Classes

File: src/twig.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Discretion  >  src/twig.php  >  Download  
File: src/twig.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Discretion
Show contact forms and deliver encrypted mail
Author: By
Last change:
Date: 4 months ago
Size: 711 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);
use
ParagonIE\Discretion\Discretion;

/**
 * This file contains the custom Twig functions that we use in our templates.
 */
$twig = Discretion::getTwig();

$twig->addFunction(
    new
Twig_Function(
       
'form_token',
        function (
string $lockTo = ''): string {
            return
Discretion::getAntiCSRF()->insertToken($lockTo);
        }
    )
);
$twig->addFunction(
    new
Twig_Function(
       
'get_config',
        function (
string $key = '') {
           
$settings = Discretion::getSettings();
            if (isset(
$settings[$key])) {
                return
$settings[$key];
            }
            return
null;
        }
    )
);

Discretion::setTwig($twig);

For more information send a message to info at phpclasses dot org.