Skip to content

Commit

Permalink
0.17.2: Tidy up of various customisations, email obfuscation now via …
Browse files Browse the repository at this point in the history
…custom twig filter
  • Loading branch information
classaxe committed Feb 23, 2019
1 parent 8015793 commit f256381
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 44 deletions.
18 changes: 9 additions & 9 deletions config/bundles.php
@@ -1,19 +1,19 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
GpsLab\Bundle\GeoIP2Bundle\GpsLabGeoIP2Bundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
GpsLab\Bundle\GeoIP2Bundle\GpsLabGeoIP2Bundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
];
26 changes: 0 additions & 26 deletions src/Twig/AppExtension.php

This file was deleted.

31 changes: 31 additions & 0 deletions src/Twig/FilterObfuscateEmail.php
@@ -0,0 +1,31 @@
<?php
// src/Twig/AppExtension.php

namespace App\Twig;

use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;

class FilterObfuscateEmail extends AbstractExtension
{
public function getFilters()
{
return [
new TwigFilter('obfuscateEmail', [$this, 'obfuscateEmail']),
];
}

public function obfuscateEmail($string)
{
return
' '
. strrev(
str_replace(
'@',
'#',
$string
)
)
. ' ';
}
}
23 changes: 23 additions & 0 deletions src/Twig/FunctionGetenv.php
@@ -0,0 +1,23 @@
<?php
// src/Twig/AppExtension.php

namespace App\Twig;

use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class FunctionGetenv extends AbstractExtension
{
public function getFunctions(): array
{
return [
new TwigFunction(
'getEnv',
function($varname)
{
return getenv($varname);
}
)
];
}
}
4 changes: 3 additions & 1 deletion templates/footer/footer.html.twig
Expand Up @@ -9,7 +9,9 @@
{% for person in systems[system][credit] %}
<strong>
{% if person.email %}
<a href="#" data-contact=" metsyS02%{{ system|upper|reverse }}=tcejbus?{{ person.email|reverse|replace({'@':'#'}) }}:otliam ">{{ person.name }}</a>
<a href="#" data-contact="{{
('mailto:' ~ person.email ~ '?subject=' ~ system | upper ~ ' system') | obfuscateEmail
}}">{{ person.name }}</a>
{% else %}
{{ person.name }}
{% endif %}
Expand Down
@@ -1,7 +1,7 @@
{#
Custom changes to vendor/symfony/twig-bridge/Resources/views/Form/form_div_layout.html.twig
To use in any form, include this code at head of form itself (NOT an included file like base.html.twig)
{% form_theme form 'forms/custom_form_div_layout.html.twig' %}
{% form_theme form 'forms/custom_theme.html.twig' %}
#}
{#
Customised to allow HTML inside
Expand Down
2 changes: 0 additions & 2 deletions templates/forms/form.html.twig
@@ -1,5 +1,3 @@
{# Include our twig widget customisations #}
{% form_theme form 'forms/custom_form_div_layout.html.twig' %}
<div class="controlPanel {{ form_class }}">
<div class="header">{{ form_title }}</div>
<div class="content clearfix">
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/listeners/form.html.twig
@@ -1,5 +1,5 @@
{# Include our twig widget customisations #}
{% form_theme form 'forms/custom_form_div_layout.html.twig' %}
{% form_theme form 'forms/custom.html.twig' %}
<div class="controlPanel {{ form_class }}">
<div class="header">{{ form_title }}</div>
<div class="content clearfix">
Expand Down
3 changes: 1 addition & 2 deletions templates/forms/signals/form.html.twig
@@ -1,6 +1,5 @@
{# Include our twig widget customisations #}
{% form_theme form 'forms/custom_form_div_layout.html.twig' %}
<div class="controlPanel {{ form_class }}">
{% form_theme form 'forms/custom.html.twig' %}
<div class="header">{{ form_title }}</div>
<div class="content clearfix">
{{ form_start(form) }}
Expand Down
1 change: 0 additions & 1 deletion templates/listener/form.html.twig
@@ -1,4 +1,3 @@
{% form_theme form 'forms/custom_form_div_layout.html.twig' %}
<div class="controlPanel {{ form_class }}">
<div class="header">{{ mode|raw }}</div>
<div class="content">
Expand Down
1 change: 0 additions & 1 deletion templates/listener/weather.html.twig
Expand Up @@ -3,7 +3,6 @@
<div class="main fullwidth">
{% set form_class='listener_weather' %}
{% include 'listener/tabs.html.twig' %}
{% form_theme form 'forms/custom_form_div_layout.html.twig' %}
<div class="controlPanel {{ form_class }}">
<div class="header">{{ mode|raw }}</div>
<div class="content">
Expand Down

0 comments on commit f256381

Please sign in to comment.