Roope

Email Obfuscation (EMO)

73 posts in this topic

19 hours ago, Roope said:

Hello @Barcelo!

So email addresses are replaced by text set in module config but conversion back to email doesn't kick in, right? Double check that emo.js is really present because it sounds like there's the issue here. Maybe consider adding modules config url to the file path:


<?php echo '<script src=" . $config->urls->modules . EmailObfuscation/emo.min.js"></script>'; ?>

 


I think you meant this ;):

<?php echo '<script src="' . $config->urls->siteModules . 'EmailObfuscation/emo.min.js"></script>'; ?>

This works fine as before - the script gets included just fine.

But, none of the included E-Mails addresses are replaced with any text and elements at all. They are still untouched present in plain text.

So I guess, that the module is "stuck" somehow or not recognized / executed at all during page rendering. Could another module might interfere?

(of course caching is not active :rolleyes:)
(Processwire V 2.7.2)

Share this post


Link to post
Share on other sites
On 9/27/2016 at 11:13 PM, Macrura said:

Feature request: one thing that would be cool is to be able to enable this only for some templates, instead of disable;
because i only need it on the contact page, so i'd need to disable like 30 templates, rather than enable 1, the way it is currently;

Is there any way of conditionally loading this module by the API?

One of the really critical issues here is that the module is still not able to skip stuff like twitter handle (e.g. @processwire)

Thanks @Macrura - I'll try look into these shortly!

On 9/28/2016 at 11:30 AM, Bacelo said:


I think you meant this ;):


<?php echo '<script src="' . $config->urls->siteModules . 'EmailObfuscation/emo.min.js"></script>'; ?>

This works fine as before - the script gets included just fine.

But, none of the included E-Mails addresses are replaced with any text and elements at all. They are still untouched present in plain text.

So I guess, that the module is "stuck" somehow or not recognized / executed at all during page rendering. Could another module might interfere?

(of course caching is not active :rolleyes:)
(Processwire V 2.7.2)

Sorry, I meant $config->urls->siteModules... And is should read your other post mo carefully since you already mentioned that script block is not included in the end of the document so it's not about js script surely. Don't know what other module could be blocking this but what other 3rd party modules you have installed?

Share this post


Link to post
Share on other sites

Thank you Roope  for supporting. :)

Actually I have the following site modules installed at the project:

AllInOneMinify
DiagnoseDatabase
DiagnoseFiles
DiagnoseImagehandling
DiagnoseModules
DiagnosePhp
DiagnoseWebserver
EmailObfuscation
FormBuilder
ImageExtra
InputfieldFormBuilderFile
JqueryDataTables
MarkupMenuBuilder
MarkupSEO
ProCache (not active)
ProcessDatabaseBackups
ProcessDiagnostics
ProcessFormBuilder
ProcessMenuBuilder
ProcessPageListerPro
ProcessProCache
ProcessWireUpgrade
ProcessWireUpgradeCheck
TemplateEngineFactory
TemplateEngineProcesswire

Share this post


Link to post
Share on other sites

Not that I'm familiar with all of thease but first that pops out from the list is TemplateEngineFactory. I haven't used it and have no idea about the logic behind the scenes but if you could temporarily uninstall it and see what happens.

Share this post


Link to post
Share on other sites

slightly off-topic, but just wanted to mention that i was able to solve my problem (loading emo on all pages, and it thinking that the twitter handle in the header was an email address) by just using a hanna code for the email addresses (like [[emo email=mail@example.com]]);

I have a function in my templates that does the email address replacement.

Not trying to discount the utility of this module as it can provide global coverage for email addresses, but possibly for some users who only need to replace a few emails in some specific places, then the shortcode can be useful. Also, if you had a specific field holding the email address, then you could obfuscate it with the same function directly in the template output...

Share this post


Link to post
Share on other sites
9 hours ago, Macrura said:

i was able to solve my problem (loading emo on all pages, and it thinking that the twitter handle in the header was an email address)

I don't experience this problem with this module - for me only email addresses are obfuscated, not twitter handles.

name@testing.com <- this would be obfuscated

@testing <- this is untouched

 

Share this post


Link to post
Share on other sites

ok right, well the main problem i was having was more that i didn't want EMO active on every page of the site, so i loaded the JS myself only on the page i needed it, where there were email addresses.

