str::email PHP Method

email() static public method

Creates an encoded email address, including proper html-tags
static public email ( string $email, string $text = false, string $title = false, string $class = false ) : string
$email string The email address
$text string Specify a text for the email link. If false the email address will be used
$title string An optional title for the html tag.
$class string An optional class name for the html tag.
return string
    static function email($email, $text = false, $title = false, $class = false)
    {
        if (empty($email)) {
            return false;
        }
        $email = (string) $email;
        $string = empty($text) ? $email : $text;
        $email = self::encode($email, 3);
        if (!empty($class)) {
            $class = ' class="' . $class . '"';
        }
        if (!empty($title)) {
            $title = ' title="' . html($title) . '"';
        }
        return '<a' . $title . $class . ' href="mailto:' . $email . '">' . self::encode($string, 3) . '</a>';
    }

Usage Example

Ejemplo n.º 1
0
 static function email($params)
 {
     $url = @$params['email'];
     $class = @$params['class'];
     $title = @$params['title'];
     if (empty($url)) {
         return false;
     }
     return str::email($url, @$params['text'], $title, $class);
 }
All Usage Examples Of str::email