Roope

Email Obfuscation (EMO)

67 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

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 VirtuallyCreative
      Hello PW Community,
      I'm trying to modify a small module I found to pull in Gravatars but I'm having a bit of an issue and was curious if someone has already done a Gravatar implementation, or could look over the module code? It installed no problem, but when I try to use it, nothing works.
      Here is the full module:
      <?php /** * Module for generating Gravatar URLs for ProcessWire users. * * Use it like this: * * Get URL only with all defaults: * $user->gravatar() * * Get image tag with different size: * $user->gravatar(array('img' => true, 's' => 200)); * */ class Gravatar extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Gravatar', 'version' => 1, 'summary' => 'Gravatar hook for users', 'singular' => true, 'autoload' => true, 'icon' => 'smile-o', ); } public function init() { $this->addHook('User::gravatar', $this, 'methodGravatar'); } public function methodGravatar($event) { $u = $event->object; if ( ! $u instanceof User) $event->return = false; return; if ( ! $u->email) $event->return = false; return; $params = ($event->arguments(0) ? $event->arguments(0) : array()); // Default options $defaults = array( 's' => 100, 'd' => 'retro', 'r' => 'g', 'img' => false, 'attrs' => array(), ); $opts = array_merge($defaults, $params); extract($opts); $url = '//www.gravatar.com/avatar/'; $url .= md5(strtolower(trim($u->email))); $url .= "?s=$s&d=$d&r=$r"; if ($img) { $url = '<img src="' . $url . '"'; foreach ($attrs as $key => $val ) { $url .= ' ' . $key . '="' . $val . '"'; } $url .= ' />'; } $event->return = $url; } } The issue is when I use $user->gravatar() I'm getting back "unknown". I know that the email being used by the current logged-in user (me) does have a Gravatar, but I'm unable to get the URL so I can place it into my template markup.
      Any insight or direction would be appreciated. I did a search for Gravatar modules / forum topics but it mostly appears to be linked to the Blog profile that uses Gravatar, not a stand-alone module / implementation.
      Regards,
      VirtuallyCreative
    • By cosmicsafari
      Hi All,
      Fairly new to ProcessWire so apologies if this is a daft question, but I am having a go creating my first module. I have set it up and enabled it as per the docs.
      However I have created another class within the same module directory, which was going to be used in the main module file but I can't get it to work for the life of me and I believe its due to me not fully understanding the namespace side of things.
      Example:
      MyModule.module.php
      <?php namespace ProcessWire; class MyModule extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Test Module', 'version' => 1, 'summary' => 'Test module', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => 'exchange', ); } public function newMethod( $testMessage ) { $foo = new Foo($testMessage); $foo->getFoo(); } } Foo.php
      <?php namespace ProcessWire; class Foo { protected $foo; public function __construct($foo) { $this->foo = $foo; } public function getFoo() { return $this->foo; } } Now as I understand it both these files should exist under the ProcessWire namespace, so in theory I should be able to use Foo within MyModule without any use statements as they both exist at the same level within the ProcessWire namespace?
      However when I try something like so:
      $myModule = $modules->getModule('MyModule'); $myModule->myMethod('Foo'); I would have thought this should return 'Foo', however I keep running into errors like:
      Any help would be appreciated.
    • By Max Allan Niklasson
      Hi, I think this is my first topic, even though I've been working with PW a few years. But now, I'm trying to restructure my way of coding, cause many templates (like activities for birding societies) are re appearing in multiple different websites. Since this, I've been working on redo this into a module, but as far as I have read I cannot store the templates (related to specific module) in the module's folder. It has to be in the templates folder?
       
    • By kongondo
      Menu Builder
       
      Modules Directory
      Project Page
      Read Me (How to install, use, etc..)

      If you want a navigation that mirrors your ProcessWire page tree, the system allows you to easily create recursive menus using either vanilla PHP or Soma's great MarkupSimpleNavigation. In some cases, however, you may wish to create menus that:
      1. Do not mirror you site's page tree (hirarchies and ancestry); and
      2. You can add custom links (external to your site) to.

      That is primarily where Menu Builder comes in. It is also helpful if you:
      3. Prefer creating menus via drag and drop
      4. Have a need for menus (or other listings) that will be changing regularly or that you want to allow your admin users to edit.

      The issue of custom menus is not new here in the forums. The difference is that this module allows you to easily create such menus via drag and drop in the Admin. Actually, you can even use it to just create some list if you wanted to. In the backend, the module uses the jQueryUI plugin nestedSortable by Manuele J Sarfatti for the drag and drop and is inspired in part by the WP Custom Menu feature.
       
      Please read the Read Me completely before using this module. 
      For Complex or highly-customised menus, it is recommended to use the getMenuItems() method as detailed in this post.
       
      Features
      Ability to create menus that do not mirror your ProcessWire Page Tree hierarchy/structure Menus can contain both ProcessWire pages and custom links Create menu hierarchies and nesting via drag and drop Easily add CSS IDs and Classes to each menu item on creating the menu items (both custom and from ProcessWire pages) or post creation. Optionally set custom links to open in a new tab Change menu item titles built from ProcessWire pages (without affecting the original page). E.g. if you have a page titled 'About Us' but you want the menu item title to be 'About' Readily view the structure and settings for each menu item Menus stored as pages (note: just the menu, not the items!) Menu items stored as JSON in a field in the menu pages (empty values not stored) Add menu items from ProcessWire pages using page fields (option to choose between PageAutocomplete and AsmSelect [default]) or a Selector (e.g. template=basic-page, limit=20, sort=title). For page fields, you can specify a selector to return only those specified pages for selection in the page field (i.e. asm and autocomplete) For superusers, optionally allow markup in your menu titles, e.g. <span>About</span> Menu settings for nestedSortable - e.g. maxLevels (limit nesting levels) Advanced features (e.g. add pages via selector, menu settings) currently permissible to superadmins only (may change to be permission-based) Delete single or all menu items without deleting the menu itself Lock down menus for editing Highly configurable MarkupMenuBuilder - e.g. can pass menu id, title, name or array to render(); Passing an array means you can conditionally manipulate it before rendering, e.g. make certain menu branches visible only to certain users [the code is up to you!]  Optionally grab menu items only (as a Menu object WireArray or a normal array) and use your own code to create custom highly complex menus to meet any need. More... In the backend, ProcessMenuBuilder does the menu creation. For the frontend, menus are displayed using MarkupMenuBuilder.

      Credits

      In this module's infancy (way back!), I wanted to know more about ProcessWire modules as well as improve my PHP skills. As they say, what better way to learn than to actually create something? So, I developed this module (instead of writing PW tutorials as promised, tsk, tsk, naughty, naughty!) in my own summer of code . Props to Wanze, Soma, Pete, Antti and Ryan whose modules I studied (read copied ) to help in my module development and to Teppo for his wonderful write-up on the "Anatomy of fields in ProcessWire" that vastly improved my knowledge and understanding of how PW works. Diogo and marcus for idea about using pages (rather than a custom db table), onjegolders for his helpful UI comments, Martijn Geerts, OrganizedFellow, dazzyweb and Mike Anthony for 'pushing me' to complete this module and netcarver for help with the code.
       
      Screens

    • By kongondo
      Introducing Variations, an Input- and Fieldtype for product variations and their attributes.
      Product variations is a topic that has been coming up now and then, especially in the recent past.  This module seeks to fill this gap. Though it's in its early stages of development, it is already functional and can be used as is. I decided to make an early announcement (modules development forum) in order to get early feedback from potential users. 
      The module is an alternative take on how variations can be built for a product. Imagine the ubiquitous T-Shirt. The product could vary by ...Size, Colour, Material, etc...These variations could in turn have internal variations, i.e. attributes....so, Size [Small, Large], Colour [Red, Blue]...etc; you get the drift.
      The usual approaches to building variations have been either to use Multiple pages, Repeaters, Page Table, Table or Matrix (limited to 1x1 variations). In this module, we do it a bit differently.
      First, the variations occur not at the Field level (meaning all product pages would have the same variations and attributes for each template) but at the page level. Secondly, there are no multiple pages for each variation and/or attributes; a product is a single page. The variations and their attributes are defined by site editors at the page level. Once a variations configuration has been defined, it is applied to the page and all possible combinations are generated (i.e. the Red,Small,Cotton; Red,Large,Cotton, etc) in the Inputfield. There is no limit to the number of variations and attributes that can be defined, although you will be amazed at how quickly the combinations grow! Prices are entered for each combination when editing the page. Combinations without prices are not saved to the database. Please note that prices cannot themselves vary at the page-level. Meaning, you cannot have ONE variation configuration that has different price inputs per product in the same FieldtypeVariations field.
      The module ships with an API for outputting variation combinations in the frontend. Search, database and in-memory work as normal in the frontend. In the backend, DataTables provides a nice paginated, filterable table. Prices can be entered on any pages (of the table) without loss of data (meaning you can enter prices on page 1, scroll to page 10, enter more prices, filter or search the products table, enter more prices and finally save; no data will be lost).
      I still have a couple of ideas and plans pending but would love to hear from you, thanks.
      Below is a short video demo of the module in its current state. Things may/will change, both UI and features. Btw, the Fieldtype, although primarily targeted at commerce applications, is by no means limited to this. Other uses requiring combinations of whatever number of variables are very much within the remit of the module.
      Planned/Hoped for features
      Import/Export product variations and attributes (Excel, etc) Full integration with Padloper (I will have to  discuss with @apeisa) SKU fields for each product variation Add/Remove extra subfields, e.g. multi-currency prices (currently there is only 1 input for each product variations' price) Product variation images? Etc... Please not this module is not related to this other planned module (but it may eventually).
      Sneak Peek Demo