Login   Register  
PHP Classes
elePHPant
Icontem

File: test_hide_mail_link.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Peter Klauer  >  hide_mail_link  >  test_hide_mail_link.php  >  Download  
File: test_hide_mail_link.php
Role: Unit test script
Content type: text/plain
Description: Demo
Class: hide_mail_link
Hides email links from crawlers.
Author: By
Last change: Again, more examples.
Date: 11 years ago
Size: 2,876 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>www.ingoknito.de: Test hide_email_link</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
a.white:active, a.white:link, a.white:visited  { font-family: Verdana,Geneva,Helvetica; 
    text-decoration: underline; color : #293d60; }
a.white:hover  { font-family: Verdana,Geneva,Helvetica; text-decoration: none; 
    color : #293d60; background-color: #ffff00 }
</style>
</head>
<body style="font-family:arial,sans-serif" bgcolor=white text=black link=navy vlink="maroon">
<a href="http://www.ingoknito.de" style="font-family:Comic Sans MS, sans-serif;font-size:17pt;">www.ingoknito.de</a><br>
<br>

<?php

include 'inc_hide_mail_link.php';
$m = new hide_mail_link;
$m->MailtoTextSeparator "_";

$m->put'knito@knito.de');
echo 
"<br>\n";
$m->put'knito@knito.de''A subject''Hallo Knito');
echo 
"<br>\n";
$m->put'knito@knito.de''A subject''Hallo Knito''Peter Klauer');
echo 
"<br>\n";
$m->put'knito@knito.de''A subject''Hallo Knito''<img src="http://www.ingoknito.de/scripts/images/brief.png" border=0 alt="mail to Peter Klauer">');  
echo 
"<br>\n\n";

echo 
'<br>here we set $m->use_entities to 1'."\n".
    
'<br>and set $m->MailtoTextSeparator to &lt;!-- bingo --&gt;<br>'."\n".
    
'(this is an idea from M. Schaedler)<br>'."\n";

$m->use_entities 1;
$m->MailtoTextSeparator '<!-- bingo -->';

$m->put'knito@knito.de');
echo 
"<br>\n";
$m->put'knito@knito.de''A subject''Hallo Knito');
echo 
"<br>\n";
$m->put'knito@knito.de''A subject''Hallo Knito''Peter Klauer');
echo 
"<br>\n";
$m->put'knito@knito.de''A subject''Hallo Knito''<img src="http://www.ingoknito.de/scripts/images/brief.png" border=0 alt="mail to Peter Klauer">');  
echo 
"<br>\n\n";

echo 
'<br>here we set $m->use_entities back to 0 again<br>'."\n";
$m->use_entities 0;

$m->MailtoTextPrefix "mail to: ";
$m->put'knito@knito.de' );
echo 
"<br>\n\n";

echo 
'<br>and here a long email address is cut with MaxStrlen = 34<br>'."\n".
    
'it is not recommended to use this in combination with<br>'."\n".
    
'a long MailtoTextSeparator, surely not with a html-comment<br>'."\n".
    
'&lt;!-- bingo --&gt;. Why not? Try yourself.<br>'."\n\n";
    
$m->MailtoTextSeparator '_';
$m->MailtoTextPrefix '';
$m->MaxStrlen 34;
$m->put'longaddress@verylongdomain.com' );
echo 
"<br>\n\n";

echo 
'<br>here we use a css class.<br>'."\n";

$m->MailtoTextPrefix '';
$m->MailtoTextSeparator '-';
$m->MaxStrlen 0;
$m->CssClass 'white';
$m->put'knito@knito.de' );
echo 
"<br>\n\n";

$m->MailtoTextPrefix '';
$m->MailtoTextSeparator ' ';
$m->MaxStrlen 0;
$m->CssClass 'white';
$m->put'knito@knito.de' );
echo 
"<br>\n\n";

?>
</body>
</html>