本文整理匯總了PHP中Avatar::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Avatar::get方法的具體用法?PHP Avatar::get怎麽用?PHP Avatar::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Avatar
的用法示例。
在下文中一共展示了Avatar::get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: html_start
/**
* Returns html string representing the beginning block of a timeline entry
* @return string
*/
public function html_start()
{
$t_avatar = Avatar::get($this->user_id, 32);
if ($t_avatar === null) {
return sprintf('<div class="entry"><div class="timestamp">%s</div>', $this->format_timestamp($this->timestamp));
}
return sprintf('<div class="entry"><div class="avatar"><a href="%s"><img class="avatar" src="%s" alt="%s" width="32" height="32" /></a></div><div class="timestamp">%s</div>', $t_avatar->link, $t_avatar->image, $t_avatar->text, $this->format_timestamp($this->timestamp));
}
示例2: print_avatar
/**
* Print avatar image for the given user ID
*
* @param integer $p_user_id A user identifier.
* @param integer $p_size Image pixel size.
* @return void
*/
function print_avatar($p_user_id, $p_size = 80)
{
$t_avatar = Avatar::get($p_user_id, $p_size);
if ($t_avatar === null) {
return;
}
$t_image = htmlspecialchars($t_avatar->image);
$t_link = htmlspecialchars($t_avatar->link);
$t_text = htmlspecialchars($t_avatar->text);
echo '<a rel="nofollow" href="' . $t_link . '">' . '<img class="avatar" src="' . $t_image . '" alt="' . $t_text . '" width="' . $p_size . '" height="' . $p_size . '" /></a>';
}