From 1848e6b59ce1aad02554ebfa8164b2ff13b63e4c Mon Sep 17 00:00:00 2001 From: Ast Derek Date: Sat, 10 Mar 2012 15:08:46 -0600 Subject: [PATCH] Email cloak resets body content when loaded with AJAX --- libraries/joomla/html/html/email.php | 106 ++++++++++++--------------- 1 file changed, 46 insertions(+), 60 deletions(-) diff --git a/libraries/joomla/html/html/email.php b/libraries/joomla/html/html/email.php index d468705dbf86c..b20a2934eca01 100644 --- a/libraries/joomla/html/html/email.php +++ b/libraries/joomla/html/html/email.php @@ -34,72 +34,58 @@ abstract class JHtmlEmail */ public static function cloak($mail, $mailto = 1, $text = '', $email = 1) { + /** + * Original approach breaks site content when combined with + * AJAX calls, i.e. JomSocial + * + * Current implementation relies on jQuery, please extend for + * other JS libraries + */ // Convert text $mail = JHtmlEmail::_convertEncoding($mail); // Split email by @ symbol $mail = explode('@', $mail); $mail_parts = explode('.', $mail[1]); // Random number - $rand = rand(1, 100000); - - $replacement = "\n '; - - // XHTML compliance no Javascript text handling - $replacement .= ""; - $replacement .= JText::_('JLIB_HTML_CLOAKING'); - $replacement .= "\n "; - + $__mail = '__' + rand(1, 100000); + + + // Convert text + $text = JHtmlEmail::_convertEncoding($text); + // Split email by @ symbol + $text = explode('@', $text); + $text_parts = explode('.', $text[1]); + // Random number + $__text = '__' + rand(1, 100000); + + ob_start(); + ?> + + +