- #1
L
Luigi_Tirol
Bekanntes Mitglied
Themenersteller
- Dabei seit
- 29.09.2003
- Beiträge
- 981
- Reaktionspunkte
- 0
wenn ich einen mail-link auf ein bild setze, wird das javascript nicht ausgeführt.
kann man das irgendwie anpassen, ohne das cloaking abschalten zu müssen??
hier der code des mabots:
kann man das irgendwie anpassen, ohne das cloaking abschalten zu müssen??
hier der code des mabots:
Code:
<?php
// no direct access
defined(->_VALID_MOS' ) or die(->Restricted access' );
$_MAMBOTS->registerFunction(->onPrepareContent',->botMosEmailCloak' );
/**
* Mambot that Cloaks all emails in content from spambots via javascript
*/
function botMosEmailCloak( $published, &$row, &$params, $page=0 ) {
global $database;
// check whether mambot has been unpublished
if ( !$published ) {
return true;
}
// load mambot params info
$query = SELECT id
. \n FROM #__mambots
. \n WHERE element =->mosemailcloak'
. \n AND folder =->content'
;
$database->setQuery( $query );
$id = $database->loadResult();
$mambot = new mosMambot( $database );
$mambot->load( $id );
$botParams = new mosParameters( $mambot->params );
$mode = $botParams->def(->mode', 1 );
$search = ([[:alnum:]_\.\-]+)(\@[[:alnum:]\.\-]+\.+)([[:alnum:]\.\-]+);
$search_text = ([[:alnum:][:space:][:punct:]][^<>]+);
// search for derivativs of link code <a href=mailto:[email protected]>[email protected]</a>
// extra handling for inclusion of title and target attributes either side of href attribute
$searchlink = (<a [[:alnum:] _\\'=\@\.\-]*href=[\\']mailto:. $search .[\\'][[:alnum:] _\\'=\@\.\-]*>). $search .</a>;
while( eregi( $searchlink, $row->text, $regs ) ) {
$mail = $regs[2] . $regs[3] . $regs[4];
$mail_text = $regs[5] . $regs[6] . $regs[7];
// check to see if mail text is different from mail addy
if ( $mail_text ) {
$replacement = mosHTML::emailCloaking( $mail, $mode, $mail_text );
} else {
$replacement = mosHTML::emailCloaking( $mail, $mode );
}
// replace the found address with the js cloacked email
$row->text = str_replace( $regs[0], $replacement, $row->text );
}
// search for derivativs of link code <a href=mailto:[email protected]>anytext</a>
// extra handling for inclusion of title and target attributes either side of href attribute
$searchlink = (<a [[:alnum:] _\\'=\@\.\-]*href=[\\']mailto:. $search .[\\'][[:alnum:] _\\'=\@\.\-]*)>. $search_text .</a>;
while( eregi( $searchlink, $row->text, $regs ) ) {
$mail = $regs[2] . $regs[3] . $regs[4];
$mail_text = $regs[5];
$replacement = mosHTML::emailCloaking( $mail, $mode, $mail_text, 0 );
// replace the found address with the js cloacked email
$row->text = str_replace( $regs[0], $replacement, $row->text );
}
// search for plain text [email][email protected][/email]
while( eregi( $search, $row->text, $regs ) ) {
$mail = $regs[0];
$replacement = mosHTML::emailCloaking( $mail, $mode );
// replace the found address with the js cloacked email
$row->text = str_replace( $regs[0], $replacement, $row->text );
}
}
?>