示例#1
0
 /**
  * Handles an [email] tag. Creates a link to email an address.
  *
  * @param	string	If tag has option, the displayable email name. Else, the email address.
  * @param	string	If tag has option, the email address.
  *
  * @return	string	HTML representation of the tag.
  */
 protected function handle_bbcode_email($text, $link = '')
 {
     $rightlink = trim($link);
     if (empty($rightlink)) {
         // no option -- use param
         $rightlink = trim($text);
     }
     $rightlink = str_replace(array('`', '"', "'", '['), array('`', '"', ''', '['), $this->stripSmilies($rightlink));
     if (!trim($link) or $text == $rightlink) {
         $tmp = vB5_String::unHtmlSpecialChars($text);
         if (vB_String::vbStrlen($tmp) > 55 and $this->isWysiwyg() == false) {
             $text = vB5_String::htmlSpecialCharsUni(vbchop($tmp, 36) . '...' . substr($tmp, -14));
         }
     }
     // remove double spaces -- fixes issues with wordwrap
     $rightlink = str_replace('  ', '', $rightlink);
     // email hyperlink (mailto:)
     if (vB5_String::isValidEmail($rightlink)) {
         return "<a href=\"mailto:{$rightlink}\">{$text}</a>";
     } else {
         return $text;
     }
 }