But it was still finding something it thought was an email on the homepage, and then adding the script tag and thus JS error on the page, plus the overhead of the plugin running on that page.

the obfuscation function i'm using works on each email you trigger it on, so only where you want..

 

 

Share this post


Link to post
Share on other sites

OK, thanks guys!

Like @Robin S posted, we either have never experienced any problems with twitter (or any other some) handles. Can you @Macrura plese give me more detalied example about false positives you faced with?

I was thinking that maybe I could add new 'execution method' to the module config where one could select whether to exclude/include email auto obfuscation at selected templates/pages or go full manual by using public method ever when needed. This would definitely be more flexible than the current route we have in use.

1 person likes this

Share this post


Link to post
Share on other sites

I figured out what it was, it was an embedded Constant Contact sign up form that had the words:

Please enter your email address in name@email.com format

this is actually inside a <script> tag.

In any case your suggestion about the execution method would be really great, because when you know you only need the script to operate on 1 page, and leave the rest of the site untouched, it's really the safest way on a large project where you don't want things to break...

1 person likes this

Share this post


Link to post
Share on other sites
On 30.9.2016 at 10:55 AM, Roope said:

Not that I'm familiar with all of thease but first that pops out from the list is TemplateEngineFactory. I haven't used it and have no idea about the logic behind the scenes but if you could temporarily uninstall it and see what happens.

Actually I can't unistall the module "TemplateEngineFactory" as the template relies on this :(
I'll continue having a deeper look into and try to cut it down.

Share this post


Link to post
Share on other sites

New version is now available at GitHub. Added new option to exclude/include module execution at selected templates/pages + new $sanitizer->emo() method to manually control obfuscation for given string. Please go ahead and try it out!

1 person likes this

Share this post


Link to post
Share on other sites
4 hours ago, PWaddict said:

How can I re-initiate it via AJAX?

Currently this is not possible.

Share this post


Link to post
Share on other sites

The module is set to "autoload' => true, is this surely needed? In my quick test 'autoload' => 'template!=admin' works too.

1 person likes this

Share this post


Link to post
Share on other sites
1 hour ago, tpr said:

The module is set to "autoload' => true, is this surely needed? In my quick test 'autoload' => 'template!=admin' works too.

This module was launched before 2.3.1, which introduced conditional autoloading. Aforementioned change seems reasonable, but means dropping support for 2.2.

... although dropping support for 2.2 at this point doesn't seem like such a huge issue ;)

3 people like this

Share this post


Link to post
Share on other sites
On 1/13/2017 at 9:34 AM, tpr said:

The module is set to "autoload' => true, is this surely needed? In my quick test 'autoload' => 'template!=admin' works too.

 

On 1/13/2017 at 11:27 AM, teppo said:

This module was launched before 2.3.1, which introduced conditional autoloading. Aforementioned change seems reasonable, but means dropping support for 2.2.

... although dropping support for 2.2 at this point doesn't seem like such a huge issue ;)

 

To be honest, I've missed the whole world of conditional autoloading of PW modules...

Dropping off support for 2.2 isn't any issue. There will be older perfecly functional emo releases available if someone needs it. So I think I'll go ahead and make this change same time I'll add PW namespace to the module - which should happen pretty soon. Thanks for the notice!

 

2 people like this

Share this post


Link to post
Share on other sites

Thanks!

1 minute ago, Roope said:

To be honest, I've missed the whole world of conditional autoloading of PW modules...

So did I until recently :)

Share this post


Link to post
Share on other sites

Hi @Roope

Looks like module doesn't work when template cache is on. 

It loads 

 var emo_addr = new Array();
 emo_addr[0] = "fA1PLjJh83r7WD9s+apZEH5RTFM0uYwS2Ge6bxVOktKvIndQC4qBUycoim.NlXgz";
 emo_addr[1] = "sJL2Tc4GuoWX8VHn0yXx05jt0182Mh3xF6Ue05jt0haQ9VxdFVXfFRxxTO3QYoWdTcXn7OHG86mt0VFQ+JHmF53q0oYB7VDQ0pmyTZCQTZif";
 if(window.addLoadEvent) addLoadEvent(emo_replace());

just for first time after cache timeout, but cache is saved without it.

Can somebody confirm it? 

And one small feature request: could you change "Replate text string" input from text to text Multilanguage field.

Share this post


