当前位置: 首页>>代码示例>>PHP>>正文


PHP gravatar\Gravatar类代码示例

本文整理汇总了PHP中cebe\gravatar\Gravatar的典型用法代码示例。如果您正苦于以下问题:PHP Gravatar类的具体用法?PHP Gravatar怎么用?PHP Gravatar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Gravatar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Renders the image.
  * Based on user settings the avatar can be uploaded image, Gravatar image or default one.
  * @return string
  */
 public function run()
 {
     if ($this->author instanceof User) {
         $avatar = Html::img(Helper::defaultAvatar(), ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Html::encode($this->author->podiumName)]);
         $meta = $this->author->meta;
         if ($meta) {
             if (!empty($meta->gravatar)) {
                 $avatar = Gravatar::widget(['email' => $this->author->email, 'defaultImage' => 'identicon', 'rating' => 'r', 'options' => ['alt' => Html::encode($this->author->podiumName), 'class' => 'podium-avatar img-circle img-responsive center-block']]);
             } elseif (!empty($meta->avatar)) {
                 $avatar = Html::img('/avatars/' . $meta->avatar, ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Html::encode($this->author->podiumName)]);
             }
         }
         $name = $this->showName ? $this->author->podiumTag : '';
     } else {
         $avatar = Html::img(Helper::defaultAvatar(), ['class' => 'podium-avatar img-circle img-responsive center-block', 'alt' => Yii::t('podium/view', 'User deleted')]);
         $name = $this->showName ? Helper::deletedUserTag(true) : '';
     }
     $name = $this->showName ? Html::tag('p', $name, ['class' => 'avatar-name']) : '';
     return $avatar . $name;
 }
开发者ID:Avenger1,项目名称:yii2-podium,代码行数:25,代码来源:Avatar.php

示例2: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     if (strtolower($this->position) == 'header') {
         if (!Yii::$app->user->isGuest) {
             $user = Yii::$app->user->identity;
             $avatar = \cebe\gravatar\Gravatar::widget(['email' => $user->email, 'options' => ['alt' => '', 'class' => 'avatar', 'width' => 24, 'height' => 24], 'defaultImage' => 'retro', 'size' => 24]);
             $items[] = ['label' => $avatar . Yii::$app->user->identity->username, 'url' => ['/user/default/view', 'id' => Yii::$app->user->id], 'options' => ['class' => 'navbar-nav-profile']];
         }
         if (Yii::$app->user->isGuest) {
             $items[] = ['label' => 'Регистрация', 'url' => ['/user/identity/registration']];
             $items[] = ['label' => 'Вход', 'url' => ['/user/identity/login']];
         } else {
             $items[] = ['label' => 'Выход', 'url' => ['/user/identity/logout']];
         }
         return Menu::widget(['items' => $items, 'encodeLabels' => false, 'options' => ['class' => 'navbar-nav']]);
     } elseif (strtolower($this->position) == 'sub_header') {
         $items[] = ['label' => 'Последние темы', 'url' => ['/topic/default/list']];
         if (!Yii::$app->getUser()->getIsGuest()) {
             $id = Yii::$app->getUser()->getIdentity()->id;
             $notifications = UserMention::countByUser($id);
             if ($notifications > 0) {
                 $items[] = ['label' => 'Уведомления <span class="counter">' . $notifications . '</span>', 'url' => ['/notify/default/view']];
             } else {
                 $items[] = ['label' => 'Уведомления', 'url' => ['/notify/default/view']];
             }
         }
         $items[] = ['label' => 'Пользователи', 'url' => ['/user/default/list']];
         if (!Yii::$app->getUser()->getIsGuest()) {
             $items[] = ['label' => 'Создать тему', 'url' => ['/topic/default/create']];
         }
         return Menu::widget(['items' => $items, 'encodeLabels' => false, 'options' => ['class' => 'sub-navbar-nav']]);
     } elseif (strtolower($this->position) == 'footer') {
         $items = [['label' => 'Правила пользования', 'url' => ['/frontend/default/terms']], ['label' => '&bull;'], ['label' => 'Обратная связь', 'url' => ['/frontend/default/feedback']]];
         return Menu::widget(['encodeLabels' => false, 'items' => $items]);
     }
     return null;
 }
开发者ID:heartshare,项目名称:linuxforum,代码行数:40,代码来源:Navigation.php

示例3:

<?php

use yii\helpers\Html;
?>

