本文整理汇总了PHP中Avatar::defaultImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Avatar::defaultImage方法的具体用法?PHP Avatar::defaultImage怎么用?PHP Avatar::defaultImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Avatar
的用法示例。
在下文中一共展示了Avatar::defaultImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param User $user the user for the feed
* @param User $cur the current authenticated user, if any
* @param boolean $indent flag to turn indenting on or off
*
* @return void
*/
function __construct($user, $cur = null, $indent = true)
{
parent::__construct($cur, $indent);
$this->user = $user;
if (!empty($user)) {
$profile = $user->getProfile();
$this->addAuthor($profile->nickname, $user->uri);
$this->setActivitySubject($profile->asActivityNoun('subject'));
}
// TRANS: Title in atom user notice feed. %s is a user name.
$title = sprintf(_("%s timeline"), $user->nickname);
$this->setTitle($title);
$sitename = common_config('site', 'name');
$subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
$this->setSubtitle($subtitle);
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
$this->setLogo($logo);
$this->setUpdated('now');
$this->addLink(common_local_url('showstream', array('nickname' => $user->nickname)));
$self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom'));
$this->setId($self);
$this->setSelfLink($self);
$this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json'));
}
示例2: showNotice
function showNotice($notice)
{
$profile = $notice->getProfile();
if (empty($profile)) {
common_log(LOG_WARNING, sprintf("Notice %d has no profile", $notice->id));
return;
}
$this->out->elementStart('li', 'hentry notice');
$this->out->elementStart('div', 'entry-title');
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart('a', array('title' => $profile->fullname ? $profile->fullname : $profile->nickname, 'href' => $profile->profileurl, 'class' => 'url'));
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $profile->fullname ? $profile->fullname : $profile->nickname));
$this->out->text(' ');
$this->out->element('span', 'fn nickname', $profile->nickname);
$this->out->elementEnd('a');
$this->out->elementEnd('span');
$this->out->elementStart('p', 'entry-content');
$this->out->raw($notice->rendered);
$this->out->elementEnd('p');
$this->out->elementStart('div', 'entry_content');
class_exists('NoticeList');
$nli = new NoticeListItem($notice, $this->out);
$nli->showNoticeLink();
$this->out->elementEnd('div');
if (!empty($notice->value)) {
$this->out->elementStart('p');
$this->out->text($notice->value);
$this->out->elementEnd('p');
}
$this->out->elementEnd('div');
$this->out->elementEnd('li');
}
示例3: handle
/**
* Class handler.
*
* @param array $args query arguments
*
* @return boolean false if nickname or user isn't found
*/
protected function handle()
{
parent::handle();
$nickname = $this->trimmed('nickname');
if (!$nickname) {
// TRANS: Client error displayed trying to get an avatar without providing a nickname.
$this->clientError(_('No nickname.'));
}
$size = $this->trimmed('size') ?: 'original';
$user = User::getKV('nickname', $nickname);
if (!$user) {
// TRANS: Client error displayed trying to get an avatar for a non-existing user.
$this->clientError(_('No such user.'));
}
$profile = $user->getProfile();
if (!$profile) {
// TRANS: Error message displayed when referring to a user without a profile.
$this->clientError(_('User has no profile.'));
}
if ($size === 'original') {
try {
$avatar = Avatar::getUploaded($profile);
$url = $avatar->displayUrl();
} catch (NoAvatarException $e) {
$url = Avatar::defaultImage(AVATAR_PROFILE_SIZE);
}
} else {
$url = $profile->avatarUrl($size);
}
common_redirect($url, 302);
}
示例4: show
/**
* Show the item
*
* @return void
*/
function show()
{
$group = $this->gm->getGroup();
$sender = $this->gm->getSender();
$this->out->elementStart('li', array('class' => 'hentry notice message group-message', 'id' => 'message-' . $this->gm->id));
$this->out->elementStart('div', 'entry-title');
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart('a', array('href' => $sender->profileurl, 'class' => 'url'));
$avatar = $sender->getAvatar(AVATAR_STREAM_SIZE);
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'class' => 'photo avatar', 'alt' => $sender->getBestName()));
$this->out->element('span', array('class' => 'nickname fn'), $sender->nickname);
$this->out->elementEnd('a');
$this->out->elementEnd('span');
$this->out->elementStart('p', array('class' => 'entry-content message-content'));
$this->out->raw($this->gm->rendered);
$this->out->elementEnd('p');
$this->out->elementEnd('div');
$this->out->elementStart('div', 'entry-content');
$this->out->elementStart('a', array('rel' => 'bookmark', 'class' => 'timestamp', 'href' => $this->gm->url));
$dt = common_date_iso8601($this->gm->created);
$this->out->element('abbr', array('class' => 'published', 'title' => $dt), common_date_string($this->gm->created));
$this->out->elementEnd('a');
$this->out->elementEnd('div');
$this->out->elementEnd('li');
}
示例5: __construct
/**
* Constructor
*
* @param User $user the user for the feed
* @param User $cur the current authenticated user, if any
* @param boolean $indent flag to turn indenting on or off
*
* @return void
*/
function __construct($user, $cur = null, $indent = true)
{
parent::__construct($cur, $indent);
$this->user = $user;
if (!empty($user)) {
$profile = $user->getProfile();
$ao = ActivityObject::fromProfile($profile);
array_push($ao->extra, $profile->profileInfo($cur));
// XXX: For users, we generate an author _AND_ an <activity:subject>
// This is for backward compatibility with clients (especially
// StatusNet's clients) that assume the Atom will conform to an
// older version of the Activity Streams API. Subject should be
// removed in future versions of StatusNet.
$this->addAuthorRaw($ao->asString('author'));
$depMsg = 'Deprecation warning: activity:subject is present ' . 'only for backward compatibility. It will be ' . 'removed in the next version of StatusNet.';
$this->addAuthorRaw("<!--{$depMsg}-->\n" . $ao->asString('activity:subject'));
}
// TRANS: Title in atom user notice feed. %s is a user name.
$title = sprintf(_("%s timeline"), $user->nickname);
$this->setTitle($title);
$sitename = common_config('site', 'name');
$subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
$this->setSubtitle($subtitle);
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
$this->setLogo($logo);
$this->setUpdated('now');
$this->addLink(common_local_url('showstream', array('nickname' => $user->nickname)));
$self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom'));
$this->setId($self);
$this->setSelfLink($self);
$this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json'));
}
示例6: avatar
function avatar()
{
$avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
if (empty($avatar)) {
$avatar = $this->profile->getAvatar(73);
}
return !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
}
示例7: showNotice
function showNotice($notice)
{
$profile = $notice->getProfile();
if (empty($profile)) {
common_log(LOG_WARNING, sprintf("Notice %d has no profile", $notice->id));
return;
}
$this->out->elementStart('li', 'hentry notice');
$this->out->elementStart('div', 'entry-title');
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart('a', array('title' => $profile->fullname ? $profile->fullname : $profile->nickname, 'href' => $profile->profileurl, 'class' => 'url'));
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $profile->fullname ? $profile->fullname : $profile->nickname));
$this->out->text(' ');
$this->out->element('span', 'fn nickname', $profile->nickname);
$this->out->elementEnd('a');
$this->out->elementEnd('span');
$this->out->elementStart('p', 'entry-content');
$this->out->raw($notice->rendered);
$notice_link_cfg = common_config('site', 'notice_link');
if ('direct' === $notice_link_cfg) {
$this->out->text(' (');
$this->out->element('a', array('href' => $notice->uri), 'see');
$this->out->text(')');
} elseif ('attachment' === $notice_link_cfg) {
if ($count = $notice->hasAttachments()) {
// link to attachment(s) pages
if (1 === $count) {
$f2p = File_to_post::staticGet('post_id', $notice->id);
$href = common_local_url('attachment', array('attachment' => $f2p->file_id));
$att_class = 'attachment';
} else {
$href = common_local_url('attachments', array('notice' => $notice->id));
$att_class = 'attachments';
}
$clip = Theme::path('images/icons/clip.png', 'base');
$this->out->elementStart('a', array('class' => $att_class, 'style' => "font-style: italic;", 'href' => $href, 'title' => "# of attachments: {$count}"));
$this->out->raw(" ({$count} ");
$this->out->element('img', array('style' => 'display: inline', 'align' => 'top', 'width' => 20, 'height' => 20, 'src' => $clip, 'alt' => 'alt'));
$this->out->text(')');
$this->out->elementEnd('a');
} else {
$this->out->text(' (');
$this->out->element('a', array('href' => $notice->uri), 'see');
$this->out->text(')');
}
}
$this->out->elementEnd('p');
if (!empty($notice->value)) {
$this->out->elementStart('p');
$this->out->text($notice->value);
$this->out->elementEnd('p');
}
$this->out->elementEnd('div');
$this->out->elementEnd('li');
}
示例8: showProfile
function showProfile()
{
$this->out->elementStart('li', 'vcard');
$this->out->elementStart('a', array('title' => $this->profile->getBestName(), 'href' => $this->profile->profileurl, 'rel' => 'contact member', 'class' => 'url'));
$avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
$this->out->element('span', 'fn nickname', $this->profile->nickname);
$this->out->elementEnd('a');
$this->out->elementEnd('li');
}
示例9: showAvatar
function showAvatar()
{
if (Event::handle('StartProfilePageAvatar', array($this->out, $this->profile))) {
$avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), 'id' => 'profile_avatar', 'width' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE, 'alt' => $this->profile->nickname));
$this->showNickname();
$this->showFullName();
$user = User::staticGet('id', $this->profile->id);
$cur = common_current_user();
if ($cur && $cur->id == $user->id) {
$this->out->element('a', array('href' => common_local_url('avatarsettings'), 'id' => 'edit_avatar'), _('编辑头像'));
}
Event::handle('EndProfilePageAvatar', array($this->out, $this->profile));
}
}
示例10: show
function show()
{
$this->out->elementStart('li', 'vcard');
if (Event::handle('StartProfileListItemProfileElements', array($this))) {
if (Event::handle('StartProfileListItemAvatar', array($this))) {
$aAttrs = $this->linkAttributes();
$this->out->elementStart('a', $aAttrs);
$avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE), 'width' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE, 'class' => 'avatar photo', 'alt' => $this->profile->fullname ? $this->profile->fullname : $this->profile->nickname));
$this->out->element('span', 'fn nickname', $this->profile->nickname);
$this->out->elementEnd('a');
Event::handle('EndProfileListItemAvatar', array($this));
}
$this->out->elementEnd('li');
}
}
示例11: show
/**
* Show the widget
*
* @return void
*/
function show()
{
$this->out->elementStart('li', array('class' => 'hentry notice', 'id' => 'message-' . $this->message->id));
$profile = $this->getMessageProfile();
$this->out->elementStart('div', 'entry-title');
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart('a', array('href' => $profile->profileurl, 'class' => 'url'));
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => $profile->fullname ? $profile->fullname : $profile->nickname));
$this->out->element('span', array('class' => 'nickname fn'), $profile->nickname);
$this->out->elementEnd('a');
$this->out->elementEnd('span');
// FIXME: URL, image, video, audio
$this->out->elementStart('p', array('class' => 'entry-content'));
$this->out->raw($this->message->rendered);
$this->out->elementEnd('p');
$this->out->elementEnd('div');
$messageurl = common_local_url('showmessage', array('message' => $this->message->id));
// XXX: we need to figure this out better. Is this right?
if (strcmp($this->message->uri, $messageurl) != 0 && preg_match('/^http/', $this->message->uri)) {
$messageurl = $this->message->uri;
}
$this->out->elementStart('div', 'entry-content');
$this->out->elementStart('a', array('rel' => 'bookmark', 'class' => 'timestamp', 'href' => $messageurl));
$dt = common_date_iso8601($this->message->created);
$this->out->element('abbr', array('class' => 'published', 'title' => $dt), common_date_string($this->message->created));
$this->out->elementEnd('a');
if ($this->message->source) {
$this->out->elementStart('span', 'source');
// FIXME: bad i18n. Device should be a parameter (from %s).
// TRANS: Followed by notice source (usually the client used to send the notice).
$this->out->text(_('from'));
$this->showSource($this->message->source);
$this->out->elementEnd('span');
}
$this->out->elementEnd('div');
$this->out->elementEnd('li');
}
示例12: libravatar_url
function libravatar_url($email, $size)
{
global $config;
$defaultavatar = Avatar::defaultImage($size);
if (isset($config['Libravatar']) && isset($config['Libravatar']['nocheck']) && $config['Libravatar']['nocheck'] === true) {
include_once 'Services/Libravatar.php';
} else {
try {
if (function_exists('stream_resolve_include_path') && stream_resolve_include_path('Services/Libravatar.php')) {
include_once 'Services/Libravatar.php';
}
} catch (exception $e) {
return $defaultavatar;
}
}
if (!class_exists('Services_Libravatar')) {
return $defaultavatar;
}
$libravatar = new Services_Libravatar();
$libravatar->setSize($size)->setDefault(Avatar::defaultImage($size))->setHttps(true);
$url = $libravatar->getUrl($email);
return $url;
}
示例13: twitter_user_array
function twitter_user_array($profile, $get_notice = false)
{
$twitter_user = array();
$twitter_user['name'] = $profile->getBestName();
$twitter_user['followers_count'] = $this->count_subscriptions($profile);
$twitter_user['screen_name'] = $profile->nickname;
$twitter_user['description'] = $profile->bio ? $profile->bio : null;
$twitter_user['location'] = $profile->location ? $profile->location : null;
$twitter_user['id'] = intval($profile->id);
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$twitter_user['profile_image_url'] = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE);
$twitter_user['protected'] = 'false';
# not supported by Laconica yet
$twitter_user['url'] = $profile->homepage ? $profile->homepage : null;
if ($get_notice) {
$notice = $profile->getCurrentNotice();
if ($notice) {
# don't get user!
$twitter_user['status'] = $this->twitter_status_array($notice, false);
}
}
return $twitter_user;
}
示例14: gravatar_url
function gravatar_url($email, $size)
{
$url = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5(strtolower($email)) . "&default=" . urlencode(Avatar::defaultImage($size)) . "&size=" . $size;
return $url;
}
示例15: showQvitter
//.........这里部分代码省略.........
Copyright (C) 2015 Hannes Mannerheim and other contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
@licend The above is the entire license notice
for the JavaScript code in this page.
*/
window.usersLanguageCode = <?php
print json_encode($user_browser_language);
?>
;
window.usersLanguageNameInEnglish = <?php
print json_encode(Locale::getDisplayLanguage($user_browser_language, 'en'));
?>
;
window.englishLanguageData = <?php
print file_get_contents(QVITTERDIR . '/locale/en.json');
?>
;
window.defaultAvatarStreamSize = <?php
print json_encode(Avatar::defaultImage(AVATAR_STREAM_SIZE));
?>
;
window.defaultAvatarProfileSize = <?php
print json_encode(Avatar::defaultImage(AVATAR_PROFILE_SIZE));
?>
;
window.textLimit = <?php
print json_encode((int) common_config('site', 'textlimit'));
?>
;
window.registrationsClosed = <?php
print json_encode($registrationsclosed);
?>
;
window.thisSiteThinksItIsHttpButIsActuallyHttps = <?php
// this is due to a crazy setup at quitter.se, sorry about that
$siteSSL = common_config('site', 'ssl');
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' && $siteSSL == 'never') {
$this_site_thinks_it_is_http_but_is_actually_https = true;
print 'true';
} else {
$this_site_thinks_it_is_http_but_is_actually_https = false;
print 'false';
}
?>
;
window.siteTitle = <?php
print json_encode($sitetitle);
?>
;
window.loggedIn = <?php
$logged_in_user_json = json_encode($logged_in_user_obj);