src/Utils/StringTools.php
public static function protectEmailLink($email, $name = null, $text = null)
  {
    $email = preg_replace("/\"/", "\\\"", $email);
    if ($name == null) {
      $name = $email;
    }
    if ($text == null) {
      $text = $name;
    }
    $clear = sprintf('document.write(\'<a href="mailto:%s">%s</a>\')', $email, $text);
    $encrypted = '';
    for ($i = 0; $i < strlen($clear); $i++) {
      $encrypted .= '%'. bin2hex(substr($clear, $i, 1));
    }
    return sprintf('<script type="text/javascript">eval(unescape(\'%s\'))</script>', $encrypted);
  }
public static function protectEmailLink($email, $name = null, $text = null)
  {
    $email = preg_replace("/\"/", "\\\"", $email);
    if ($name == null) {
      $name = $email;
    }
    if ($text == null) {
      $text = $name;
    }
    $clear = sprintf('document.write(\'<a href="mailto:%s">%s</a>\')', $email, $text);
    $encrypted = '';
    for ($i = 0; $i < strlen($clear); $i++) {
      $encrypted .= '%'. bin2hex(substr($clear, $i, 1));
    }
    return sprintf('<script type="text/javascript">eval(unescape(\'%s\'))</script>', $encrypted);
  }
Génère un lien mailto protégé

@param  string $email  Adresse mail
@param  string $name   (optional) Nom du contact lié à l'adresse mail
@param  string $text   (optional) Texte à utiliser pour le lien
@return string