references:joomla.legacy:1.5:moshtml-emailcloakingTable of Contents
emailCloaking
A 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. Example 1 $address = 'john.doe@w3c.org'; echo mosHTML::emailcloaking( $address ); which will produce something like: Result 1 <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’: Example 2 $address = 'john.doe@w3c.org'; $name = 'John Doe'; echo mosHTML::emailcloaking( $address, true, $name, false ); which will produce something like: Result 2 <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> |



