gravatar() public static method

Gravatar pic
public static gravatar ( $email, integer $s = 128, string $d = 'mm', string $r = 'g', boolean $img = false, array $atts = [] ) : string
$email
$s integer
$d string
$r string
$img boolean
$atts array
return string
Example #1
0
 /**
  * 对邮件占位符进行替换
  * 支持:
  * <pre>
  *      {SITE_NAME} : 站点名称
  *      {nickname}  : 当前用户名称
  *      {email}     : 用户电子邮件
  *      {code}      : 验证码
  *      {newPassword}: 新密码
  *      {useTraffic}: 已用流量
  *      {transfer}  : 总流量
  *      {expireTime}: 到期时间
  *      {avatar}:     用户头像 (必须与 {email} 同时使用)
  *      {REGISTER_URL}: 注册校验链接
  * </pre>
  * @param $content
  * @param $params array
  * @return string
  */
 public static function placeholderReplace($content, $params)
 {
     if ($params['REGISTER_URL'] != null) {
         $url = BASE_URL . 'auth/verification?verification=' . urlencode($params['REGISTER_URL']);
         $params['REGISTER_URL'] = "<a href=\"{$url}\" target=\"_blank\" title=\"点击校验您的账户并完成注册!\">{$url}</a>";
     }
     if ($params['avatar'] === true) {
         $params['avatar'] = Utils::gravatar($params['email']);
     }
     // 替换
     $content = str_replace(['{SITE_NAME}', '{nickname}', '{email}', '{code}', '{newPassword}', '{useTraffic}', '{transfer}', '{expireTime}', '{REGISTER_URL}', '{avatar}'], [SITE_NAME, $params['nickname'], $params['email'], $params['code'], $params['newPassword'], $params['useTraffic'], $params['transfer'], $params['expireTime'], $params['REGISTER_URL'], $params['avatar']], $content);
     return $content;
 }