Page 1 of 1

How to use Email-Cloaking in modules and Components

Posted: Tue Sep 29, 2009 2:01 pm
by behrus
Hi there,

the emailcloaking plugin in joomla! works only in content.

What's know with emailadresses in modules?

Is it possible to make the plugin also working with modules?

Thanks

Re: How to use Email-Cloaking in modules and Components

Posted: Fri Oct 16, 2009 9:17 am
by lehtori
i have the same problem.
anyone has a solution?

Re: How to use Email-Cloaking in modules and Components

Posted: Wed Nov 04, 2009 12:23 pm
by NaGGi
I'd like to know the same answer. Is there any way to get the email cloaking work on modules(or components) in joomla 1.5.14?

Re: How to use Email-Cloaking in modules and Components

Posted: Fri Nov 06, 2009 8:30 am
by vdizzle
I've been searching for this too and found this -- trying it in my own component, so maybe it will help someone else.

Code: Select all

$email = '[email protected]';
$emcloaked = JHTML::_('Email.cloak',$email);
echo $emcloaked;

Re: How to use Email-Cloaking in modules and Components

Posted: Fri Nov 06, 2009 8:47 am
by NaGGi
Yeah I got pretty much the same answer from other site too.

My main concern is to get it work on Joomla's Custom module but there is no code for that module except mod_custom.xml file so Im kinda clueless where should I put that code. Normally for modules there is some xxx.php files where I could put that but with mod_custom there is none.

Any ideas for this?

Custom module is very ideal for presenting contact information but it definately needs that email cloaking.

Re: How to use Email-Cloaking in modules and Components

Posted: Mon Nov 09, 2009 10:53 am
by mcsmom
Are you sure it's not working? I believe that it is fires.

I'm going to move this to the appropriate forum, since it's not a bug report.

Re: How to use Email-Cloaking in modules and Components

Posted: Mon Nov 09, 2009 12:10 pm
by NaGGi
That is easy to test. Just make Custom module and write some email there and see from the source code is it cloaked or not. It is definately not cloaked.

Re: How to use Email-Cloaking in modules and Components

Posted: Mon Nov 09, 2009 12:12 pm
by ooffick
You cannot use any content plugins in the Custom HTML module.

But you could use the following module instead:
http://extensions.joomla.org/extensions ... dules/4175

Olaf

Re: How to use Email-Cloaking in modules and Components

Posted: Tue Nov 10, 2009 10:41 pm
by mcsmom
Sigh, yup I was remembering that it was added to section and category descriptions.

Re: How to use Email-Cloaking in modules and Components

Posted: Fri Jun 04, 2010 10:57 am
by erickaps
Here's a solution to cloak an email address in a module using the same script code that Joomla! creates with the standard content plugin, that doesn't require installation of other plugins etc. (which I always prefer for security reasons, it means less extensions to maintain):

Create a standard contact in the Joomla! Contacts component, just entering the required email address to be cloaked.

Create a menu item linking to this contact you have created.

View the contact page on the site and view the source of the page. In the source, find the script that Joomla! inserts to cloak the email address. Tip: search for 'addy' and you will find it.

Copy the whole script (there are three <script> blocks) and paste into your custom module editor.

Save the module and that's it.

Re: How to use Email-Cloaking in modules and Components

Posted: Sat Jun 26, 2010 5:09 pm
by hansi99
The editor strips out the javascript when it is saved.

Re: How to use Email-Cloaking in modules and Components

Posted: Sun Jun 27, 2010 3:00 pm
by garstud
A solution for Joomla developers 8)

http://www.kirbymixedmedia.com/hacks-ma ... -in-joomla

i test it in J!1.5.17, it works ;)
But you need to install a "PHP code module" such as mod_html or mod_php to make it works !

Re: How to use Email-Cloaking in modules and Components

Posted: Sun Jul 18, 2010 11:43 am
by szympans
<?php if ($module->module == 'mod_custom') {
$module->content = JHTML::_('content.prepare', $module->content);
}?>

added in templates/system/html/modules.php
applies all active plugins in the custom html module

It does the work for me but breaks MVC...

Re: How to use Email-Cloaking in modules and Components

Posted: Mon Jul 19, 2010 6:01 pm
by szympans
Actually I have digged a bit in the joomla spec.
Have a look here: http://docs.joomla.org/What_is_module_chrome%3F

Using that you just need to specify chrome module in your template and apply the code I have proposed.

That way you can define additional name of inculde in temate and apply a specific style to that as a result you can mange from Administartor to which modules you want to apply plug-ins and to which don't.

1. Define module chrome in your template (html/module.php in your template directory)

Code: Select all

<?php
function modChrome_applyPlg($module, &$params, &$attribs)
{
?>
		<div class="module<?php echo $params->get('moduleclass_sfx'); ?>">
			<?php if ($module->showtitle != 0) : ?>
				<h3><?php echo $module->title; ?></h3>
			<?php endif; ?>
			$module->content = JHTML::_('content.prepare', $module->content);
			echo $module->content; ?>
		</div>
	<?php
}

?>
2. Define in template area for your module with plug-in applied:

Code: Select all

<jdoc:include type="modules" name="left" style="applyPlg" />
3. Don't forget to update 'templateDetails.xml'
4. Form administrator publish your module in new area

Re: How to use Email-Cloaking in modules and Components

Posted: Sat Sep 11, 2010 11:00 am
by sn00ze
this worked for me :D :
erickaps wrote:Here's a solution to cloak an email address in a module using the same script code that Joomla! creates with the standard content plugin, that doesn't require installation of other plugins etc. (which I always prefer for security reasons, it means less extensions to maintain):

Create a standard contact in the Joomla! Contacts component, just entering the required email address to be cloaked.

Create a menu item linking to this contact you have created.

View the contact page on the site and view the source of the page. In the source, find the script that Joomla! inserts to cloak the email address. Tip: search for 'addy' and you will find it.

Copy the whole script (there are three <script> blocks) and paste into your custom module editor.

Save the module and that's it.

Re: How to use Email-Cloaking in modules and Components

Posted: Thu Jan 24, 2013 12:15 pm
by mojito
vdizzle wrote:I've been searching for this too and found this -- trying it in my own component, so maybe it will help someone else.

Code: Select all

$email = '[email protected]';
$emcloaked = JHTML::_('Email.cloak',$email);
echo $emcloaked;
This is working for me 2.5.8 thanks vdizzle