本文整理汇总了PHP中gravatar函数的典型用法代码示例。如果您正苦于以下问题:PHP gravatar函数的具体用法?PHP gravatar怎么用?PHP gravatar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gravatar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contact_info
function contact_info($contactid, $email, $name)
{
global $strUnknown;
//$info .= "<span style='float:right;'>".gravatar($email, 16) . '</span>';
if (!empty($contactid)) {
$info .= "<a href='contact.php?id={$contactid}'>";
$info .= icon('contact', 16);
$info .= "</a>";
} else {
$info .= icon('email', 16);
}
$info .= ' ';
if (!empty($email)) {
$info .= "<a href=\"mailto:{$email}\" class='info'>";
}
if (!empty($name)) {
$info .= "{$name}";
} elseif (!empty($email)) {
$info .= "{$email}";
} else {
$info .= "{$strUnknown}";
}
if (!empty($email)) {
$info .= "<span>" . gravatar($email, 50, FALSE);
$info .= "{$email}";
$info .= "</span>";
$info .= "</a>";
}
if (!empty($contactid)) {
$info .= " (" . contact_site($contactid) . ")";
}
return $info;
}
示例2: getPicture
/**
* @param bool $size
* @return mixed
*/
public function getPicture($size = false)
{
if (!$size) {
$size = config('gravatar.default.size');
}
return gravatar()->get($this->email, ['size' => $size]);
}
示例3: latest_comments
/**
* Set error reporting
*
* @access public
*/
public function latest_comments()
{
$this->_ci->load->model('comments/comments_model');
if ($comments = $this->_ci->comments_model->get_new_comments($this->_ci->session->userdata('user_last_login'))) {
$this->_ci->load->library('table');
$table_template = array('table_open' => '<table class="main" id="grid" width="100%" border="0" cellspacing="0" cellpadding="0">', 'row_start' => '<tr class="second">', 'row_alt_start' => '<tr class="first">');
$this->_ci->table->set_template($table_template);
$this->_ci->table->set_heading(lang('lang_name'), lang('lang_comment'), lang('lang_article'), lang('lang_status'));
foreach ($comments as $item) {
if ($item['comment_approved'] == 'spam') {
$status = '<span class="spam">' . lang('lang_spam') . '</span>';
} elseif ($item['comment_approved'] == 0) {
$status = '<span class="inactive">' . lang('lang_notactive') . '</span>';
} else {
$status = '<span class="active">' . lang('lang_active') . '</span>';
}
$this->_ci->table->add_row('<div class="gravatar"><img class="gravatar" src="' . gravatar($item['comment_author_email'], "PG", "24", "wavatar") . '" /></div>
<strong>
' . $item['comment_author'] . '
</strong>', word_limiter($item['comment_content'], 15) . ' ' . anchor('admin/comments/edit/' . $item['comment_ID'], lang('lang_edit')), anchor('article/' . $item['article_uri'] . '/#comment-' . $item['comment_ID'], $item['article_title']), $status);
}
echo '<h2>' . lang('lang_recent_comments') . '</h2>';
echo $this->_ci->table->generate();
}
}
示例4: profile_image
function profile_image($user_id, $image, $email_hash = NULL, $size = 'medium')
{
$this->ci->load->helper('gravatar');
$picture = base_url() . 'application/views/' . config_item('site_theme') . '/assets/images/' . $size . '_' . config_item('no_profile');
// Does User Have Image
if ($image) {
$image_original = config_item('users_images_folder') . $user_id . '/' . $image;
$image_file = config_item('users_images_folder') . $user_id . '/' . $size . '_' . $image;
// If Thumbnail Exists
if (file_exists($image_file)) {
$picture = base_url() . $image_file;
} elseif (!file_exists($image_file) and file_exists($image_original)) {
$this->ci->load->model('image_model');
$this->ci->image_model->make_thumbnail(config_item('users_images_folder') . $user_id, $image, 'users', $size);
$picture = base_url() . $image_file;
} else {
if (config_item('services_gravatar_enabled') == 'TRUE') {
return gravatar($email_hash, "X", config_item('users_images_' . $size . '_width'), $picture);
}
}
return $picture;
}
if (config_item('services_gravatar_enabled') == 'TRUE') {
$picture = gravatar($email_hash, "X", config_item('users_images_' . $size . '_width'), $picture);
}
return $picture;
}
示例5: gravatar
/**
* Gravatar
*
* Provides for showing Gravatar images.
*
* Usage:
* {{ helper:gravatar email="some-guy@example.com" size="50" rating="g" url-only="true" }}
*
* @return string An image element or the URL to the gravatar.
*/
public function gravatar()
{
$email = $this->attribute('email', '');
$size = $this->attribute('size', '50');
$rating = $this->attribute('rating', 'g');
$url_only = (bool) in_array($this->attribute('url-only', 'false'), array('1', 'y', 'yes', 'true'));
return gravatar($email, $size, $rating, $url_only);
}
示例6: gravatar
/**
* Generate a gravatar
*/
function gravatar($data)
{
$defaults = array('email' => '', 'size' => 60, 'rating' => 'PG');
$options = $this->_ci->settings->get_params($data['attributes'], $defaults);
if ($options['email']) {
return gravatar($options['email'], $options['rating'], $options['size']);
}
return FALSE;
}
示例7: getPictureAttribute
/**
* @return mixed
*/
public function getPictureAttribute()
{
/*
* If user is logged in with a social account, use the avatar associated if available
* Otherwise fallback to the gravatar associated with the social email
*/
if (session('socialite_provider')) {
if ($avatar = $this->providers()->where('provider', session('socialite_provider'))->first()->avatar) {
return $avatar;
}
}
/*
* Otherwise get the gravatar of the users email account
*/
return gravatar()->get($this->email, ['size' => 50]);
}
示例8: test_gravatar
public function test_gravatar()
{
$avatar = gravatar('test@email.com');
$expected = "https://www.gravatar.com/avatar/93942e96f5acd83e2e047ad8fe03114d?s=100&d=&r=g";
$this->assertEquals($expected, $avatar);
$avatar = gravatar('test@email.com', 200);
$expected = "https://www.gravatar.com/avatar/93942e96f5acd83e2e047ad8fe03114d?s=200&d=&r=g";
$this->assertEquals($expected, $avatar);
$avatar = gravatar('test@email.com', 'not-a-valid-size');
$expected = "https://www.gravatar.com/avatar/93942e96f5acd83e2e047ad8fe03114d?s=100&d=&r=g";
$this->assertEquals($expected, $avatar);
$avatar = gravatar('test@email.com', 100, '', 'pg');
$expected = "https://www.gravatar.com/avatar/93942e96f5acd83e2e047ad8fe03114d?s=100&d=&r=pg";
$this->assertEquals($expected, $avatar);
$avatar = gravatar('test@email.com', 200, 'http://mysite.com/default.png', 'pg');
$expected = "https://www.gravatar.com/avatar/93942e96f5acd83e2e047ad8fe03114d?s=200&d=http://mysite.com/default.png&r=pg";
$this->assertEquals($expected, $avatar);
}
示例9: profile_image
function profile_image($user_id, $image, $email_hash = NULL, $size = 'medium')
{
$this->ci->load->helper('gravatar');
$picture = base_url() . config_item('users_images_folder') . $size . '_' . config_item('profile_nopicture');
if ($image) {
$image_file = config_item('users_images_folder') . $user_id . '/' . $size . '_' . $image;
if (file_exists($image_file)) {
$picture = base_url() . $image_file;
} else {
if (config_item('services_gravatar_enabled') == 'TRUE') {
return gravatar($email_hash, "X", config_item('users_images_' . $size . '_width'), $picture);
}
}
return $picture;
}
if (config_item('services_gravatar_enabled') == 'TRUE') {
$picture = gravatar($email_hash, "X", config_item('users_images_' . $size . '_width'), $picture);
}
return $picture;
}
示例10: sprintf
<h2 class="page-title"><?php
echo sprintf(lang('profile_of_title'), $_user->display_name);
?>
</h2>
<!-- Container for the user's profile -->
<div id="user_profile_container">
<?php
echo gravatar($_user->email, 50);
?>
<!-- Details about the user, such as role and when the user was registered -->
<div id="user_details">
<h3><?php
echo lang('profile_user_details_label');
?>
</h3>
<p><strong><?php
echo lang('profile_role_label');
?>
:</strong> <?php
echo $_user->group;
?>
</p>
<p><strong><?php
echo lang('profile_registred_on_label');
?>
:</strong> <?php
echo format_date($_user->created_on);
?>
</p>
<?php
示例11: foreach
<div class="comment-wrapper">
<div class="comment-sets">
<?php
if ($commentmovies) {
?>
<?php
foreach ($commentmovies as $item) {
?>
<div class="comment">
<div class="comment__images">
<?php
echo gravatar($item->user_email, 60);
?>
</div>
<a href='#' class="comment__author"><span class="social-used fa fa-facebook"></span><?php
echo $item->user_name;
?>
</a>
<p class="comment__date"><?php
echo format_date($item->created_on);
?>
</p>
<?php
if (Settings::get('commentmovie_markdown') and $item->parsed) {
?>
<p class="comment__message"><?php
echo $item->parsed;
?>
</p>
<?php
示例12: foreach
<h4 id="comment-header">Comments</h4>
<ol class="commentlist">
<?php
foreach ($comments as $comment) {
?>
<li id="comment-<?php
comment_ID();
?>
" class="<?php
echo $oddcomment;
?>
">
<p class="comment-metadata">
<img src="<?php
gravatar();
?>
" alt="Gravatar" class="gravatar"/>
<strong><?php
comment_author_link();
?>
</strong> | <?php
comment_date('d-M-y');
?>
at <?php
comment_time('g:i a');
?>
| <a href="#comment-<?php
comment_ID();
?>
" title="Permalink to this comment" rel="permalink">Permalink</a> <?php
示例13: gravatar
?>
" /></p>
<input type="hidden" name="user_id" value="<?php
echo $row['user_id'];
?>
" />
</div>
</div>
<div class="grid_7">
<fieldset>
<legend>Original Version</legend>
<div class="user_box">
<img width="48" height="48" src="<?php
echo gravatar($row['user_email'], 'PG', 48);
?>
" class="user_gravatar" />
<h3><?php
echo $row['user_username'];
?>
</h3>
<a href="mailto:<?php
echo $row['user_email'];
?>
"><?php
echo $row['user_email'];
?>
</a><br />
<span class="date"><?php
echo lang('lang_join_date');
示例14: sprintf
<h2 class="page-title" id="page_title"><?php echo sprintf(lang('profile_of_title'), $view_user->first_name.' '.$view_user->last_name);?></h2>
<!-- Container for the user's profile -->
<div id="user_profile_container">
<?php echo gravatar($view_user->email, 50);?>
<!-- Details about the user, such as role and when the user was registered -->
<div id="user_details">
<h3><?php echo lang('profile_user_details_label');?></h3>
<p><strong><?php echo lang('profile_role_label');?>:</strong> <?php echo $view_user->group; ?></p>
<p><strong><?php echo lang('profile_registred_on_label');?>:</strong> <?php echo format_date($view_user->created_on); ?></p>
<?php if($view_user->last_login > 0): ?>
<p><strong><?php echo lang('profile_last_login_label');?>:</strong> <?php echo format_date($view_user->last_login); ?></p>
<?php endif; ?>
</div>
<?php if($user_settings): ?>
<?php if($user_settings->bio): ?>
<!-- User's biography -->
<div id="user_bio">
<h3><?php echo lang('profile_bio'); ?></h3>
<p><?php echo $user_settings->bio ?></p>
</div>
<?php endif; ?>
<?php if($user_settings->gender || $user_settings->dob): ?>
<!-- Personal user details -->
<div id="user_personal">
<h3><?php echo lang('profile_personal_section') ?></h3>
<?php if($user_settings->gender): ?><p><strong><?php echo lang('profile_gender'); ?>:</strong> <?php echo $user_settings->gender == 'm' ? lang('profile_male_label') : lang('profile_female_label') ?></p><?php endif; ?>
<?php if($user_settings->dob): ?><p><strong><?php echo lang('profile_dob'); ?>:</strong> <?php echo format_date($user_settings->dob) ?></p><?php endif; ?>
</div>
<?php endif; ?>
<?php if($user_settings->msn_handle || $user_settings->aim_handle || $user_settings->yim_handle || $user_settings->gtalk_handle): ?>
<!-- Social corner -->
示例15: redirect
<?php
//If user is not signed in redirect
if (!$user->isSigned()) {
redirect("./login");
}
?>
<div class="row">
<div class="col-xs-12">
<?php
echo gravatar($user->Email, 50);
?>
<div class="btn-group pull-right2">
<a class="btn btn-primary" href="account/update">Update Information</a>
<a class="btn btn-primary" href="account/update/password">Change Password</a>
</div>
<table class="table">
<?php
foreach ($user->toArray() as $name => $value) {
?>
<tr>
<th><?php
echo $name;
?>
</th>
<td><?php
echo $value;
?>
</td>
</tr>
<?php