Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [sangiro] Plugin Requested | Encode Email Addresses

Quote Reply
Re: [sangiro] Plugin Requested | Encode Email Addresses In reply to
You could probably do it with a global;

<%global_name($Contact_Email)%>

Code:
sub {

my $in = $_[0];
my $strings = q|
a~097
b~098
c~099
d~100
e~101
f~102
g~103
h~104
i~105
j~106
k~107
l~108
m~109
n~110
o~111
p~112
q~113
r~114
s~115
t~116
u~117
v~118
w~119
x~120
y~121
z~122
1~049
2~050
3~051
4~052
5~053
6~054
7~055
8~056
9~057
0~048
&~038
~032
_~095
-~045
@~064
.~046
|;

my $back;
my @address = split //, $in; # cut the email address up into each charachter...
my @strings = split /\n/, $strings;

foreach (@address) {

my $next;

foreach my $s (@strings) {

$s =~ s/\s$//g;

next if $next == 1;

my ($char,$equiv) = split /~/, $s; # get the charachter, and its numerical equiv

if ($char eq $_) {
$char =~ s/\Q$char/$equiv/i;
$char = '&#' . $char . ';';
$back .= $char; # add the new replacement to $back
$next = 1;
}

}

}

return $back;

}

I just gave it a quick test on my site, and it seems to work ok :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Jun 26, 2004, 5:40 AM
Subject Author Views Date
Thread Plugin Requested | Encode Email Addresses sangiro 9958 Jun 25, 2004, 12:42 PM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 9871 Jun 26, 2004, 5:04 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 9806 Jun 26, 2004, 6:25 AM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 9785 Jun 26, 2004, 6:34 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 9802 Jun 26, 2004, 7:03 AM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 9830 Jun 26, 2004, 7:17 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 9808 Jun 26, 2004, 7:33 AM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 9758 Jun 26, 2004, 7:58 AM
Post Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 9758 Jun 26, 2004, 1:33 PM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 9673 Oct 22, 2004, 4:48 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 9684 Oct 22, 2004, 4:50 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 9619 Oct 22, 2004, 5:04 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 9635 Oct 22, 2004, 5:43 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 9603 Oct 22, 2004, 6:58 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 9619 Oct 22, 2004, 7:03 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 9640 Oct 23, 2004, 1:41 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 9650 Oct 23, 2004, 1:50 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 9598 Oct 23, 2004, 2:44 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 9672 Oct 23, 2004, 2:54 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 9635 Oct 23, 2004, 4:47 AM
Post Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 9617 Oct 23, 2004, 5:47 AM
Post Re: [mick31] Plugin Requested | Encode Email Addresses
sangiro 9647 Oct 22, 2004, 9:30 AM
Post Re: [sangiro] Plugin Requested | Encode Email Addresses
bigfish 9778 Jun 26, 2004, 9:25 AM