]> Raphaël G. Git Repositories - blogbundle/commitdiff
Integrate base64 extension
authorRaphaël Gertz <git@rapsys.eu>
Sun, 25 Mar 2018 00:51:09 +0000 (01:51 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Sun, 25 Mar 2018 00:51:09 +0000 (01:51 +0100)
Resources/config/services.yml
Twig/Base64Extension.php [new file with mode: 0644]

index 6ce718f370c2995d7c559f8d2ebc1ebf13001754..2dcb15fc9e5b8fc675796777eb22977cd83a9975 100644 (file)
@@ -2,3 +2,6 @@ services:
     twig.extension.intl:
         class: Twig_Extensions_Extension_Intl
         tags: [ twig.extension ]
     twig.extension.intl:
         class: Twig_Extensions_Extension_Intl
         tags: [ twig.extension ]
+    rapsys_blog.twig.base64:
+        class: Rapsys\BlogBundle\Twig\Base64Extension
+        tags: [ twig.extension ]
diff --git a/Twig/Base64Extension.php b/Twig/Base64Extension.php
new file mode 100644 (file)
index 0000000..e1c804e
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+// src/Rapsys/BlogBundle/Twig/Base64Extension.php
+namespace Rapsys\BlogBundle\Twig;
+
+class Base64Extension extends \Twig_Extension {
+       public function getFilters() {
+               return array(
+                       new \Twig_SimpleFilter('base64_encode', 'base64_encode'),
+                       new \Twig_SimpleFilter('base64_decode', 'base64_decode')
+               );
+       }
+}