本文整理汇总了PHP中Profile::getBestName方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getBestName方法的具体用法?PHP Profile::getBestName怎么用?PHP Profile::getBestName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::getBestName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mail_subscribe_notify_profile
/**
* notify a user of subscription by a profile (remote or local)
*
* This function checks to see if the listenee has an email
* address and wants subscription notices.
*
* @param User $listenee user who's being subscribed to
* @param Profile $other profile of person who's listening
*
* @return void
*/
function mail_subscribe_notify_profile($listenee, $other)
{
if ($listenee->email && $listenee->emailnotifysub) {
// use the recipient's localization
common_init_locale($listenee->language);
$profile = $listenee->getProfile();
$name = $profile->getBestName();
$long_name = $other->fullname ? $other->fullname . ' (' . $other->nickname . ')' : $other->nickname;
$recipients = $listenee->email;
$headers['From'] = mail_notify_from();
$headers['To'] = $name . ' <' . $listenee->email . '>';
$headers['Subject'] = sprintf(_('%1$s is now listening to ' . 'your notices on %2$s.'), $other->getBestName(), common_config('site', 'name'));
$body = sprintf(_('%1$s is now listening to your notices on %2$s.' . "\n\n" . "\t" . '%3$s' . "\n\n" . '%4$s' . '%5$s' . '%6$s' . "\n" . 'Faithfully yours,' . "\n" . '%7$s.' . "\n\n" . "----\n" . "Change your email address or " . "notification options at " . '%8$s' . "\n"), $long_name, common_config('site', 'name'), $other->profileurl, $other->location ? sprintf(_("Location: %s\n"), $other->location) : '', $other->homepage ? sprintf(_("Homepage: %s\n"), $other->homepage) : '', $other->bio ? sprintf(_("Bio: %s\n\n"), $other->bio) : '', common_config('site', 'name'), common_local_url('emailsettings'));
// reset localization
common_init_locale();
mail_send($recipients, $headers, $body);
}
}
示例2: showAvatar
protected function showAvatar(Profile $profile, $size = null)
{
$avatar_url = $profile->avatarUrl($size ?: $this->avatarSize());
$this->out->element('img', array('src' => $avatar_url, 'class' => 'avatar u-photo', 'width' => $this->avatarSize(), 'height' => $this->avatarSize(), 'alt' => $profile->getBestName()));
}
示例3: onEndPersonalGroupNav
public function onEndPersonalGroupNav(Menu $menu, Profile $target, Profile $scoped = null)
{
$menu->out->menuItem(common_local_url('showfavorites', array('nickname' => $target->getNickname())), _m('MENU', 'Favorites'), sprintf(_('%s\'s favorite notices'), $target->getBestName()), $scoped instanceof Profile && $target->id === $scoped->id && $menu->actionName == 'showfavorites', 'nav_timeline_favorites');
}
示例4: onEndUnsubscribe
function onEndUnsubscribe(Profile $profile, Profile $other)
{
// Only do this if config is enabled
if (!$this->StopFollowUser) {
return true;
}
if (!$profile->isLocal()) {
return true;
}
// TRANS: Text for "stopped following" item in activity plugin.
// TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a profile URL, %4$s is a profile name.
$rendered = sprintf(_m('<a href="%1$s">%2$s</a> stopped following <a href="%3$s">%4$s</a>.'), $profile->getUrl(), $profile->getBestName(), $other->getUrl(), $other->getBestName());
// TRANS: Text for "stopped following" item in activity plugin.
// TRANS: %1$s is a profile name, %2$s is a profile URL,
// TRANS: %3$s is a profile name, %4$s is a profile URL.
$content = sprintf(_m('%1$s (%2$s) stopped following %3$s (%4$s).'), $profile->getBestName(), $profile->getUrl(), $other->getBestName(), $other->getUrl());
$uri = TagURI::mint('stop-following:%d:%d:%s', $profile->id, $other->id, common_date_iso8601(common_sql_now()));
$notice = Notice::saveNew($profile->id, $content, ActivityPlugin::SOURCE, array('rendered' => $rendered, 'urls' => array(), 'replies' => array($other->getUri()), 'uri' => $uri, 'verb' => ActivityVerb::UNFOLLOW, 'object_type' => ActivityObject::PERSON));
return true;
}
示例5: mail_subscribe_notify_profile
/**
* notify a user of subscription by a profile (remote or local)
*
* This function checks to see if the listenee has an email
* address and wants subscription notices.
*
* @param User $listenee user who's being subscribed to
* @param Profile $other profile of person who's listening
*
* @return void
*/
function mail_subscribe_notify_profile($listenee, $other)
{
if ($other->hasRight(Right::EMAILONSUBSCRIBE) && $listenee->email && $listenee->emailnotifysub) {
$profile = $listenee->getProfile();
$name = $profile->getBestName();
$long_name = $other->fullname ? $other->fullname . ' (' . $other->nickname . ')' : $other->nickname;
$recipients = $listenee->email;
// use the recipient's localization
common_switch_locale($listenee->language);
$headers = _mail_prepare_headers('subscribe', $listenee->nickname, $other->nickname);
$headers['From'] = mail_notify_from();
$headers['To'] = $name . ' <' . $listenee->email . '>';
// TRANS: Subject of new-subscriber notification e-mail.
// TRANS: %1$s is the subscribing user's nickname, %2$s is the StatusNet sitename.
$headers['Subject'] = sprintf(_('%1$s is now listening to ' . 'your notices on %2$s.'), $other->getBestName(), common_config('site', 'name'));
// TRANS: This is a paragraph in a new-subscriber e-mail.
// TRANS: %s is a URL where the subscriber can be reported as abusive.
$blocklink = sprintf(_("If you believe this account is being used abusively, " . "you can block them from your subscribers list and " . "report as spam to site administrators at %s"), common_local_url('block', array('profileid' => $other->id)));
// TRANS: Main body of new-subscriber notification e-mail.
// TRANS: %1$s is the subscriber's long name, %2$s is the StatusNet sitename,
// TRANS: %3$s is the subscriber's profile URL, %4$s is the subscriber's location (or empty)
// TRANS: %5$s is the subscriber's homepage URL (or empty), %6%s is the subscriber's bio (or empty)
// TRANS: %7$s is a link to the addressed user's e-mail settings.
$body = sprintf(_('%1$s is now listening to your notices on %2$s.' . "\n\n" . "\t" . '%3$s' . "\n\n" . '%4$s' . '%5$s' . '%6$s' . "\n" . 'Faithfully yours,' . "\n" . '%2$s.' . "\n\n" . "----\n" . "Change your email address or " . "notification options at " . '%7$s' . "\n"), $long_name, common_config('site', 'name'), $other->profileurl, $other->location ? sprintf(_("Location: %s"), $other->location) . "\n" : '', $other->homepage ? sprintf(_("Homepage: %s"), $other->homepage) . "\n" : '', ($other->bio ? sprintf(_("Bio: %s"), $other->bio) . "\n" : '') . "\n\n" . $blocklink . "\n", common_local_url('emailsettings'));
// reset localization
common_switch_locale();
mail_send($recipients, $headers, $body);
}
}
示例6: mail_notify_group_join_pending
/**
* Send notification emails to group administrator.
*
* @param User_group $group
* @param Profile $joiner
*/
function mail_notify_group_join_pending($group, $joiner)
{
$admin = $group->getAdmins();
while ($admin->fetch()) {
// We need a local user for email notifications...
$adminUser = User::staticGet('id', $admin->id);
// @fixme check for email preference?
if ($adminUser && $adminUser->email) {
// use the recipient's localization
common_switch_locale($adminUser->language);
$headers = _mail_prepare_headers('join', $admin->nickname, $joiner->nickname);
$headers['From'] = mail_notify_from();
$headers['To'] = $admin->getBestName() . ' <' . $adminUser->email . '>';
// TRANS: Subject of pending group join request notification e-mail.
// TRANS: %1$s is the joining user's nickname, %2$s is the group name, and %3$s is the StatusNet sitename.
$headers['Subject'] = sprintf(_('%1$s wants to join your group %2$s on %3$s.'), $joiner->getBestName(), $group->getBestName(), common_config('site', 'name'));
// TRANS: Main body of pending group join request notification e-mail.
// TRANS: %1$s is the subscriber's long name, %2$s is the group name, and %3$s is the StatusNet sitename,
// TRANS: %4$s is the URL to the moderation queue page.
$body = sprintf(_('%1$s would like to join your group %2$s on %3$s. ' . 'You may approve or reject their group membership at %4$s'), $joiner->getFancyName(), $group->getFancyName(), common_config('site', 'name'), common_local_url('groupqueue', array('nickname' => $group->nickname))) . mail_profile_block($joiner) . mail_footer_block();
// reset localization
common_switch_locale();
mail_send($adminUser->email, $headers, $body);
}
}
}
示例7: onEndBroadcastProfile
/**
* Ping remote profiles with updates to this profile.
* Salmon pings are queued for background processing.
*/
function onEndBroadcastProfile(Profile $profile)
{
$user = User::staticGet('id', $profile->id);
// Find foreign accounts I'm subscribed to that support Salmon pings.
//
// @fixme we could run updates through the PuSH feed too,
// in which case we can skip Salmon pings to folks who
// are also subscribed to me.
$sql = "SELECT * FROM ostatus_profile " . "WHERE profile_id IN " . "(SELECT subscribed FROM subscription WHERE subscriber=%d) " . "OR group_id IN " . "(SELECT group_id FROM group_member WHERE profile_id=%d)";
$oprofile = new Ostatus_profile();
$oprofile->query(sprintf($sql, $profile->id, $profile->id));
if ($oprofile->N == 0) {
common_log(LOG_DEBUG, "No OStatus remote subscribees for {$profile->nickname}");
return true;
}
$act = new Activity();
$act->verb = ActivityVerb::UPDATE_PROFILE;
$act->id = TagURI::mint('update-profile:%d:%s', $profile->id, common_date_iso8601(time()));
$act->time = time();
// TRANS: Title for activity.
$act->title = _m('Profile update');
// TRANS: Ping text for remote profile update through OStatus.
// TRANS: %s is user that updated their profile.
$act->content = sprintf(_m('%s has updated their profile page.'), $profile->getBestName());
$act->actor = ActivityObject::fromProfile($profile);
$act->object = $act->actor;
while ($oprofile->fetch()) {
$oprofile->notifyDeferred($act, $profile);
}
return true;
}
示例8: showAvatar
protected function showAvatar(Profile $profile, $size = null)
{
$avatar_url = $profile->getGroup()->homepage_logo ?: User_group::defaultLogo($size ?: $this->avatarSize());
$this->out->element('img', array('src' => $avatar_url, 'class' => 'avatar u-photo', 'width' => $this->avatarSize(), 'height' => $this->avatarSize(), 'alt' => $profile->getBestName()));
}
示例9: fromProfile
static function fromProfile(Profile $profile)
{
$object = new ActivityObject();
if (Event::handle('StartActivityObjectFromProfile', array($profile, &$object))) {
$object->type = ActivityObject::PERSON;
$object->id = $profile->getUri();
$object->title = $profile->getBestName();
$object->link = $profile->profileurl;
$orig = $profile->getOriginalAvatar();
if (!empty($orig)) {
$object->avatarLinks[] = AvatarLink::fromAvatar($orig);
}
$sizes = array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE);
foreach ($sizes as $size) {
$alink = null;
$avatar = $profile->getAvatar($size);
if (!empty($avatar)) {
$alink = AvatarLink::fromAvatar($avatar);
} else {
$alink = new AvatarLink();
$alink->type = 'image/png';
$alink->height = $size;
$alink->width = $size;
$alink->url = Avatar::defaultImage($size);
if ($size == AVATAR_PROFILE_SIZE) {
// Hack for Twitter import: we don't have a 96x96 image,
// but we do have a 73x73 image. For now, fake it with that.
$avatar = $profile->getAvatar(73);
if ($avatar) {
$alink = AvatarLink::fromAvatar($avatar);
$alink->height = $size;
$alink->width = $size;
}
}
}
$object->avatarLinks[] = $alink;
}
if (isset($profile->lat) && isset($profile->lon)) {
$object->geopoint = (double) $profile->lat . ' ' . (double) $profile->lon;
}
$object->poco = PoCo::fromProfile($profile);
Event::handle('EndActivityObjectFromProfile', array($profile, &$object));
}
return $object;
}
示例10: showAvatar
function showAvatar(Profile $profile, $size = null)
{
$logo = $profile->getGroup()->stream_logo ?: User_group::defaultLogo($size ?: $this->avatarSize());
$this->out->element('img', array('src' => $logo, 'class' => 'avatar u-photo', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => $profile->getBestName()));
}
示例11: fromProfile
static function fromProfile(Profile $profile)
{
$poco = new PoCo();
$poco->preferredUsername = $profile->nickname;
$poco->displayName = $profile->getBestName();
$poco->note = $profile->bio;
$paddy = new PoCoAddress();
$paddy->formatted = $profile->location;
$poco->address = $paddy;
if (!empty($profile->homepage)) {
array_push($poco->urls, new PoCoURL('homepage', $profile->homepage, true));
}
return $poco;
}
示例12: fromProfile
static function fromProfile(Profile $profile)
{
$object = new ActivityObject();
$object->type = ActivityObject::PERSON;
$object->id = $profile->getUri();
$object->title = $profile->getBestName();
$object->link = $profile->profileurl;
$orig = $profile->getOriginalAvatar();
if (!empty($orig)) {
$object->avatarLinks[] = AvatarLink::fromAvatar($orig);
}
$sizes = array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE);
foreach ($sizes as $size) {
$alink = null;
$avatar = $profile->getAvatar($size);
if (!empty($avatar)) {
$alink = AvatarLink::fromAvatar($avatar);
} else {
$alink = new AvatarLink();
$alink->type = 'image/png';
$alink->height = $size;
$alink->width = $size;
$alink->url = Avatar::defaultImage($size);
}
$object->avatarLinks[] = $alink;
}
if (isset($profile->lat) && isset($profile->lon)) {
$object->geopoint = (double) $profile->lat . ' ' . (double) $profile->lon;
}
$object->poco = PoCo::fromProfile($profile);
return $object;
}