Documentation Menu

1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 11 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Manual arrow 11. API Reference arrow mosHTML::emailCloaking

mosHTML::emailCloaking PDF Print E-mail

Last reviewed: Not reviewed
phpDocumentor

mosHTML::emailCloaking

A simple method for cloaking email addresses.  Returns JavaScript that replaces the email address with a mailto link with the address cloaked.

Syntax

string emailCloaking ( string $address [, boolean $maito [, string $text [, boolean $email [, boolean $noscript ]]]] )

$address
is the email address to be cloaked.
$mailto
is a flag. If true then a clickable "mailto:" link will be produced; otherwise $address will be shown but not as a link. This parameter is optional and if omitted will default to true.
$text
is the text to be displayed to the user for the address link.  If empty then $address will be displayed to the user. This parameter is optional and if omitted will default to an empty string (so that the displayed text will be $address).
$email
is a flag. If true then it indicates that $text is itself an email address and an extra precaution against address harvesting can be taken; otherwise $text is considered to be an arbitrary string and only basic encoding will be applied.  This parameter is optional and if omitted will default to true. This parameter was introduced in mambo 4.5.2.2.
$noscript
is a flag. If true then an HTML <noscript> tag pair will be appended to the returned string containing a message that may be shown to the user in the event that their browser does not support scripts or currently has them disabled. The text returned is taken from the CLOAKING language variable. This parameter is optional and if omitted will default to false. This parameter was introduced in Joomla 1.1 with prior versions always outputting a <noscript> tag pair.

Examples

Example 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 )
 
< Prev   Next >