Git Product home page Git Product logo

craft-obfuscator's Introduction

Obfuscator icon

Obfuscator

A Craft CMS plugin that adds a Twig filter to obfuscate emails or any other content using Hivelogic Enkoder.

This plugin uses Standalone PHPEnkoder.

Contents

Usage

The following Twig snippet —

{% apply enkode_emails %}
    Reach us on [email protected] or
    <a href="mailto:[email protected]">here</a>.
{% endapply %}

will result in HTML where both the plain text email, and the mailto: anchor tag are recognised as emails and obfuscated. It will result in something like this (re-formatted for readability):

Reach us on

<span id="enkoder_1_2033799978">email hidden; JavaScript is required</span>
<script id="script_enkoder_1_2033799978" type="text/javascript"> /* <!-- */
function hivelogic_enkoder_1_2033799978() {  } hivelogic_enkoder_1_2033799978();
/* --> */ </script>

or

<span id="enkoder_0_1540754146">email hidden; JavaScript is required</span>
<script id="script_enkoder_0_1540754146" type="text/javascript"> /* <!-- */
function hivelogic_enkoder_0_1540754146() {  } hivelogic_enkoder_0_1540754146();
/* --> */ </script>.

In addition to the enkode_emails filter, Obfuscator comes with a bunch of additional filters for more fine grained targeting of what to obfuscate.

{{ 'Reach us on [email protected] or <a href="mailto:[email protected]">here</a>.'|enkode_emails }}

{{ '<a href="mailto:[email protected]">Contact Us</a>'|enkode_mailtos }}

{{ 'Contact us at [email protected].'|enkode_plaintext_emails }}

{{ 'I don’t want spam bots to read this.'|enkode }}

{{ 'If you don’t have JavaScript, you’ll see a helpful message.'|enkode('JavaScript is required to view this message.') }}

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Obfuscator”. Then click on the “Install” button in its modal window.

Using Composer

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/project

# tell composer to use the plugin
composer require miranj/craft-obfuscator

# tell Craft to install the plugin
./craft plugin/install obfuscator

Requirements

This plugin requires Craft CMS 3, 4, or 5. The Craft 2 version is availabe in the v0 branch.


Brought to you by Miranj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.