Link to post
Share on other sites
On 1.10.2016 at 0:40 AM, Macrura said:

the obfuscation function i'm using works on each email you trigger it on, so only where you want..

Hi @Macrura,

would you mind to reveal more details of your obfuscation function? I would highly appreciate it.

Share this post


Link to post
Share on other sites

I'm using this function in places, seems to work well:

/**
 * Given an email address render the obfuscated version
 *
 * @param $strEmail - an email address
 *
 */
function createMailto($strEmail) {
  $strNewAddress = '';
  for($intCounter = 0; $intCounter < strlen($strEmail); $intCounter++){
    $strNewAddress .= "&#" . ord(substr($strEmail,$intCounter,1)) . ";";
  }
  $arrEmail = explode("&#64;", $strNewAddress);
  $strTag = "<script type='text/javascript'>\n";
  $strTag .= "<!--\n";
  $strTag .= "document.write('<a href=\"mai');\n";
  $strTag .= "document.write('lto');\n";
  $strTag .= "document.write(':" . $arrEmail[0] . "');\n";
  $strTag .= "document.write('@');\n";
  $strTag .= "document.write('" . $arrEmail[1] . "\">');\n";
  $strTag .= "document.write('" . $arrEmail[0] . "');\n";
  $strTag .= "document.write('@');\n";
  $strTag .= "document.write('" . $arrEmail[1] . "<\/a>');\n";
  $strTag .= "// -->\n";
  $strTag .= "</script><noscript>" . $arrEmail[0] . " at \n";
  $strTag .= str_replace("&#46;"," dot ",$arrEmail[1]) . "</noscript>";
  return $strTag;
}

also works well in a hanna code, and doesn't require any additional js files

1 person likes this

Share this post


Link to post
Share on other sites
11 hours ago, ottogal said:

Hi @Macrura,

would you mind to reveal more details of your obfuscation function? I would highly appreciate it.

You can do this with EMO too:

  1. At module settings page set "Obfuscation mode" to "Obfuscate manually..." (OR adjust exclude/include templates/pages settings to have auto obfuscation enabled only where needed).
  2. Then on a page template obfuscate only the parts of markup you want by using $sanitizer->emo() method.
// obfuscate single email address
echo $sanitizer->emo('hello@world.com');

// obfuscate email addresses from a body field output
echo $sanitizer->emo($page->body);

Also make sure that you are using the 1.1.x version since this feature was added to the latest release (1.1.0).

Share this post


Link to post
Share on other sites
On 3/23/2017 at 7:15 PM, Zeka said:

Hi @Roope

Looks like module doesn't work when template cache is on. 

It loads 


 var emo_addr = new Array();
 emo_addr[0] = "fA1PLjJh83r7WD9s+apZEH5RTFM0uYwS2Ge6bxVOktKvIndQC4qBUycoim.NlXgz";
 emo_addr[1] = "sJL2Tc4GuoWX8VHn0yXx05jt0182Mh3xF6Ue05jt0haQ9VxdFVXfFRxxTO3QYoWdTcXn7OHG86mt0VFQ+JHmF53q0oYB7VDQ0pmyTZCQTZif";
 if(window.addLoadEvent) addLoadEvent(emo_replace());

just for first time after cache timeout, but cache is saved without it.

Can somebody confirm it? 

And one small feature request: could you change "Replate text string" input from text to text Multilanguage field.

Hello @Zeka!

Sorry for massive delay but I just quickly tested EMO with built-in cache and was able to repeat yor issue. Cache file had emails as plain text and both EMO scripts were missing. On a public page it was still allright (emails obfuscated) so I don't know why it wasn't really using cached version? Switch to ProCache worked as excepted - cached page, which was obfuscated.

I'm really lost with PW built-in cache since I'm so used to work with Ryans ProCache module and it has never had any issues running together with EMO. So for now my best bet for you is to get that :) - in a meantime we'll see if there is something we can about this.