<!-- Sidebar user panel -->
<?php 
if (!\Yii::$app->user->isGuest) {
    ?>
    <div class="user-panel">
        <div class="pull-left image">
            <?php 
    echo \cebe\gravatar\Gravatar::widget(['email' => \Yii::$app->user->identity->email, 'options' => ['alt' => \Yii::$app->user->identity->username], 'size' => 64]);
    ?>
        </div>
        <div class="pull-left info">
            <p><?php 
    echo \Yii::$app->user->identity->username;
    ?>
</p>

            <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
        </div>
    </div>
<?php 
}
?>


<!-- search form -->
<!--<form action="#" method="get" class="sidebar-form">
开发者ID:noorafree,项目名称:makmakan,代码行数:31,代码来源:_sidebar.php

示例4: foreach

</p>
                    </div>
                    <p class="reply">Reply</p>
                </article>
                    <?php 
        foreach ($post->comments as $childComment) {
            ?>
                        <?php 
            if (!empty($childComment->parentComment) && $childComment->parentComment->id == $comment->id) {
                ?>
                <ul class="children">
                    <li class="comment">
                        <article class="media">
                            <a class="pull-left" href="#">
                                <?php 
                echo \cebe\gravatar\Gravatar::widget(['email' => $comment->email, 'options' => ['alt' => $comment->name, 'class' => 'media-object'], 'size' => 87]);
                ?>
                            </a>
                            <div class="media-body">
                                <h5 class="media-heading"><?php 
                echo $comment->name;
                ?>
</h5>
                                <p class="comment-date"><?php 
                echo date('F j, Y \\a\\t g:i a', strtotime($comment->created_at));
                ?>
</p>
                                <p><?php 
                echo kartik\markdown\Markdown::convert($comment->body);
                ?>
</p>
开发者ID:ninjacto,项目名称:ninjacto.com,代码行数:31,代码来源:view.php

示例5: function

<?php

use app\models\User;
use cebe\gravatar\Gravatar;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', ['label' => 'Gravatar', 'attribute' => 'email', 'value' => function (User $user) {
    return Gravatar::widget(['email' => $user->email, 'size' => 32]);
}, 'format' => 'raw'], 'email:email', 'created_at:datetime', 'updated_at:datetime', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
开发者ID:starcode-solutions,项目名称:star-tracker,代码行数:19,代码来源:index.php

示例6: displayComment

    /**
     * @param     $comment
     * @param int $depth
     *
     * @throws \Exception
     */
    protected function displayComment($comment, $depth = 0)
    {
        echo Html::beginTag('div', ['id' => 'comment-' . $comment->id, 'class' => $comment->child ? 'parent depth-' . $depth : 'depth-' . $depth]);
        ?>

        <?php 
        if (Option::get('show_avatars')) {
            ?>
            <div class="media-left avatar">
                <?php 
            echo Gravatar::widget(['email' => $comment->comment_author_email, 'options' => ['alt' => $comment->comment_author, 'class' => 'avatar', 'width' => $this->avatarSize, 'height' => $this->avatarSize], 'defaultImage' => Option::get('avatar_default'), 'rating' => Option::get('avatar_rating'), 'size' => $this->avatarSize]);
            ?>
            </div>
        <?php 
        }
        ?>
        <div class="media-body comment-body">
            <p class="meta">
                <strong class="author vcard">
                    <span class="fn">
                        <?php 
        echo $comment->comment_author ? $comment->comment_author : \Yii::t('writesdown', 'Anonymous');
        ?>
                    </span>
                </strong>
                -
                <time class="date published" datetime="<?php 
        echo \Yii::$app->formatter->asDatetime($comment->comment_date);
        ?>
">
                    <?php 
        echo \Yii::$app->formatter->asDate($comment->comment_date);
        ?>
                </time>
                <?php 
        if ($depth < $this->maxDepth && $this->enableThreadComments) {
            echo Html::a(\Yii::t('writesdown', 'Reply'), '#', ['class' => 'comment-reply-link', 'data-id' => $comment->id]);
        }
        ?>
            </p>
            <div class="comment-content">
                <?php 
        echo $comment->comment_content;
        ?>
            </div>
        </div>
        <?php 
        echo Html::endTag('div');
    }
开发者ID:ochiem,项目名称:app-cms,代码行数:55,代码来源:BaseComment.php

示例7: elseif

    ?>
</strong>
                    </div>
                </div>
            </div>
<?php 
}
?>
        </div>
    </div>
    <div class="col-sm-3">
