Extension talk:Email Link

From mediawiki.org
Latest comment: 15 years ago by 145.58.176.20 in topic Bug

Doesnt work with 1.5.1+[edit]

The extension worked perfectly with 1.11, but after upgrading to 1.5.1 it doesnt encode the links properly that have a "." in them. So first.last@blabla.com will get encoded as "first@blabla.com first@blabla.com" (it will show it 2 times and only partially)


Bug[edit]

There is a bug in this extension, maybe related to other extensions too. On my installation the email link is surounded by a nowiki xml tag that apears in the rendered page. Also I have extensions like Nuke, SyntaxHilight, AutoLink, StubManager, ExtensionManager. 10:02, 31 January 2008 82.78.39.13

I have the same error. Getting nowiki tags at the start and end of the email address. I have a cleaner wiki install without any extensions (this is first). 12.110.36.162 00:50, 13 February 2008 (UTC)Reply

Simply remove the <nowiki></nowiki> tags from the extension code.

email-links inside pre-tag renders mailto-link --145.58.176.20 10:19, 12 February 2009 (UTC)Reply

Automatically encrypt E-Mail addresses[edit]

The following modification will allow this extension to be used in conjunction with Extension:Enkoder and automatically encode plain text e-mail addresses:

<?php
// tested with MW 1.11
function addMailLinks(&$parser, &$text, &$strip_state) {
   $mc = "[A-Za-z0-9._+-]";
   $mcs = "[A-Za-z0-9]";
   $text = preg_replace(
       "{(?<![\\[:/])(?<!$mcs)($mcs$mc*@$mcs$mc*\.$mcs{2,})(?!$mc)(?![\\]:/])}",
       '<enkode>$1</enkode>',
       $text
   );
   return true; //added for Mediawiki 1.11
} 
$wgHooks['ParserBeforeStrip'][] = 'addMailLinks';

?>