| mosHTML::emailCloaking |
|
Last reviewed: Not reviewed mosHTML::emailCloakingA simple method for cloaking email addresses. Returns JavaScript that replaces the email address with a mailto link with the address cloaked. Syntaxstring emailCloaking ( string $address [, boolean $maito [, string $text [, boolean $email [, boolean $noscript ]]]] )
ExamplesExample 1: Just using the email address with none of the optional parameters. The user will see the email address as a clickable link. $address = 'john.doe@w3c.org'; echo mosHTML::emailcloaking( $address );which will produce something like: <script language='JavaScript' type='text/javascript'> <!-- var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy39561 = 'john.doe' + '@' + 'w3c' + '.' + 'org'; document.write( '<a ' + path + '\'' + prefix + ':' + addy39561 + '\'>' ); document.write( addy39561 ); document.write( '<\/a>' ); //--> </script> <noscript> This email address is being protected from spam bots, you need Javascript enabled to view it </noscript> Example 2: In this example the user will see the link as 'John Doe': $address = 'john.doe@w3c.org'; $name = 'John Doe'; echo mosHTML::emailcloaking( $address, true, $name, false );which will produce something like: <script language='JavaScript' type='text/javascript'> <!-- var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy38289 = 'john.doe' + '@' + 'w3c' + '.' + 'org'; var addy_text38289 = 'John Doe'; document.write( '<a ' + path + '\'' + prefix + ':' + addy38289 + '\'>' ); document.write( addy_text38289 ); document.write( '<\/a>' ); //--> </script> <noscript> This email address is being protected from spam bots, you need Javascript enabled to view it </noscript> Please report any errors on this page to the Developer Documentation Forum. |
|
| Last Updated ( Thursday, 15 September 2005 ) |