We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35756
    • 166 Posts
    Hi there!

    I'm trying to use the SpamGuard 1.5.0-pl-Package in Revo 2.3.3 which works fine so far. But when I check my page through the w3c-validator I'm getting a lot of errors. This is the html-output:

    <figure class="team">
    <a title="John Doe" href="" class="SpamGuard" data-tooltip="Send an Email to John Doe" uT="de" uD="nameofwebsite" uU="john" d="">Kontakt</a>									</figure>


    And these are the validator-errors:

    Attribute ut not allowed on element a at this point.
    Attribute ud not allowed on element a at this point.
    Attribute uu not allowed on element a at this point.
    Attribute d not allowed on element a at this point.

    That's all "ok" so far, because those attributes are surely unknown.

    Now I thought I could add a "data-" to each attribute. The related code in the SpamGuard-snippet I found and edited...but then the correct Email doesn't get used, instead the email is "undefined".

    I tried it this way (snippet code from line 67 with my edits):

    // parse the email addresses
    $emailFields = SpamGuardParser($email, $emailName, 'data-u');
    if (!empty($cc)) { $ccFields = SpamGuardParser($cc, $ccName, 'c'); }
    if (!empty($bcc)) { $bccFields = SpamGuardParser($bcc, $bccName, 'b'); }
    
    // format subject and body text values
    if (!empty($subject)) { $subject = 's="'.rawurlencode($subject).'" '; }
    if (!empty($body)) { $body = 'b="'.rawurlencode($body).'" '; }
    
    // format display values
    $display = 'd="'.$display.'"';
    
    // create the formatted link for the page:
    $output = '<a title="[[+name]]" href="'.$defaultLink.'" ';
    $output.= 'class="'.$class.' '.$classes.';
    $output.= 'data-tooltip="Send an Email to [[+name]]" ';
    $output.= $emailFields . $ccFields .'data-'.$bccFields;
    $output.= $subject . $body;
    $output.= $display;
    $output.= '>'.$defaultDisplay.'</a>';
    
    return $output;


    So now the html-output looks like this:

    <figure class="team">
    <a title="John Doe" href="" class="SpamGuard" data-tooltip="Send an email to John Doe" data-uT="de" data-uD="nameofwebsite" data-uU="john" data-d="">Kontakt</a>
    </figure>


    But as I wrote before now the email-adresses gets an "undefined" set...anyone knows how to solve this?

    This question has been answered by profilneurotiker. See the first response.

    • discuss.answer
      • 35756
      • 166 Posts
      Ok, got it...I didn't see the Chunk that is holding the necessary JS.

      So I edited this line:

      $emailFields = SpamGuardParser($email, $emailName, 'data-u');


      and this one

      $display = 'data-d="'.$display.'"';


      I don't need the cc- or bcc-function, nor the subject or body, but I guess this would work the same way.

      Afterwards I edited the chunk names SpamGuard-JS by adding these "data-" to each needed variable...that's how I got this W3C-valid.