[Solution] Add support for email inside inputs
-
If you are using this plugin, and, let’s say, you have an email address as the value of a hidden input (for Paypal, for example), the plugin will break it.
I modified the plugin to only works with email that are not wrapped in ” “. So, [email protected] will be replaced, but “[email protected]” won’t.
Here is the code of the function you have to replace in your PHP file:
function pep_replace($content) { $content = $this->pep_removeMailtoLink($content); // ---------------------------------------------------------------------- // MAIN FUNCTION: replaces any email address by its harvest-proof counterpart. // ---------------------------------------------------------------------- $addr_pattern = '/"?([A-Z0-9._%+-]+)@([A-Z0-9.-]+)\.([A-Z]{2,4})(\((.+?)\))?/i'; preg_match_all($addr_pattern, $content, $addresses); $the_addrs = $addresses[0]; for ($a = 0; $a < count($the_addrs); $a++) { if ($the_addrs[$a][0] != '"'){ $repaddr[$a] = preg_replace($addr_pattern, '<span title="$5" class="pep-email">$1(' . $this->options['pep_email_substitution_string'] . ')$2.$3</span>', $the_addrs[$a]); } else { $repaddr[$a] = str_replace('@', '@dirty@', $the_addrs[$a]); } $content = preg_replace('/'.$the_addrs[$a].'/', $repaddr[$a], $content, 1); } $content = str_replace('@dirty@', '@', $content); return $content; }
- The topic ‘[Solution] Add support for email inside inputs’ is closed to new replies.