function gravatar_url($mail, $size, $echo = true)
{
    $rating = Helper::options()->commentsAvatarRating;
    $Request = new Typecho_Request();
    $default = null;
    $url = Typecho_Common::gravatarUrl($mail, $size, $rating, $default, $Request->isSecure());
    if ($echo) {
        echo $url;
    } else {
        return $url;
    }
}
Exemple #2
0
 /**
  * 调用gravatar输出用户头像
  *
  * @access public
  * @param integer $size 头像尺寸
  * @param string $rating 头像评级
  * @param string $default 默认输出头像
  * @param string $class 默认css class
  * @return void
  */
 public function gravatar($size = 40, $rating = 'X', $default = NULL, $class = NULL)
 {
     $url = Typecho_Common::gravatarUrl($this->mail, $size, $rating, $default, $this->request->isSecure());
     echo '<img' . (empty($class) ? '' : ' class="' . $class . '"') . ' src="' . $url . '" alt="' . $this->screenName . '" width="' . $size . '" height="' . $size . '" />';
 }
 /**
  * 调用gravatar输出用户头像
  *
  * @access public
  * @param integer $size 头像尺寸
  * @param string $default 默认输出头像
  * @return void
  */
 public function gravatar($size = 32, $default = NULL)
 {
     if ($this->options->commentsAvatar && 'comment' == $this->type) {
         $rating = $this->options->commentsAvatarRating;
         $this->pluginHandle(__CLASS__)->trigger($plugged)->gravatar($size, $rating, $default, $this);
         if (!$plugged) {
             $url = Typecho_Common::gravatarUrl($this->mail, $size, $rating, $default, $this->request->isSecure());
             echo '<img class="avatar" src="' . $url . '" alt="' . $this->author . '" width="' . $size . '" height="' . $size . '" />';
         }
     }
 }
Exemple #4
0
include 'menu.php';
$stat = Typecho_Widget::widget('Widget_Stat');
?>

<div class="main">
    <div class="body container">
        <?php 
include 'page-title.php';
?>
        <div class="row typecho-page-main">
            <div class="col-mb-12 col-tb-3">
                <p><a href="http://gravatar.com/emails/" title="<?php 
_e('在 Gravatar 上修改头像');
?>
"><?php 
echo '<img class="profile-avatar" src="' . Typecho_Common::gravatarUrl($user->mail, 220, 'X', 'mm', $request->isSecure()) . '" alt="' . $user->screenName . '" />';
?>
</a></p>
                <h2><?php 
$user->screenName();
?>
</h2>
                <p><?php 
$user->name();
?>
</p>
                <p><?php 
_e('目前有 <em>%s</em> 篇日志, 并有 <em>%s</em> 条关于你的评论在 <em>%s</em> 个分类中.', $stat->myPublishedPostsNum, $stat->myPublishedCommentsNum, $stat->categoriesNum);
?>
</p>
                <p><?php 
Exemple #5
0
/**
 * 重写评论显示函数
 */
function threadedComments($comments, $options)
{
    $commentClass = '';
    if ($comments->authorId) {
        if ($comments->authorId == $comments->ownerId) {
            $commentClass .= ' comment-by-author';
        } else {
            $commentClass .= ' comment-by-user';
        }
    }
    $commentLevelClass = $comments->levels > 0 ? ' comment-child' : ' comment-parent';
    ?>
<li itemscope itemtype="http://schema.org/UserComments" id="<?php 
    $comments->theId();
    ?>
" class="comment-body<?php 
    if ($comments->levels > 0) {
        echo ' comment-child';
        $comments->levelsAlt(' comment-level-odd', ' comment-level-even');
    } else {
        echo ' comment-parent';
    }
    $comments->alt(' comment-odd', ' comment-even');
    echo $commentClass;
    ?>
">
    <div class="comment-avatar">
		<img class="avatar" src="<?php 
    echo Typecho_Common::gravatarUrl($comments->mail, $options->avatarSize, null, $options->defaultAvatar);
    ?>
" width="<?php 
    echo $options->avatarSize;
    ?>
">
	</div>
    <div class="comment-meta">
        <div class="comment-meta-author"><?php 
    $comments->author();
    ?>
</div>
        <div class="comment-meta-time">
        <a href="<?php 
    $comments->permalink();
    ?>
"><time itemprop="commentTime" datetime="<?php 
    $comments->date('c');
    ?>
"><?php 
    $options->beforeDate();
    $comments->date($options->dateFormat);
    $options->afterDate();
    ?>
</time></a>
        </div>
        <?php 
    if ('waiting' == $comments->status) {
        ?>
        <em class="comment-awaiting-moderation"><?php 
        $options->commentStatus();
        ?>
</em>
        <?php 
    }
    ?>
        <div class="comment-meta-reply">
            <?php 
    $comments->reply($options->replyWord);
    ?>
        </div>
    </div>
    <div class="comment-content" itemprop="commentText">
    <?php 
    $comments->content();
    ?>
    </div>
    
    <?php 
    if ($comments->children) {
        ?>
    <div class="comment-children" itemprop="discusses">
        <?php 
        $comments->threadedComments();
        ?>
    </div>
    <?php 
    }
    ?>
</li>
<?php 
}
Exemple #6
0
if (!defined('__TYPECHO_ROOT_DIR__')) {
    exit;
}
$this->need('header.php');
?>

<div class="main-inner">
    <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
        <div class="post-header">
			<div class="post-author clearfix">
				<a class="avatar fleft" href="<?php 
$this->author->permalink();
?>
"><img width="48" src="<?php 
echo Typecho_Common::gravatarUrl($this->author->mail, 48, null, null);
?>
" alt="" /></a>
				<p><span class="label"><?php 
_e('作者');
?>
</span> <a href="<?php 
$this->author->permalink();
?>
"><?php 
$this->author();
?>
</a> <span title="<?php 
_e('最后编辑于');
echo date('Y.m.d H:i:s', $this->modified);
?>