File tree Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Networkteam \Neos \MailObfuscator \Eel ;
4
+
5
+ use Neos \Flow \Annotations as Flow ;
6
+ use Neos \Eel \ProtectedContextAwareInterface ;
7
+ use Networkteam \Neos \MailObfuscator \Converter \EmailLinkNameConverterInterface ;
8
+ use Networkteam \Neos \MailObfuscator \Converter \MailtoLinkConverterInterface ;
9
+
10
+ /**
11
+ * Eel helpers to provide MailObfuscator functions
12
+ */
13
+ class MailObfuscator implements ProtectedContextAwareInterface {
14
+
15
+ /**
16
+ * @var EmailLinkNameConverterInterface
17
+ * @Flow\Inject
18
+ */
19
+ protected $ emailLinkNameConverter ;
20
+
21
+ /**
22
+ * @var MailtoLinkConverterInterface
23
+ * @Flow\Inject
24
+ */
25
+ protected $ mailtoLinkConverter ;
26
+
27
+ /**
28
+ * Convert at Character
29
+ *
30
+ * @param $email string
31
+ * @return string
32
+ */
33
+ public function convertAtChar ($ email = false ) {
34
+ return $ this ->emailLinkNameConverter ->convert ($ email );
35
+ }
36
+
37
+ /**
38
+ * Convert Mailto to Href
39
+ *
40
+ * @param $email string
41
+ * @return string
42
+ */
43
+ public function convertMailto2Href ($ email = false ) {
44
+ return $ this ->mailtoLinkConverter ->convert ($ email );
45
+ }
46
+
47
+ /**
48
+ * All methods are considered safe
49
+ *
50
+ * @param string $methodName
51
+ * @return boolean
52
+ */
53
+ public function allowsCallOfMethod ($ methodName ) {
54
+ return true ;
55
+ }
56
+ }
Original file line number Diff line number Diff line change 17
17
autoInclude :
18
18
' Networkteam.Neos.MailObfuscator ' : true
19
19
20
+ Fusion :
21
+ defaultContext :
22
+ Networkteam.Neos.MailObfuscator : ' Networkteam\Neos\MailObfuscator\Eel\MailObfuscator'
23
+
20
24
Networkteam :
21
25
Neos :
22
26
MailObfuscator :
Original file line number Diff line number Diff line change @@ -75,6 +75,23 @@ Networkteam:
75
75
atCharReplacementString : ' <img src="https://example.com/at-icon.png" alt="at" />'
76
76
` ` `
77
77
78
+ ## EEL Helpers
79
+ There are Eel helpers available to use MailObfuscator functions in Fusion
80
+
81
+ ` ` `
82
+ // Convert @ Character
83
+ ${Networkteam.Neos.MailObfuscator.convertAtChar('[email protected] ')}
84
+ // returns : foo (at) example.com
85
+
86
+ ` ` `
87
+
88
+ ` ` `
89
+ // Convert Mail to Href
90
+ ${Networkteam.Neos.MailObfuscator.convertMailto2Href('[email protected] ')}
91
+ // returns javascript:linkTo_UnCryptMailto('obfuscatedEmail', -randomNumber)
92
+ ```
93
+
94
+
78
95
## Acknowledgments
79
96
80
97
Original email address obfuscation code by [ TYPO3 CMS] ( http://www.typo3.org ) .
You can’t perform that action at this time.
0 commit comments