├── LICENSE
├── README.md
├── assets
├── emailobfuscator.css
└── emailobfuscator.js
├── boot.php
├── index.php
├── install.php
├── lang
├── de_de.lang
├── en_gb.lang
├── es_es.lang
├── pt_br.lang
└── sv_se.lang
├── lib
└── class.emailobfuscator.php
├── package.yml
└── pages
├── config.php
├── help.php
└── index.php
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Friends Of REDAXO
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Email-Obfuscator: Verschlüsselung von E-Mailadressen zum Schutz vor Spam
2 | ========================================================================
3 |
4 | Das [REDAXO](http://www.redaxo.org)-Addon sorgt dafür, dass alle E-Mailadressen auf deiner Website in verschlüsselter Form ausgegeben werden, so dass sie vor Spam geschützt sind.
5 |
6 | ## Funktionsweise
7 |
8 | Durch die Integration des email_obfuscator Addons von RexDude stehen verschiedene Verschleierungsmethoden für E-Mailadressen zur Verfügung:
9 |
10 | 1. __ROT13 Einhorn-Markup__: Diese Methode findet alle E-Mailadressen und ersetzt deren `@` durch spezielles Einhorn-Markup: `_at_ `. Dadurch kann die E-Mailadresse nicht mehr so einfach von Bots ausgelesen werden und sollte ziemlich gut vor Spam geschützt sein. Weiterhin werden auch alle mailto-Links erkannt und verschlüsselt.
11 | Beim Aufruf der Seite werden alle geschützten E-Mailadressen und mailto-Links mittels __JavaScript__ wieder entschlüsselt und in die ursprüngliche Form gebracht. __CSS-Styles__ sorgen dafür, dass die geschützten E-Mailadressen auf der Website richtig angezeigt werden, also mit `@` statt Einhorn. Damit fällt der Wechsel von verschlüsselt nach unverschlüsselt nicht auf, und auch in Umgebungen ohne JavaScript wird eine verschlüsselte Adresse richtig dargestellt.
12 | __Bitte beachten__: Diese Methode benötigt für die Einhorn-Markup Methode __jQuery__ für die JavaScript-Funktionalität!
13 |
14 | 2. __ROT13 JavaScript Verschlüsselung__: Um die Email-Adressen zu schützen, wird die E-Mailadresse durch ein JavaScript ersetzt, das die E-Mailadresse ins Dokument schreibt. Zur Verschleierung wird die Technik "ROT13 Encryption" angewendet.
15 | __Bitte beachten__: Diese Methode macht alle E-Mailadresse ohne klickbaren Link klickbar!
16 |
17 | 3. __CSS Methode ohne JavaScript__: Um die Email-Adressen zu schützen, wird die Technik "CSS display:none" angewendet.
18 | __Bitte beachten__: diese Methode entfernt den mailto-Link und verwandelt Adresse in name[at]domain.tld. Die Adresse ist damit nicht mehr klickbar.
19 |
20 | 4. __ROT13 JavaScript Verschlüsselung mit CSS Methode__: Um die Email-Adressen zu schützen, werden die Techniken "CSS display:none" und "ROT13 Encryption" angewendet. Die CSS Methode kommt im `` Tag zum Einsatz, falls JavaScript im Browser des Besuchers deaktiviert ist.
21 | __Bitte beachten__: Diese Methode macht alle E-Mailadresse ohne klickbaren Link klickbar!
22 | __Bitte beachten__: diese Methode entfernt bei deaktiviertem JavaScript den mailto-Link und verwandelt Adresse in name[at]domain.tld. Die Adresse ist damit nicht mehr klickbar.
23 |
24 | ## Installation
25 |
26 | Das Addon ist nach Aktivierung gleich funktionsfähig, und du brauchst keine weiteren Einstellungen vorzunehmen. Die benötigten Styles und Scripte werden automatisch geladen.
27 |
28 | Solltest du das benötigte CSS oder JavaScript manuell einbinden wollen, musst du in der Konfiguration das automatische Laden deaktivieren.
29 |
30 |
31 |
32 | ### Hinweise zur __ROT13 Einhorn-Markup__ Methode: CSS und JavaScript manuell einbinden
33 |
34 | Du kannst die Styles und Scripte auf zwei Arten einbinden: Entweder du lädst die Files, die das Addon bereitstellt, oder du kopierst deren Inhalte in deine bestehenden CSS- und JavaScript-Files.
35 |
36 | #### a) Dateien laden
37 |
38 | __CSS__ im `` deiner Website einfügen:
39 |
40 | ```php
41 | isAvailable()) {
43 | ?>
44 |
45 |
48 | ```
49 |
50 | __JavaScript__ am besten am Ende deiner Website vorm schließenden `` einfügen:
51 |
52 | ```php
53 | isAvailable()) {
55 | ?>
56 |
57 |
60 | ```
61 |
62 | #### b) Inhalte kopieren
63 |
64 | Kopiere die Inhalte der CSS-Datei und der JS-Datei jeweils in deine Sourcen:
65 |
66 | assets/emailobfuscator.css
67 | assets/emailobfuscator.js
68 |
69 | ⚠️ Beachte dabei: Sollte eine neue Version des Addons erscheinen, in der das CSS oder JS geändert wurden, musst du diese Änderungen in deinen Sourcen anpassen!
70 | Bei Variante a) oben ist dies nicht notwendig.
71 |
72 |
73 | ## Sonstiges
74 |
75 | ### Verschlüsselung bestimmter E-Mailadressen verhindern
76 |
77 | ```php
78 | isAvailable()) {
80 | emailobfuscator::whitelistEmail('email@example.com');
81 | }
82 | ?>
83 | ```
84 |
85 | ### Aufpassen bei Formularen und Attributen!
86 |
87 | Das Addon filtert _alle_ E-Mailadressen im Code anhand eines Musters und verschlüsselt diese. In manchen Situationen ist das nicht unbedingt gewollt, z. B. wenn E-Mailadressen als HTML-Attribute oder in Formularen verwendet werden. Dort werden vom System natürlich die reinen, unverschlüsselten Adressen erwartet, und leider kann das Addon solche Umgebungen nicht eigenständig erkennen.
88 |
89 | ⚠️ Beachte bitte, dass du in manchen Umgebungen die E-Mailverschlüsselung unterbinden solltest, entweder durch Ausschließen bestimmter Templates oder Artikel in der Konfiguration, oder aber durch ein manuelles Whitelisting von Adressen wie im Abschnitt oben beschrieben.
--------------------------------------------------------------------------------
/assets/emailobfuscator.css:
--------------------------------------------------------------------------------
1 | span.unicorn:before {
2 | content: "@";
3 | }
4 |
5 | span.unicorn > span {
6 | /*
7 | * Hide only visually, but have it available for screen readers:
8 | * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
9 | *
10 | * Beachten: Diese Art des Ausblendens ermöglicht ein Copy & Paste von
11 | * E-Mailadressen. Bei anderen Varianten, etwa display: none, ist dies
12 | * nicht mehr möglich!
13 | */
14 | border: 0;
15 | clip: rect(0 0 0 0);
16 | height: 1px;
17 | margin: -1px;
18 | overflow: hidden;
19 | padding: 0;
20 | position: absolute;
21 | width: 1px;
22 | }
--------------------------------------------------------------------------------
/assets/emailobfuscator.js:
--------------------------------------------------------------------------------
1 | window.onload = function () {
2 | if (typeof jQuery !== 'undefined') {
3 | $(function () {
4 | decryptEmailaddresses();
5 | });
6 | } else {
7 | console.warn('Email obfuscator addon requires jQuery.');
8 | }
9 | };
10 |
11 | function decryptEmailaddresses() {
12 | // Ersetze E-Mailadressen
13 | $('span.unicorn').each(function () {
14 | $(this).replaceWith('@');
15 | });
16 |
17 | // Ersetze mailto-Links
18 | $('a[href^="javascript:decryptUnicorn"]').each(function () {
19 |
20 | // Selektiere Einhorn-Werte
21 | var emails = $(this).attr('href').match(/\((.*)\)/)[1];
22 |
23 | emails = emails
24 | // ROT13-Transformation
25 | .replace(/[a-z]/gi, function (s) {
26 | return String.fromCharCode(s.charCodeAt(0) + (s.toLowerCase() < 'n' ? 13 : -13));
27 | })
28 | // Ersetze # durch @
29 | .replace(/\|/g, '@');
30 |
31 | // Ersetze Einhörner
32 | $(this).attr('href', 'mailto:' + emails);
33 | });
34 | }
--------------------------------------------------------------------------------
/boot.php:
--------------------------------------------------------------------------------
1 | getSubject();
5 |
6 | // Prepare article and template exceptions - email addresses will not be encrypted
7 | $emailobfuscator = rex_addon::get('emailobfuscator');
8 | // bc - 'rot13_unicorn' is default method
9 | $whitelistTemplates = $emailobfuscator->getConfig('templates', []);
10 | $whitelistArticles = preg_grep('/^\s*$/s', explode(",", $emailobfuscator->getConfig('articles', '')), PREG_GREP_INVERT);
11 |
12 | if (!is_null(rex_article::getCurrent()) && !in_array(rex_article::getCurrent()->getTemplateId(), $whitelistTemplates) && !in_array(rex_article::getCurrentId(), $whitelistArticles)) {
13 | return emailobfuscator::obfuscate($content);
14 | }
15 |
16 | return $content;
17 | }, rex_extension::LATE);
18 | }
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 | hasConfig()) {
3 | $this->setConfig([
4 | 'autoload_css' => true,
5 | 'autoload_js' => true,
6 | ]);
7 | }
8 | ?>
--------------------------------------------------------------------------------
/install.php:
--------------------------------------------------------------------------------
1 | hasConfig()) {
6 | $this->setConfig([
7 | 'autoload_css' => true,
8 | 'autoload_js' => true,
9 | ]);
10 | }
--------------------------------------------------------------------------------
/lang/de_de.lang:
--------------------------------------------------------------------------------
1 | emailobfuscator_title = Email-Verschlüsselung
2 |
3 | emailobfuscator_config = Konfiguration
4 | emailobfuscator_config_saved = Konfiguration gespeichert.
5 | emailobfuscator_config_methods = Methoden
6 | emailobfuscator_config_select_method = Verschlüsselungsmethode
7 | emailobfuscator_config_select_method_css = CSS Methode ohne JavaScript (entfernt Link und verwandelt Adresse in name[at]domain.tld)
8 | emailobfuscator_config_select_method_rot13 = ROT13 JavaScript Verschlüsselung
9 | emailobfuscator_config_select_method_rot13_css = ROT13 JavaScript Verschlüsselung mit CSS Methode falls JavaScript deaktiviert ist
10 | emailobfuscator_config_select_method_unicorn = ROT13 Einhorn-Markup (Standard, benötigt JQuery)
11 | emailobfuscator-config-method
12 | emailobfuscator_config_assets = Assets
13 | emailobfuscator_config_load_assets = Scripte und Styles laden
14 | emailobfuscator_config_assets_js = JavaScript automatisch laden
15 | emailobfuscator_config_assets_css = CSS automatisch laden
16 | emailobfuscator_config_assets_note = Assets können manuell im Template eingebunden werden, falls dies nicht automatisch passieren soll. Zudem ist es auch möglich, die mitgelieferten Styles und Scripte des Addons in deine bereits vorhandene Sourcen einzubetten, dann aber müssen sie im Fall eines Addon-Updates von dir nachträglich angepasst werden. Ausführliche Informationen und Code-Beispiele findest du auf der Hilfeseite des Addons .
17 | emailobfuscator_config_whitelist = Ausnahmen
18 | emailobfuscator_config_articles = Artikel ausschließen
19 | emailobfuscator_config_templates = Templates ausschließen
20 | emailobfuscator_config_mailto_only = Nur Emailadressen mit 'mailto:'
--------------------------------------------------------------------------------
/lang/en_gb.lang:
--------------------------------------------------------------------------------
1 | emailobfuscator_title = E-mail obfuscation
2 |
3 | emailobfuscator_config = Configuration
4 | emailobfuscator_config_saved = Configuration has been saved.
5 | emailobfuscator_config_methods = Methods
6 | emailobfuscator_config_select_method = Protection method
7 | emailobfuscator_config_select_method_css = CSS method without JavaScript (removes link and transforms address into name[at]domain.tld)
8 | emailobfuscator_config_select_method_rot13 = ROT13 JavaScript encryption
9 | emailobfuscator_config_select_method_rot13_css = ROT13 JavaScript encryption with CSS method as fallback, in case JavaScript is deactivated
10 | emailobfuscator_config_select_method_unicorn = ROT Unicorn-Markup (standard, needs JQuery)
11 | emailobfuscator_config_assets = Assets
12 | emailobfuscator_config_load_assets = Load scripts and styles
13 | emailobfuscator_config_assets_js = Autoload JavaScript
14 | emailobfuscator_config_assets_css = Autoload CSS
15 | emailobfuscator_config_assets_note = In case you do not want assets to autoload, you can include them in your template. You can also embed the styles and scripts provided by the addon into your existing sources, but don't forget to update them in case the AddOn is updated with new assets. Find detailed information and code snippets in the AddOn README .
16 | emailobfuscator_config_whitelist = Whitelist
17 | emailobfuscator_config_articles = Whitelist articles
18 | emailobfuscator_config_templates = Whitelist templates
19 | emailobfuscator_config_mailto_only = Only e-mail adresses with 'mailto:'
--------------------------------------------------------------------------------
/lang/es_es.lang:
--------------------------------------------------------------------------------
1 | emailobfuscator_title = E-mail ofuscación
2 |
3 | emailobfuscator_config = Ajustes
4 | emailobfuscator_config_saved = Configuración guardada
5 | emailobfuscator_config_methods = Métodos
6 | emailobfuscator_config_select_method = Método de protección
7 | emailobfuscator_config_select_method_css = Método CSS sin JavaScript (elimina el enlace y transforma la dirección en nombre [at] domain.tld)
8 | emailobfuscator_config_select_method_rot13 = Cifrado JavaScript ROT13
9 | emailobfuscator_config_select_method_rot13_css = Cifrado JavaScript ROT13 con método CSS como respaldo, en caso de que JavaScript esté desactivado
10 | emailobfuscator_config_select_method_unicorn = ROT Unicorn-Markup (estándar, necesita JQuery)
11 | emailobfuscator-config-method
12 | emailobfuscator_config_assets = Recursos
13 | emailobfuscator_config_load_assets = Cargue scripts y estilos
14 | emailobfuscator_config_assets_js = Carga automáticamente JavaScript
15 | emailobfuscator_config_assets_css = Carga automáticamente CSS
16 | emailobfuscator_config_assets_note = Los recursos se pueden incluir manualmente en la plantilla si esto no se va a realizar automáticamente. También puede incrustar los estilos y scripts provistos por el complemento en sus fuentes existentes, pero no olvide actualizarlos en caso de que el AddOn se actualice con nuevos recursos. Encuentre información detallada y fragmentos de código en AddOn README .
17 | emailobfuscator_config_whitelist = Excepciones
18 | emailobfuscator_config_articles = Excluir artículos
19 | emailobfuscator_config_templates = Excluir plantillas
20 | emailobfuscator_config_mailto_only = Solo direcciones de e-mail con 'mailto:'
--------------------------------------------------------------------------------
/lang/pt_br.lang:
--------------------------------------------------------------------------------
1 | emailobfuscator_title = Criptografia de email
2 |
3 | emailobfuscator_config = Configuração
4 | emailobfuscator_config_saved = A configuração foi salva
5 | emailobfuscator_config_assets = Assets
6 | emailobfuscator_config_load_assets = Carregar scripts e estilos
7 | emailobfuscator_config_assets_js = Carregar JavaScript automaticamente JavaScript
8 | emailobfuscator_config_assets_css = Carregar CSS automaticamente
9 | emailobfuscator_config_assets_note = Caso você não queira carregar os Assets automaticamente, você pode incluí-los em seu template. Você também pode incorporar os estilos e scripts fornecidos pelo addon em suas fontes existentes, mas não se esqueça de atualizá-los caso o AddOn seja atualizado com novos recursos. Encontre informações detalhadas e fragmentos de códigos no AddOn README .
10 | emailobfuscator_config_whitelist = Exceções
11 | emailobfuscator_config_articles = Excluir produtos
12 | emailobfuscator_config_templates = Excluir templates
13 | emailobfuscator_config_mailto_only = Apenas endereços de e-mail com 'mailto:'
--------------------------------------------------------------------------------
/lang/sv_se.lang:
--------------------------------------------------------------------------------
1 | emailobfuscator_title = E-post kryptering
2 |
3 | emailobfuscator_config = Konfiguration
4 | emailobfuscator_config_saved = Konfiguration har sparats
5 | emailobfuscator_config_methods = Metoder
6 | emailobfuscator_config_select_method = Krypteringsmetod
7 | emailobfuscator_config_select_method_css = CSS-metod utan JavaScript (tar bort länken och konverterar adress till namn [at] domain.tld)
8 | emailobfuscator_config_select_method_rot13 = ROT13 JavaScript-kryptering
9 | emailobfuscator_config_select_method_rot13_css = ROT13 JavaScript-kryptering med CSS-metod om JavaScript är inaktiverat
10 | emailobfuscator_config_select_method_unicorn = ROT13 Unicorn-Markup (Standard, kräver JQuery)
11 | emailobfuscator-config-method
12 | emailobfuscator_config_assets = Assets
13 | emailobfuscator_config_load_assets = Ladda skripts och stilar
14 | emailobfuscator_config_assets_js = Ladda JavaScript automatisk
15 | emailobfuscator_config_assets_css = Ladda CSS automatisk
16 | emailobfuscator_config_assets_note = Om du inte vill att assets ska laddas automatisk kan du inkludera dem i din mall. Du kan också bädda in de stilar och skript som tillhandahålls av tillägget i dina befintliga källor, men glöm inte att uppdatera dem om AddOn uppdateras med nya assets. Hitta detaljerad information och kodutdrag i AddOn README .
17 | emailobfuscator_config_whitelist = Undantag
18 | emailobfuscator_config_articles = Utesluta artiklar
19 | emailobfuscator_config_templates = Utesluta mallar
20 | emailobfuscator_config_mailto_only = Bara e-postadresser med 'mailto:'
--------------------------------------------------------------------------------
/lib/class.emailobfuscator.php:
--------------------------------------------------------------------------------
1 | getConfig('method', '') == '' ? 'rot13_unicorn' : $emailobfuscator->getConfig('method', '');
17 |
18 | if($method == 'rot13_unicorn') {
19 | // Ersetze mailto-Links (zuerst!)
20 | // Anmerkung: Attributwerte (hier: href) benötigen nicht zwingend Anführungsstriche drumrum,
21 | // deshalb prüfen wir zusätzlich noch auf '>' am Ende .
22 | $content = preg_replace_callback('/mailto:(.*?)(?=[\'\"\>])/', 'emailobfuscator::encodeEmailLinksUnicorn', $content);
23 |
24 | // Ersetze E-Mailadressen
25 | if (!$emailobfuscator->getConfig('mailto_only')) {
26 | $content = preg_replace_callback('/([\w\-\+\.]+)@([\w\-\.]+\.[\w]{2,})/', 'emailobfuscator::encodeEmailUnicorn', $content);
27 | }
28 |
29 | // Injiziere CSS vors schließende im Seitenkopf
30 | if ($emailobfuscator->getConfig('autoload_css')) {
31 | $cssFile = ' ';
32 | $content = str_replace('', $cssFile . '', $content);
33 | }
34 |
35 | // Injiziere JavaScript vors schließende