Skip to content

Commit 7c7900c

Browse files
committed
make obfuscation work when content is renderd with fusion afx
1 parent cb51d5d commit 7c7900c

File tree

5 files changed

+29
-21
lines changed

5 files changed

+29
-21
lines changed

Configuration/Settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Neos:
1515
Neos:
1616
fusion:
1717
autoInclude:
18-
Networkteam.Neos.MailObfuscator: true
18+
'Networkteam.Neos.MailObfuscator': true
1919

2020
Networkteam:
2121
Neos:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Install the composer package in your site package or distribution:
3535
$ composer require networkteam/neos-mailobfuscator
3636
```
3737

38-
There is no need for configuration, as a Fusion processor is attached to all prototypes extending
39-
`Neos.Neos:Content`.
38+
There is no need for configuration, as a Fusion processor is attached to `body` of `Neos.Neos:Page`.
39+
That means, that the complete content of body tag is obfuscated.
4040

4141
### Compatibility
4242

@@ -52,16 +52,16 @@ See the following table for the correct plugin version to choose:
5252
Obfuscation can be disabled for specific node types by unsetting the processor:
5353

5454
```
55-
prototype(Vendor.MyPackage:MyNodeType) {
55+
prototype(Neos.Neos:Page) {
5656
@process.networkteamNeosMailObfuscator >
5757
}
5858
```
5959

6060
The JavaScript include can be disabled for custom minification:
6161

6262
```
63-
page = prototype(Neos.Neos:Page) {
64-
body.javascripts.networkteamNeosMailObfuscator >
63+
prototype(Neos.Neos:Page) {
64+
networkteamNeosMailObfuscator >
6565
}
6666
```
6767

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
##
2+
# Extend the Page prototype to include the obfuscation JavaScript and obfuscate content within body tag
3+
#
4+
prototype(Neos.Neos:Page) {
5+
6+
networkteamNeosMailObfuscator = Neos.Fusion:Tag {
7+
tagName = 'script'
8+
attributes.src = Neos.Fusion:ResourceUri {
9+
path = 'resource://Networkteam.Neos.MailObfuscator/Public/Scripts/nwt.mailobfuscation.min.js'
10+
}
11+
}
12+
networkteamNeosMailObfuscator.@position = 'after body'
13+
14+
[email protected] = Networkteam.Neos:MailObfuscator
15+
}

Resources/Private/Fusion/Prototype/MailObfuscator.fusion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Replaces all occurrences of "mailto:<emailAddress>" and email address labels using the configured implementation
1616
#
1717
prototype(Networkteam.Neos:MailObfuscator) {
18-
@class = '\\Networkteam\\Neos\\MailObfuscator\\Fusion\\ConvertEmailLinksImplementation'
18+
@class = 'Networkteam\\Neos\\MailObfuscator\\Fusion\\ConvertEmailLinksImplementation'
1919

2020
patternMailTo = '/(href=")mailto:([^"]*)/'
2121
patternMailDisplay = '/(href="mailto:[^"]*">)([^<]*)/'

Resources/Private/Fusion/Root.fusion

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,12 @@
1010
# You should have received a copy of the GNU General Public License along with this program; if not, write to the
1111
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1212

13-
include: Prototype/MailObfuscator.fusion
13+
##
14+
# Include all .fusion files
15+
#
16+
17+
include: ./**/*.fusion
18+
19+
1420

15-
# Extend the Page prototype to include the obfuscation JavaScript
16-
prototype(Neos.Neos:Page) {
17-
body.javascripts.networkteamNeosMailObfuscator = Neos.Fusion:Tag {
18-
tagName = 'script'
19-
attributes.src = Neos.Fusion:ResourceUri {
20-
path = 'resource://Networkteam.Neos.MailObfuscator/Public/Scripts/nwt.mailobfuscation.min.js'
21-
}
22-
}
23-
}
2421

25-
# Obfuscate all node types extending Neos:Content by default
26-
prototype(Neos.Neos:Content) {
27-
@process.networkteamNeosMailObfuscator = Networkteam.Neos:MailObfuscator
28-
}

0 commit comments

Comments
 (0)