本文整理汇总了PHP中Avatar::setUsersAvatar方法的典型用法代码示例。如果您正苦于以下问题:PHP Avatar::setUsersAvatar方法的具体用法?PHP Avatar::setUsersAvatar怎么用?PHP Avatar::setUsersAvatar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Avatar
的用法示例。
在下文中一共展示了Avatar::setUsersAvatar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterLogin
private static function afterLogin()
{
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
$json = $connection->get('users/show', ['user_id' => $_SESSION['twitter-userid']]);
$_SESSION['twitter-avatar'] = isset($json->profile_image_url) ? $json->profile_image_url : '';
Avatar::setUsersAvatar($_SESSION['twitter-userid'], $_SESSION['twitter-username'], $_SESSION['twitter-avatar']);
$oldAvatars = Avatar::find('1=1 order by dateline asc limit 100');
if ($oldAvatars) {
$oldAvatarsIds = Model::pluck($oldAvatars, 'userid');
$json = $connection->get('users/lookup', ['user_id' => implode(',', $oldAvatarsIds)]);
foreach ($json as $userdata) {
$newavatars[$userdata->id_str] = $userdata->profile_image_url;
}
foreach ($oldAvatars as $avatar) {
$avatar->url = $newavatars[$avatar->userid];
$avatar->dateline = time();
}
Model::saveAll($oldAvatars);
}
}
示例2: show
//.........这里部分代码省略.........
if (!$match->isPublished() || $match->isDelayed()) continue;
$team1 = $teams[$match->team1id];
$team2 = $teams[$match->team2id];
$success = $match->getWinner() == $bet->teamid;
?>
<tr>
<td><?= $match->week ?></td>
<td>
<div class="inblock">
<div class="teamimg64">
<img src="/<?= $team1->getImageLink(64, 64) ?>" class="<?= $match->getWinner() == $team1->teamid ? '' : 'grayscale' ?>">
</div>
<? if ($bet->teamid == $team1->teamid) { ?>
<br><i style="font-size:11px">Votado</i>
<? } ?>
</div>
<div class="inblock" style="line-height: 64px; margin: 0px 4px">
VS
</div>
<div class="inblock">
<div class="teamimg64">
<img src="/<?= $team2->getImageLink(64, 64) ?>" class="<?= $match->getWinner() == $team2->teamid ? '' : 'grayscale' ?>">
</div>
<? if ($bet->teamid == $team2->teamid) { ?>
<br><i style="font-size:11px">Votado</i>
<? } ?>
</div>
</td>
<td>
<?= $success
? '<div class="success-icon">✔</div>'
: '<div class="fail-icon">✘</div>' ?>
</td>
</tr>
<?
} ?>
</table>
</div>
<?
}
?>
<div class="inblock">
<h2>Clasificación</h2>
<table>
<thead>
<tr>
<td>Puesto</td>
<td>Nombre</td>
<td>Aciertos</td>
<td>Fallos</td>
</tr>
</thead>
<?
$lastTiebreakers = null;
$lastPos = 0;
foreach(array_keys($tiebreakers) as $pos => $userid) {
unset($tiebreakers[$userid][2]);
if ($lastTiebreakers != $tiebreakers[$userid]) {
$lastPos = $pos;
}
if (!isset($avatars[$userid])) {
Avatar::setUsersAvatar($userid, $usernames[$userid]);
}
?>
<tr>
<td><?= $lastPos+1 ?>º</td>
<td style="text-align: left">
<div class="inblock" style="vertical-align: middle">
<a href="http://twitter.com/<?=htmlentities($usernames[$userid])?>" target="_blank">
<img src="<?= htmlentities($avatars[$userid]) ?>" style="width:40px; height:40px; border-radius: 20px">
</a>
</div>
<div class="inblock" style="vertical-align: middle">
<a href="http://twitter.com/<?=htmlentities($usernames[$userid])?>" target="_blank">
<?= htmlentities($usernames[$userid]) ?>
<? if (!isset($usernames[$userid])) echo "<i>$userid</i>"; ?>
</a>
</div>
</td>
<td><?= $correctBets[$userid] ?></td>
<td><?= $totalBets[$userid]-$correctBets[$userid] ?></td>
</tr>
<?
$lastTiebreakers = $tiebreakers[$userid];
}
?>
</table>
</div>
<?
}