#21 ctmailcloak: js-option does not work with mailto links

closed-accepted
Daniel
None
4
2008-03-27
2008-02-06
j-fanque
No

In JavaScript mode the drabot "ctemailcloak" doesn't properly handle mailto-links (as produced by the WYSIWYG-editors) resulting in broken markup.

Discussion

  • j-fanque

    j-fanque - 2008-02-06
     
  • j-fanque

    j-fanque - 2008-02-06

    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

     
  • j-fanque

    j-fanque - 2008-02-06
    • summary: ctemailcloak: js-option does not work with mailto links --> ctmailcloak: js-option does not work with mailto links
    • priority: 5 --> 4
    • status: open --> pending-works-for-me
     
  • Daniel

    Daniel - 2008-02-06
    • labels: 918146 -->
    • status: pending-works-for-me --> open
     
  • j-fanque

    j-fanque - 2008-02-07

    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

     
  • j-fanque

    j-fanque - 2008-02-10

    Logged In: YES
    user_id=1505753
    Originator: YES

    File Added: ctmailcloak.zip

     
  • j-fanque

    j-fanque - 2008-02-12

    3ed update of proposed patch (RegExp further improved?)

     
  • j-fanque

    j-fanque - 2008-02-12

    Logged In: YES
    user_id=1505753
    Originator: YES

    File Added: ctmailcloak.zip

     
  • Daniel

    Daniel - 2008-03-23
    • assigned_to: nobody --> legolas558
    • status: open --> pending-accepted
     
  • Daniel

    Daniel - 2008-03-23

    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?

     
  • j-fanque

    j-fanque - 2008-03-27
    • status: pending-accepted --> closed-accepted
     
  • j-fanque

    j-fanque - 2008-03-27

    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>
    ===================================

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks