Extension/EmailTag: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| (2 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 3: | Zeile 3: | ||
{{Extension | {{Extension | ||
|name=EmailTag | |name=EmailTag | ||
|purpose=Protects email addresses from spam using email tags. | |||
|since=2021 | |||
|until=2025-11-14 | |until=2025-11-14 | ||
|state=✅ | |state=✅ | ||
|comment=siehe [[Extension/CompGen]] | |||
}} | }} | ||
= | = Beispiel = | ||
<pre> | |||
<email>test@verein.de</email> | |||
</pre> | |||
<email>test@verein.de</email> | |||
= Source Code 2021 = | |||
<source lang='php'> | <source lang='php'> | ||
<?php | <?php | ||
Aktuelle Version vom 14. November 2025, 17:13 Uhr
Extension
| Extension | |
|---|---|
| name | EmailTag |
| url | |
| wikidataid | → |
| purpose | Protects email addresses from spam using email tags. |
| since | 2021 |
| until | 2025-11-14 |
| comment | siehe Extension/CompGen |
| state | ✅ |
| wiki | → |
Beispiel
<email>test@verein.de</email>
Source Code 2021
<?php
/**
* Copyright (C) 2021 Dr. Jesper Zedlitz
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* @package MediaWiki
* @subpackage Extensions
* @author Dr. Jesper Zedlitz <jesper at zedlitz dot de>
* @copyright © 2022 Dr. Jesper Zedlitz
*/
if (!defined('MEDIAWIKI')) die();
/* email tag */
$wgExtensionFunctions[] = 'wfEmailTag';
$wgExtensionCredits['parserhook'][] = array(
'name' => 'EmailTag',
'author' => 'Jesper Zedlitz',
'version' => '0.1',
'url' => ''
);
function wfEmailTag() {
global $wgParser;
$wgParser->setHook( "email", "wfEmailTagDoit" );
}
function wfEmailTagDoit($text="") {
$size=4;
$fontwidth = imagefontwidth($size);
$fontheight = imagefontheight($size);
$width = strlen($text) * $fontwidth + 4;
$height = $fontheight + 2;
$im = @imagecreatetruecolor ($width, $height) or exit;
$trans = imagecolorallocate ($im, 255,255,255); /* must be black! */
$color = imagecolorallocate ($im, 1,1,1); /* nearly black ;) */
imagefill ( $im, 0, 0, $trans );
imagestring($im, $size, 2, 0, $text, $color);
ob_start();
imagepng($im);
$image_data = ob_get_contents();
ob_end_clean();
imageDestroy($im);
$png = base64_encode($image_data);
$text = "<img src=\"data:image/png;base64,$png\" alt=\"some mail\" />";
return $text;
}