For this to work, function "_ctmailcloak_replacer" has to be changed to check for $m[1] instead of $m[0]. Also it should check for an optional $m[2] to be included as descriptional text for a mailto-Link.
See attached file for a proposed patch that also checks for BBCode.
WARNING: the text between the <a></a>-Tags is discarded when html or punctuation mode is used.
Cheers,
Ingo
File Added: ctmailcloak.php
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Uploaded an updated version of the proposed patch:
* cloaking methods are made exclusive alternatives: only one can be used at a time
* modes HTML and PUNCTUATION do now include the descriptive text of mailto-links by creating a string containing both: DESCRIPTION (CLOAKED_EMAIL)
File Added: ctmailcloak.zip
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Works like a charm here in all 3 modes (clean install of Drake 0.4.11 RC8 r5658).Thanks a lot.
The only remaining issue is bad HTML-markup that will confuse the JavaScript-Mode a bit, but this should probably be handled elsewhere (like the WYSIWYG-editors).
The BBCode was just added in my version to keep compatibility with some older version of my own cloaker bot for Limbo and for respective the BB-Code.
Logged In: YES
user_id=1505753
Originator: YES
Ok, I see this has been also written as a comment in
How about doing something like this:
[code]
/* Handle mailto links */
$row['introtext']= preg_replace_callback('/<a href=\\"mailto:('._EMAIL_REGEX.')\\"[^>]*>([^<]*)<\\/a>/', '_ctmailcloak_replacer', $row['introtext']);
/* Handle unmarked emails */
$row['introtext']= preg_replace_callback('/'._EMAIL_REGEX.'/', '_ctmailcloak_replacer', $row['introtext'];
[/code]
And the same for bodytext.
For this to work, function "_ctmailcloak_replacer" has to be changed to check for $m[1] instead of $m[0]. Also it should check for an optional $m[2] to be included as descriptional text for a mailto-Link.
See attached file for a proposed patch that also checks for BBCode.
WARNING: the text between the <a></a>-Tags is discarded when html or punctuation mode is used.
Cheers,
Ingo
File Added: ctmailcloak.php
Logged In: YES
user_id=1505753
Originator: YES
Uploaded an updated version of the proposed patch:
* cloaking methods are made exclusive alternatives: only one can be used at a time
* modes HTML and PUNCTUATION do now include the descriptive text of mailto-links by creating a string containing both: DESCRIPTION (CLOAKED_EMAIL)
File Added: ctmailcloak.zip
Logged In: YES
user_id=1505753
Originator: YES
File Added: ctmailcloak.zip
3ed update of proposed patch (RegExp further improved?)
Logged In: YES
user_id=1505753
Originator: YES
File Added: ctmailcloak.zip
Logged In: YES
user_id=799761
Originator: NO
I have merged your patch, except for the BBcode which is out of context in this drabot.
Can you please check if it works OK?
Logged In: YES
user_id=1505753
Originator: YES
Works like a charm here in all 3 modes (clean install of Drake 0.4.11 RC8 r5658).Thanks a lot.
The only remaining issue is bad HTML-markup that will confuse the JavaScript-Mode a bit, but this should probably be handled elsewhere (like the WYSIWYG-editors).
The BBCode was just added in my version to keep compatibility with some older version of my own cloaker bot for Limbo and for respective the BB-Code.
Cheers,
Ingo
Test-Page below:
<p>as.d_df@test.co.uk<br />
as.d_df@test.com<br />
as.d_df@test.co.uk.<br />
as.d_df@test.com<br />
<a class="sdf" href="mailto:as.d_df@test.co.uk" title="sd">as.d_df@test.co.uk</a><br />
<a href="mailto:as.d_df@test.de">as.d_df@test.de</a><br />
<a class="sdf" href="mailto:as.d_df@test.co.uk" title="sd">234@fd.de</a><br />
<a href="mailto:as.d_df@test.de">23e4@fdsdf.de</a><br />
<a href="mailto:as.d_df@test.de">dfg</a>.<br />
<a href="mailto:as.d_df@test.de">23e4@fdsdf.de<br />
</a><a href="mailto:as.d_df@test.de">23e4@fdsdf.de</a><br />
23e4@fdsdf.de</p>
===================================