email-encoder
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
function encode_email($email, $name)
{
$entities = array
(
"@" => "@",
"-" => "-",
"_" => "_",
"." => ".",
":" => ":",
"a" => "a",
"b" => "b",
"c" => "c",
"d" => "d",
"e" => "e",
"f" => "f",
"g" => "g",
"h" => "h",
"i" => "i",
"j" => "j",
"k" => "k",
"l" => "l",
"m" => "m",
"n" => "n",
"o" => "o",
"p" => "p",
"q" => "q",
"r" => "r",
"s" => "s",
"t" => "t",
"u" => "u",
"v" => "v",
"w" => "w",
"x" => "x",
"y" => "y",
"z" => "z"
);
#--> encode email adress
$email = str_replace(array_keys($entities), $entities, strtolower($email));
#--> return encoded email link
return '<script language="JavaScript" type="text/javascript"> <!--
document.write(\'<a href="mailto:'.$email.'" title=""><img src="images/email.gif" alt="" title="Send '.ucfirst($name).' an Email" border="0" /></a>\');
//--> </script>';
}
?>
function encode_email($email, $name)
{
$entities = array
(
"@" => "@",
"-" => "-",
"_" => "_",
"." => ".",
":" => ":",
"a" => "a",
"b" => "b",
"c" => "c",
"d" => "d",
"e" => "e",
"f" => "f",
"g" => "g",
"h" => "h",
"i" => "i",
"j" => "j",
"k" => "k",
"l" => "l",
"m" => "m",
"n" => "n",
"o" => "o",
"p" => "p",
"q" => "q",
"r" => "r",
"s" => "s",
"t" => "t",
"u" => "u",
"v" => "v",
"w" => "w",
"x" => "x",
"y" => "y",
"z" => "z"
);
#--> encode email adress
$email = str_replace(array_keys($entities), $entities, strtolower($email));
#--> return encoded email link
return '<script language="JavaScript" type="text/javascript"> <!--
document.write(\'<a href="mailto:'.$email.'" title=""><img src="images/email.gif" alt="" title="Send '.ucfirst($name).' an Email" border="0" /></a>\');
//--> </script>';
}
?>