Multilanguage support is already in my TODO list, if I just could find the time... Thanks for the notice!

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By justb3a
      Displays countries and continents and their iso codes.
      The "value" for each country is the two-letter country code. 
      As an added bonus, the country names are displayed in the language of the user (sorted by name ASC) if the appropriate translation was added.
       
      read more ...
       
    • By Robin S
      I'd hate to know how much accumulated time I have spent and how much eye-strain I have experienced over the last couple of years, hunting through the 675 icons in the "all icons" view for the one I want. Today I finally got around to doing something about it.
      IconsFilter
      Allows the "all icons" view in InputfieldIcon to be filtered by name.
      Usage
      Install the IconsFilter module.
      When viewing "all icons" in InputfieldIcon (Advanced tab of field/template settings) you can filter the icons by name using the filter input at top right.
       

       
      https://github.com/Toutouwai/IconsFilter
       
      @tpr, something that could be merged into AdminOnSteroids?
    • By horst
      Croppable Image 3 (beta)
      for PW 3.0.20+
      Module Version 1.1.7
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
      Sticking with a PW legacy 2.8.20+ Version (none namespaced)? - I have created a CroppableImage2 snapshot, which you can get from the github repo branch: CroppableImage2 

      -------------------------------------------------------------------------
       
    • By kongondo
      Variations
      Released 29 May 2017
      Variations is a simple yet powerful commercial ProcessWire module that allows website editors to create attributes and their values and from those generate variations of any entity, most notably products.
      The module consists of  FieldtypeVariations and InputfieldVariations as well as a ProcessVariations for managing variations configurations and attributes.   Setting up the field is quite easy.   First, create a field of type Variations. Define some custom inputs that will need to be directly edited on the page containing the field, for instance a product price, SKU, etc.   Secondly, via the Inputfield, create a couple of attributes.   Thirdly, create a variations configuration and add the attributes and values you want in the configuration. Link that variations configuration to your page and the module will automatically generate all possible combinations (variations) of the attribute values in that configuration. These, together with the custom inputs you created when setting up the field will be displayed on the page (e.g. a product page), ready for editing. This makes this module quite unique; variations are defined at the page-level rather than at the field level. This presents lots of possibilities such as infinitely reusable attributes and variations configurations.    For those using Padloper, integration with the e-commerce platform is quite simple as demonstrated in this tutorial.  The module consists of 4 modules
      ProcessVariations FieldtypeVariations InputfieldVariations VariationsCustomTableManager (autoload module, working behind the scenes) Video Demo: https://youtu.be/T93nn96UL8o
      Documentation: https://variations.kongondo.com/
      Shop: https://processwireshop.pw/plugins/variations/
      Requires: ProcessWire 2.5 or newer
      Features
      Easily create variations of anything, including products for e-commerce websites, etc   Create an attribute once, use it everywhere, multiple times, picking and choosing all or only the attribute values you want Bulk editing of variations configurations and attributes Reusable variations configurations Works with Padloper out-of-the-box with minimal coding User-friendly, intuitive and easy to set up
    • By joshuag
      Introducing our newest [commercial] module:
      Recurme
      Processwire Recurring Dates Field & Custom Calendar Module.
      http://www.99lime.com/modules/recurme/
      One Field to Recur them ALL…
      A Recurring Dates InputField for your Processwire templates. The InputField you’ve been waiting for.
      Complex RRule date repeating in a simple and fast user interface.
      Use the super simple, & powerful API to output them into your templates.
      example:
      <? // easy to get recurring events $events = $recurme->find(); // events for this day $events = $recurme->day(); // events for this week $events = $recurme->week(); // events for this month $events = $recurme->month(); ?> <? // Loop through your events foreach($events as $event){ echo $event->title; echo $event->start_date; echo $event->rrule; echo $event->original->url; ... } ?> Unlimited Custom Calendars.
      Imagine you could create any calendar you wanted on your website. Use recurring events with the Recurme field, or use your own Processwire pages and date fields to render calendars… it’s up to you. Fully customizable. Make as many calendars as you like. Get events from anywhere. Recurme does all the hard date work for you.
      Unlimited Custom Admin Calendars too.
      Hope you like it  ,
       Joshua & Eduardo from 99Lime.
       





       
      ## [1.0.1] - 2017-05-29
      ### changed
      - Fixed $options[weekStartDay] offset in Calendar
      - Fixed ->renderCalendar() Blank Days
      - Fixed missing ->renderList() [renderMonth][xAfter]
      - Removed ->renderCalendar() <table> attributes border, border-spacing
      - Fixed ->renderCalendar() excluded dates
      - Fixed rrule-giu.js exclude dates
      - Fixed ->renderList missing space in attr ID
      (shout out to @Juergen for multiple suggestions & feedback).