本文整理匯總了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)) . '" />');
}
}
}