Clickable emails

Author Message

David Eriksson

Tuesday 26 July 2005 6:20:06 am

We needed all email addresses to display as clickable mailto-links, and thus instead of hunting around in each and every template we modified the wash function. It doesn't really "wash" anymore, but it was the easiest solution we could find. Since we thus lost the spam filter, we developed a new one as well.

If anyone's interested, here's the patch:

*** lib/eztemplate/classes/eztemplatestringoperator.php Fri Jun 17 10:36:46 2005
--- lib/eztemplate/classes/eztemplatestringoperator.new Tue Jul 26 15:01:49 2005
***************
*** 354,359 ****
--- 354,374 ----
                                                array( $dotText,
                                                       $atText ),
                                                $operatorValue );
+
+               // Remove the spam filter
+               $addr = str_replace('SPAMFILTER', '', strip_tags($operatorValue));
+
+               // Encode to ASCII to prevent spam (since we removed the old spam filter)
+               $mailto = "mailto:";
+
+               $encodedEmail = '';
+               for ($i = 0; $i < strlen($addr); $i++)
+                       $encodedEmail .= '&#' . ord(substr($addr, $i)) . ';';
+
+               $operatorValue = "<a href='" . $mailto . $encodedEmail . "'>" . $encodedEmail . "</a>";
+
+               // done!
+
              } break;

              case 'pdf':

/David

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 01:00:44
Script start
Timing: Jan 19 2025 01:00:44
Module start 'layout'
Timing: Jan 19 2025 01:00:44
Module start 'content'
Timing: Jan 19 2025 01:00:45
Module end 'content'
Timing: Jan 19 2025 01:00:45
Script end

Main resources:

Total runtime0.7329 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 589.0391152.6094
Module start 'layout' 0.00460.0037 741.648439.4141
Module start 'content' 0.00830.7230 781.0625434.5859
Module end 'content' 0.73140.0015 1,215.64848.1875
Script end 0.7329  1,223.8359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4363160.0002
Check MTime0.00140.1906160.0001
Mysql Total
Database connection0.00080.113710.0008
Mysqli_queries0.695894.9360460.0151
Looping result0.00040.0502440.0000
Template Total0.703396.020.3516
Template load0.00180.241620.0009
Template processing0.701595.711120.3507
Template load and register function0.00020.032710.0002
states
state_id_array0.00100.136910.0010
state_identifier_array0.00080.111220.0004
Override
Cache load0.00140.188160.0002
Sytem overhead
Fetch class attribute can translate value0.00050.072110.0005
Fetch class attribute name0.00050.069510.0005
XML
Image XML parsing0.00020.022810.0002
class_abstraction
Instantiating content class attribute0.00000.000710.0000
General
dbfile0.00160.2143100.0002
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 5
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs