public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/inc/twig.inc.php
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
<?php
3
use Twig\Environment;
4
use Twig\Loader\FilesystemLoader;
5
use Twig\TwigFilter;
6
use Twig\TwigFunction;
8
$loader = new FilesystemLoader($_SERVER['DOCUMENT_ROOT'].'/templates');
9
$twig = new Environment($loader, [
10
'debug' => $DEV_MODE,
11
'cache' => $_SERVER['DOCUMENT_ROOT'].'/templates/cache',
12
]);
14
// functions
15
$twig->addFunction(new TwigFunction('query_string', function (array $params = []) {
16
$allowed = ['lang', 'mobileconfig'];
17
$filtered = array_intersect_key($_GET, array_flip($allowed));
18
return http_build_query(array_merge($filtered, $params));
19
}));
21
$twig->addFunction(new TwigFunction('is_uri', function (string $uri, string $where = null) {
22
if (is_null($where)) $where = $_SERVER['REQUEST_URI'];
23
return preg_match('/'.$uri.'/i', $where);
24
}));
26
// filters
27
$twig->addFilter(new TwigFilter('rot13', 'str_rot13'));
28
$twig->addFilter(new TwigFilter('base64_encode', 'base64_encode'));
29
$twig->addFilter(new TwigFilter('formatBytes', 'formatBytes'));