Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Cloaking plugin corrupts HTML #11353

Merged
merged 4 commits into from Aug 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions plugins/content/emailcloak/emailcloak.php
Expand Up @@ -479,8 +479,12 @@ protected function _cloak(&$text, &$params)
$text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0]));
}

// Search for plain text email@example.org
$pattern = '~' . $searchEmail . '([^a-z0-9]|$)~i';
/*
* Search for plain text email addresses, such as email@example.org but not within HTML tags:
* <img src="..." title="email@example.org"> or <input type="text" placeholder="email@example.org">
* The negative lookahead '(?![^<]*>)' is used to exclude this kind of occurrences
*/
$pattern = '~(?![^<>]*>)' . $searchEmail . '~i';

while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE))
{
Expand Down