includes/email.php
changeset 48 fc9762553a3c
parent 21 663fcf528726
child 73 0a74676a2f2f
equal deleted inserted replaced
47:d6361ccbd2bd 48:fc9762553a3c
   593    * @return string
   593    * @return string
   594    */
   594    */
   595    
   595    
   596   function mask_address($email)
   596   function mask_address($email)
   597   {
   597   {
   598     return str_replace('.', ' <DOT> ', str_replace('@', ' <AT> ', $email));
   598     $at = array(' (AT) ', ' __AT__ ', ' *AT* ', ' [AT] ', ' <AT> ', ' <__AT__> ');
       
   599     $dot = array(' (DOT) ', ' __DOT__ ', ' *DOT* ', ' [DOT] ', ' <DOT> ', ' <__DOT__> ');
       
   600     while(strstr($email, '@'))
       
   601     {
       
   602       $my_at = $at[ array_rand($at) ];
       
   603       $email = str_replace_once('@', $my_at, $email);
       
   604     }
       
   605     while(strstr($email, '.'))
       
   606     {
       
   607       $my_dot = $dot[ array_rand($dot) ];
       
   608       $email = str_replace_once('.', $my_dot, $email);
       
   609     }
       
   610     return $email;
   599   }
   611   }
   600   
   612   
   601   /**
   613   /**
   602    * Turn a string of text into hex-encoded HTML entities
   614    * Turn a string of text into hex-encoded HTML entities
   603    * @param string $text the text to encode
   615    * @param string $text the text to encode