public static function HttpblResponse::httpbl_honeylink in http:BL 8
Return HTML code with hidden Honeypot link in one of several styles.
Parameters
string $link: the link to a honeypot script.
string $word: the text of the link.
Return value
string The formatted link.
Overrides HttpblResponseInterface::httpbl_honeylink
2 calls to HttpblResponse::httpbl_honeylink()
- HttpblResponse::buildHoneypot in src/
HttpblResponse.php - Create a (standalone) Honeypot link.
- httpbl_page_bottom in ./
httpbl.module - Implements hook_page_bottom().
File
- src/
HttpblResponse.php, line 167
Class
- HttpblResponse
- HttpblResponse builds the final response to request.
Namespace
Drupal\httpblCode
public static function httpbl_honeylink($link, $word) {
if (!$link) {
return empty($honeypot);
}
// Randomize the switch to determine which style will be used.
switch (mt_rand(0, 5)) {
case 0:
// Formats a nofollow link with text as an html comment.
// WCAG compliant using aria-hidden="true".
// Example: <div><a aria-hidden="true" rel="nofollow" href="http://example.com/sites/all/scripts/disorder.php"><!-- alexander shoes --></a></div>
// Test note: D8 Chrome Invisible, Firefox Invisible, Safari Invisible.
return '<div><a aria-hidden="true" rel="nofollow" href="' . $link . '"><!-- ' . $word . '--></a></div>';
case 1:
// Formats a nofollow link and text in a style hidden anchor tag.
// WCAG compliant using aria-hidden="true".
// Example: <div><a aria-hidden="true" hidden rel="nofollow" href="http://example.com/sites/all/scripts/disorder.php" >alexander shoes</a></div>
// Test note: D8 Chrome Invisible, Firefox Invisible, Safari Invisible.
// Legacy for D5, D6 and D7: '<div><a rel="nofollow" style="display: none;" href="' . $link . '" >' . $word . '</a></div>';
return '<div><a aria-hidden="true" hidden rel="nofollow" href="' . $link . '">' . $word . '</a></div>';
case 2:
// Format a nofollow link and text inside a style hidden div tag.
// WCAG compliant using aria-hidden="true".
// Example: <div hidden><a aria-hidden="true" rel="nofollow" href="http://example.com/sites/all/scripts/disorder.php">alexander shoes</a></div>
// Test note: D8 Chrome Invisible, Firefox Invisible, Safari Invisible.
// Legacy for D5, D6 and D7: '<div style="display: none;"><a rel="nofollow" href="' . $link . '">' . $word . '</a></div>';
return '<div hidden><a aria-hidden="true" rel="nofollow" href="' . $link . '">' . $word . '</a></div>';
case 3:
// Formats a nofollow link with no text.
// WCAG compliant using aria-hidden="true".
// Example: <div><a aria-hidden="true" rel="nofollow" href="http://example.com/sites/all/scripts/disorder.php"></a></div>
// Test Notes: D8 Chrome Invisible, Firefox Invisible, Safari Invisible.
return '<div><a aria-hidden="true" rel="nofollow" href="' . $link . '"></a></div>';
case 4:
// Formats entire link and text as an HTML comment.
// WCAG compliant using aria-hidden="true".
// Example: <!-- <a aria-hidden="true" href="http://example.com/sites/all/scripts/disorder.php">alexander shoes</a> -->
// Test Notes: D8 Chrome Invisible, Firefox Invisible, Safari Invisible.
return '<!-- <a aria-hidden="true" href="' . $link . '">' . $word . '</a> -->';
case 5:
// Formats a nofollow link with text in style hidden span tag.
// WCAG compliant using aria-hidden="true".
// Example: <div><a aria-hidden="true" rel="nofollow" href="http://example.com/sites/all/scripts/disorder.php"><span hidden>alexander shoes</span></a></div>
// Test Notes: D8 Chrome Invisible, Firefox Invisible, Safari Invisible.
// Legacy for D5, D6 and D7: '<div><a rel="nofollow" href="' . $link . '"><span style="display: none;">' . $word . '</span></a></div>';
return '<div><a aria-hidden="true" rel="nofollow" href="' . $link . '"><span hidden>' . $word . '</span></a></div>';
}
return empty($honeypot);
}