diff options
| author | horus | 2021-03-12 23:33:11 +0100 |
|---|---|---|
| committer | horus | 2021-03-12 23:33:11 +0100 |
| commit | 1730e54d3423a8d0ab3a2bd9791575b59ab399cc (patch) | |
| tree | bc4e3f8d6360f35f787ee31b9091cc75ec2a6bf0 /app.php | |
| parent | 14e75d123ebc16bbefe6d305181eafe3d4df6333 (diff) | |
| download | moehring-1730e54d3423a8d0ab3a2bd9791575b59ab399cc.tar.gz | |
Add faces as submodule
Diffstat (limited to 'app.php')
| -rw-r--r-- | app.php | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -7,7 +7,7 @@ $twig = new \Twig\Environment($loader); # no cache $function = new \Twig\TwigFunction('is_active', function($route) { $url = strtok($_SERVER["REQUEST_URI"], '?'); - if ( $url == $route ) { + if ( str_starts_with($url, $route) ) { echo " active "; } }); @@ -18,3 +18,20 @@ $function = new \Twig\TwigFunction('maincss', function() { }); $twig->addFunction($function); + +/** + * Debug + */ +$function = new \Twig\TwigFunction('dump', function($data) { + var_dump($data); +}); +$twig->addFunction($function); + +function get_faces(){ + return json_decode( file_get_contents( __DIR__ . '/views/tools/faces/faces.json' ), true ); +} + +function str_starts_with( $haystack, $needle ) { + $length = strlen( $needle ); + return substr( $haystack, 0, $length ) === $needle; +} |