<?php 
if (!empty($model->meta->gravatar)) {
    ?>
        <?php 
    echo Gravatar::widget(['email' => PodiumModule::getInstance()->userComponent == PodiumModule::USER_OWN ? $model->email : $model->getEmail(), 'defaultImage' => 'identicon', 'rating' => 'r', 'options' => ['alt' => Yii::t('podium/view', 'Your Gravatar image'), 'class' => 'img-circle img-responsive']]);
} elseif (!empty($model->meta->avatar)) {
    ?>
        <img class="img-circle img-responsive" src="/avatars/<?php 
    echo $model->meta->avatar;
    ?>
" alt="<?php 
    echo Yii::t('podium/view', 'Your avatar');
    ?>
">
<?php 
} else {
    ?>
        <img class="img-circle img-responsive" src="<?php 
    echo Helper::defaultAvatar();
    ?>
开发者ID:keltstr,项目名称:yii2-podium,代码行数:31,代码来源:details.php

示例8: buildImgTag

 /**
  * @inheritdoc
  */
 protected function buildImgTag()
 {
     return Gravatar::widget($this->gravatarOptions);
 }
开发者ID:memclutter,项目名称:yii2-admin-lte,代码行数:7,代码来源:GravatarSidebarUserPanel.php

示例9:

                    </li>
                    <li class="divider"></li>
                    <li>
                        <a class="text-center" href="#">
                            <strong>See All Alerts</strong>
                            <i class="fa fa-angle-right"></i>
                        </a>
                    </li>
                </ul>
                <!-- /.dropdown-alerts -->
            </li>
            <!-- /.dropdown -->
            <li class="dropdown">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                    <?php 
echo Gravatar::widget(['email' => Yii::$app->user->identity->email, 'size' => 16]);
?>
  <i class="fa fa-caret-down"></i>
                </a>
                <ul class="dropdown-menu dropdown-user">
                    <li>
                        <p class="navbar-text">
                            <?php 
echo Yii::$app->user->identity->email;
?>
                        </p>
                    </li>
                    <li class="divider"></li>
                    <li><?php 
echo Html::a('<i class="fa fa-user fa-fw"></i> ' . Yii::t('app', 'User Profile'), ['/profile/index']);
?>
开发者ID:starcode-solutions,项目名称:star-tracker,代码行数:31,代码来源:main.php

示例10: elseif

$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
    <div class="col-sm-3">
        <?php 
echo $this->render('/elements/profile/_navbar', ['active' => 'profile']);
?>
    </div>
    <div class="col-sm-9">
        <div class="panel panel-default">
            <div class="panel-body">
<?php 
if (!empty($model->meta->gravatar)) {
    ?>
                <?php 
    echo Gravatar::widget(['email' => $model->email, 'defaultImage' => 'identicon', 'rating' => 'r', 'options' => ['alt' => Html::encode($model->podiumName), 'class' => 'podium-avatar img-circle img-responsive pull-right']]);
} elseif (!empty($model->meta->avatar)) {
    ?>
                <img class="podium-avatar img-circle img-responsive pull-right" src="/avatars/<?php 
    echo $model->meta->avatar;
    ?>
" alt="<?php 
    echo Html::encode($model->podiumName);
    ?>
">
<?php 
} else {
    ?>
                <img class="podium-avatar img-circle img-responsive pull-right" src="<?php 
    echo Helper::defaultAvatar();
    ?>
开发者ID:Avenger1,项目名称:yii2-podium,代码行数:31,代码来源:profile.php

示例11:

<!-- Sidebar user panel -->
<?php 
if (!\Yii::$app->user->isGuest) {
    ?>
    <div class="user-panel">
        <div class="pull-left image">
            <?php 
    echo \cebe\gravatar\Gravatar::widget(['email' => \Yii::$app->user->identity->profile->gravatar_email === null ? \Yii::$app->user->identity->email : \Yii::$app->user->identity->profile->gravatar_email, 'options' => ['alt' => \Yii::$app->user->identity->username], 'size' => 64]);
    ?>
        </div>
        <div class="pull-left info">
            <p><?php 
    echo \Yii::$app->user->identity->username;
    ?>
</p>

            <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
        </div>
    </div>
<?php 
}
?>


<!-- search form -->
<!--<form action="#" method="get" class="sidebar-form">
    <div class="input-group">
        <input type="text" name="q" class="form-control" placeholder="Search..."/>
        <span class="input-group-btn">
            <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
开发者ID:tqsq2005,项目名称:app,代码行数:30,代码来源:_sidebar.php

示例12:

">
                                <time is="time-ago" datetime="<?php 
    echo Yii::$app->formatter->asDatetime($topic->first_post_created_at, 'php:c');
    ?>
" title="<?php 
    echo Yii::$app->formatter->asDatetime($topic->first_post_created_at, 'long');
    ?>
"><?php 
    echo $dateTimeAgo->get($topic->first_post_created_at);
    ?>
</time>
                            </a>
                        </div>
                        <div class="question-author-avatar">
                            <?php 
    echo \cebe\gravatar\Gravatar::widget(['email' => $topic->firstPostUser->email, 'options' => ['alt' => $topic->firstPostUser->username, 'class' => 'avatar', 'width' => 32, 'height' => 32], 'defaultImage' => 'retro', 'size' => 32]);
    ?>
                        </div>
                        <div class="question-author-info">
                            <a href="<?php 
    echo Url::toRoute(['/user/default/view', 'id' => $topic->first_post_user_id]);
    ?>
"><?php 
    echo $formatter->asText($topic->first_post_username);
    ?>
</a>
                        </div>
                    </div>
                </div>
            </div>
            <?php 
开发者ID:marley-php,项目名称:linuxforum,代码行数:31,代码来源:list.php

示例13: foreach

<div class="component-comments lang-en" id="comments">
    <?php 
if (!empty($comments)) {
    ?>
        <ol>
        <?php 
    foreach ($comments as $comment) {
        ?>
            <li class="row">
                <div class="col-xs-1 author" id="c<?php 
        echo $comment->id;
        ?>
">
                    <?php 
        echo \cebe\gravatar\Gravatar::widget(['email' => $comment->user->email, 'options' => ['alt' => $comment->user->username], 'size' => 32]);
        ?>
                    <?php 
        echo Html::encode($comment->user->username);
        ?>
                </div>
                <div class="col-xs-8 text">
                    <?php 
        echo \yii\helpers\Markdown::process($comment->text);
        ?>
                </div>
                <div class="col-xs-3">
                    <a href="#c<?php 
        echo $comment->id;
        ?>
">#<?php 
开发者ID:philippfrenzel,项目名称:yiiframework.com,代码行数:30,代码来源:comments.php

示例14: implode

            </h3>

            <p>
                <?php 
echo '<span class="label label-default">' . implode("</span><br/><span class='label label-default'>", $version->keywords) . '</span><br/>';
?>
            </p>
            <?php 
// TODO: WE CANNOT REMOVE isset(), fires error if not defined.
if (isset($model->authors)) {
    ?>
                <h5>Maintainers</h5>
                <?php 
    foreach ($model->authors as $author) {
        echo "<p>";
        if (isset($author->email)) {
            echo Html::a(Gravatar::widget(['email' => $author->email, 'options' => ['alt' => isset($author->name) ? $author->name : ''], 'size' => 32]), isset($author->homepage) ? $author->homepage : '#');
        }
        echo " " . (isset($author->name) ? $author->name : '');
        echo "</p>";
    }
    ?>
            <?php 
}
?>
        </div>
    </div>

    <!-- Modals -->
<?php 
echo $this->render('_modals', ['name' => $model->name]);
开发者ID:NageshVeeravalli,项目名称:yii2-packaii,代码行数:31,代码来源:_detail.php

示例15:

        echo Html::beginTag('li', ['class' => $answer['is_answer'] ? 'out' : 'in', 'id' => 'answer-' . $answer['answer_id']]);
        ?>
                        <?php 
        if ($answer['author'] == 'anonym') {
            ?>
                            <?php 
            $answer['email'] = $model->anonym_email;
            ?>
                        <?php 
        }
        ?>
                        <?php 
        if (isset($answer['email']) && filter_var($answer['email'], FILTER_VALIDATE_EMAIL)) {
            ?>
                            <?php 
            echo Gravatar::widget(['email' => $answer['email'], 'defaultImage' => 'identicon', 'options' => ['alt' => $answer['author'], 'class' => 'avatar'], 'size' => 45]);
            ?>
                        <?php 
        }
        ?>

                        <div class="message">
                            <span class="arrow"></span>

                            <div class="info">
                                <?php 
        echo Html::a($answer['author'], ['@client/view', 'id' => $answer['author_id']], ['class' => 'name']);
        ?>
&nbsp;
                                <?php 
        echo Html::tag('span', Yii::$app->formatter->asDatetime($answer['create_time']), ['class' => 'datetime']);
开发者ID:hiqdev,项目名称:hipanel-module-ticket,代码行数:31,代码来源:_chat.php


注:本文中的cebe\gravatar\Gravatar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。