It work with 1.10.3 (name : prefilter.protect_email.php)
Code: Select all
<?php
function smarty_cms_prefilter_protect_email($tpl_output, &$smarty)
{
    $result = explode(':', $smarty->_current_file);
	if (count($result) > 0)
	{
		if ($result[0] == 'content' || $result[0] == 'evaluated template' || $result[0] == 'globalcontent')
		{
		$patterns = array ('#(<a).+(href="mailto:)([a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4})"(.+)(</a>)#iU',
                   '#[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}#i');
		$replace = array ('$3', '{mailto address="$0" encode="javascript"}');
		$tpl_output = preg_replace($patterns, $replace, $tpl_output);
		}
	}
    return $tpl_output;
}
function smarty_cms_about_prefilter_protect_email() {
	?>
	<p>Author: Jean le Chauve<jeanlechauve@gmail.com></p>
	<p>Version: 1.0</p>
	<p>
	Change History:<br/>
	None
	</p>
	<?php
}
?>Code: Select all
<?php
function smarty_prefilter_protect_email($tpl_output, &$template)
{
    $smarty = $template->smarty;
	$result = explode(':', $smarty->_current_file);
	if (count($result) > 0)
	{
		if( startswith($result[0],'tmp_') ) $result[0] = 'template';
		if ($result[0] == 'content' || $result[0] == 'template' || $result[0] == 'globalcontent')
		{
		$patterns = array ('#(<a).+(href="mailto:)([a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4})"(.+)(</a>)#iU',
                   '#[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}#i');
		$replace = array ('$3', '{mailto address="$0" encode="javascript"}');
		$tpl_output = preg_replace($patterns, $replace, $tpl_output);
		}
	}
    return $tpl_output;
}
?>Can you help me ? What'is wrong ?

