本文整理汇总了PHP中UserProfile::isBuddy方法的典型用法代码示例。如果您正苦于以下问题:PHP UserProfile::isBuddy方法的具体用法?PHP UserProfile::isBuddy怎么用?PHP UserProfile::isBuddy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserProfile
的用法示例。
在下文中一共展示了UserProfile::isBuddy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserPermissions
/**
* Gets all the user permissions for the currently logged in user in
* the guestbook owned by the given owner.
*
* @var UserProfile $guestbookOwner
* @return array<bool>
*/
public static function getUserPermissions(UserProfile $guestbookOwner)
{
$permissions = array();
$permissions['isOwner'] = WCF::getUser()->userID === $guestbookOwner->userID;
$permissions['canUseGuestbook'] = (bool) WCF::getUser()->getPermission('user.guestbook.canUseGuestbook');
$permissions['canViewGuestbook'] = $permissions['canUseGuestbook'] && ($permissions['isOwner'] || ($guestbookOwner->guestbookAccess & UserGuestbookUtil::ACCESS_FRIENDS ? UserProfile::isBuddy($guestbookOwner->userID) : (bool) ($guestbookOwner->guestbookAccess & UserGuestbookUtil::ACCESS_EVERYONE)));
$permissions['canWriteEntry'] = WCF::getUser()->getPermission('user.guestbook.canWriteEntry') && ($guestbookOwner->guestbookWriteEntryAccess & UserGuestbookUtil::ACCESS_FRIENDS ? UserProfile::isBuddy($guestbookOwner->userID) : (bool) ($guestbookOwner->guestbookWriteEntryAccess & UserGuestbookUtil::ACCESS_EVERYONE));
$permissions['canWriteComment'] = WCF::getUser()->getPermission('user.guestbook.canWriteComment') && ($guestbookOwner->guestbookWriteCommentAccess & UserGuestbookUtil::ACCESS_FRIENDS ? UserProfile::isBuddy($guestbookOwner->userID) : (bool) ($guestbookOwner->guestbookWriteCommentAccess & UserGuestbookUtil::ACCESS_EVERYONE));
return $permissions;
}
示例2: getFormattedUsername
/**
* Formats the username of the given user.
*
* @param array $row
* @param User $user
* @return string formatted username
*/
public static function getFormattedUsername($row, User $user)
{
$row['username'] = StringUtil::encodeHTML($row['username']);
if (UserProfile::isBuddy($user->userID)) {
$row['username'] = '<span class="buddy">' . $row['username'] . '</span>';
}
if (!empty($row['userOnlineMarking'])) {
$row['username'] = sprintf($row['userOnlineMarking'], $row['username']);
}
if ($user->invisible) {
$row['username'] .= WCF::getLanguage()->get('wcf.usersOnline.invisible');
}
return $row['username'];
}
示例3: canViewProfile
/**
* Returns true, if the active user can see the profile of this user.
*
* @return boolean
*/
public function canViewProfile()
{
return !$this->protectedProfile || WCF::getUser()->userID == $this->userID || UserProfile::isBuddy($this->userID) || WCF::getUser()->getPermission('admin.general.canViewPrivateUserOptions');
}
示例4: __construct
/**
* Creates a new MessageSidebar object.
*
* @param UserProfile $user
*/
public function __construct(MessageSidebarObject $object)
{
$this->object = $object;
// init user options
if ($this->getUser()->userID) {
if (!$this->getUser()->protectedProfile || $this->getUser()->userID == WCF::getUser()->userID) {
$userOptions = self::getUserOptions();
$categories = $userOptions->getOptionTree('profile', $this->getUser());
// add registration date
if (MESSAGE_SIDEBAR_ENABLE_REGISTRATION_DATE == 1) {
$this->addUserCredit(WCF::getLanguage()->get('wcf.user.registrationDate'), DateUtil::formatDate(null, $this->getUser()->registrationDate));
}
// user options
foreach ($categories as $category) {
if ($category['categoryName'] == 'profile.contact' || $category['categoryName'] == 'profile.messenger') {
foreach ($category['options'] as $userOption) {
$this->addUserContact($userOption['optionValue']);
}
} else {
foreach ($category['options'] as $userOption) {
if ($userOption['optionName'] == 'birthday' || $userOption['optionName'] == 'gender') {
$this->addUserSymbol($userOption['optionValue']);
} else {
$this->addUserCredit(WCF::getLanguage()->get('wcf.user.option.' . $userOption['optionName']), $userOption['optionValue']);
}
}
}
}
// add friend icon
if (MESSAGE_SIDEBAR_ENABLE_FRIEND_ICON) {
if (WCF::getUser()->userID && UserProfile::isBuddy($this->getUser()->userID)) {
$this->addUserSymbol('<img src="' . StyleManager::getStyle()->getIconPath('friendsS.png') . '" alt="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.friend', array('username' => $this->getUser()->username)) . '" title="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.friend', array('username' => $this->getUser()->username)) . '" />');
}
}
}
// banned icon
if ($object->getUser()->banned) {
$this->addUserSymbol('<img src="' . StyleManager::getStyle()->getIconPath('bannedS.png') . '" alt="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.banned', array('username' => $this->getUser()->username)) . '" title="' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.banned', array('username' => $this->getUser()->username)) . '" />');
}
}
}