本文整理汇总了PHP中PhabricatorUser::getDefaultProfileImageURI方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorUser::getDefaultProfileImageURI方法的具体用法?PHP PhabricatorUser::getDefaultProfileImageURI怎么用?PHP PhabricatorUser::getDefaultProfileImageURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorUser
的用法示例。
在下文中一共展示了PhabricatorUser::getDefaultProfileImageURI方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newValueForUsers
public function newValueForUsers($key, array $users)
{
$viewer = $this->getViewer();
$file_phids = mpull($users, 'getProfileImagePHID');
$file_phids = array_filter($file_phids);
if ($file_phids) {
$files = id(new PhabricatorFileQuery())->setViewer($viewer)->withPHIDs($file_phids)->execute();
$files = mpull($files, null, 'getPHID');
} else {
$files = array();
}
$results = array();
foreach ($users as $user) {
$image_phid = $user->getProfileImagePHID();
if (isset($files[$image_phid])) {
$image_uri = $files[$image_phid]->getBestURI();
} else {
$image_uri = PhabricatorUser::getDefaultProfileImageURI();
}
$user_phid = $user->getPHID();
$version = $this->getCacheVersion($user);
$results[$user_phid] = "{$version},{$image_uri}";
}
return $results;
}
示例2: loadProfileImageURI
public function loadProfileImageURI()
{
$src_phid = $this->getProfileImagePHID();
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $src_phid);
if ($file) {
return $file->getBestURI();
}
return PhabricatorUser::getDefaultProfileImageURI();
}
示例3: renderInput
protected function renderInput()
{
$file = $this->getValue();
if ($file === null) {
return phutil_tag('img', array('src' => PhabricatorUser::getDefaultProfileImageURI()), '');
}
$c_id = celerity_generate_unique_node_id();
$metadata = $file->getMetadata();
$scale = PhabricatorImageTransformer::getScaleForCrop($file, $this->getWidth(), $this->getHeight());
Javelin::initBehavior('aphront-crop', array('cropBoxID' => $c_id, 'width' => $this->getWidth(), 'height' => $this->getHeight(), 'scale' => $scale, 'imageH' => $metadata[PhabricatorFile::METADATA_IMAGE_HEIGHT], 'imageW' => $metadata[PhabricatorFile::METADATA_IMAGE_WIDTH]));
return javelin_tag('div', array('id' => $c_id, 'sigil' => 'crop-box', 'mustcapture' => true, 'class' => 'crop-box'), array(javelin_tag('img', array('src' => $file->getBestURI(), 'class' => 'crop-image', 'sigil' => 'crop-image'), ''), javelin_tag('input', array('type' => 'hidden', 'name' => 'image_x', 'sigil' => 'crop-x'), ''), javelin_tag('input', array('type' => 'hidden', 'name' => 'image_y', 'sigil' => 'crop-y'), '')));
}
示例4: renderResultList
protected function renderResultList(array $settings, PhabricatorSavedQuery $query, array $handles)
{
assert_instances_of($settings, 'PhabricatorUserPreferences');
$viewer = $this->requireViewer();
$list = id(new PHUIObjectItemListView())->setViewer($viewer);
foreach ($settings as $setting) {
$item = id(new PHUIObjectItemView())->setHeader($setting->getDisplayName())->setHref($setting->getEditURI())->setImageURI(PhabricatorUser::getDefaultProfileImageURI())->setIcon('fa-globe')->addAttribute(pht('Edit global default settings for all users.'));
$list->addItem($item);
}
$list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Personal Account Settings'))->addAttribute(pht('Edit settings for your personal account.'))->setImageURI($viewer->getProfileImageURI())->setHref('/settings/user/' . $viewer->getUsername() . '/'));
return id(new PhabricatorApplicationSearchResultView())->setObjectList($list);
}
示例5: loadHandles
public function loadHandles()
{
$types = phid_group_by_type($this->phids);
$handles = array();
$external_loaders = PhabricatorEnv::getEnvConfig('phid.external-loaders');
foreach ($types as $type => $phids) {
switch ($type) {
case PhabricatorPHIDConstants::PHID_TYPE_MAGIC:
// Black magic!
foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
$handle->setType($type);
switch ($phid) {
case ManiphestTaskOwner::OWNER_UP_FOR_GRABS:
$handle->setName('Up For Grabs');
$handle->setFullName('upforgrabs (Up For Grabs)');
$handle->setComplete(true);
break;
case ManiphestTaskOwner::PROJECT_NO_PROJECT:
$handle->setName('No Project');
$handle->setFullName('noproject (No Project)');
$handle->setComplete(true);
break;
default:
$handle->setName('Foul Magicks');
break;
}
$handles[$phid] = $handle;
}
break;
case PhabricatorPHIDConstants::PHID_TYPE_USER:
$object = new PhabricatorUser();
$users = $object->loadAllWhere('phid IN (%Ls)', $phids);
$users = mpull($users, null, 'getPHID');
$image_phids = mpull($users, 'getProfileImagePHID');
$image_phids = array_unique(array_filter($image_phids));
$images = array();
if ($image_phids) {
$images = id(new PhabricatorFile())->loadAllWhere('phid IN (%Ls)', $image_phids);
$images = mpull($images, 'getBestURI', 'getPHID');
}
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses($phids);
foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
$handle->setType($type);
if (empty($users[$phid])) {
$handle->setName('Unknown User');
} else {
$user = $users[$phid];
$handle->setName($user->getUsername());
$handle->setURI('/p/' . $user->getUsername() . '/');
$handle->setFullName($user->getUsername() . ' (' . $user->getRealName() . ')');
$handle->setAlternateID($user->getID());
$handle->setComplete(true);
if (isset($statuses[$phid])) {
$handle->setStatus($statuses[$phid]->getTextStatus());
}
$handle->setDisabled($user->getIsDisabled());
$img_uri = idx($images, $user->getProfileImagePHID());
if ($img_uri) {
$handle->setImageURI($img_uri);
} else {
$handle->setImageURI(PhabricatorUser::getDefaultProfileImageURI());
}
}
$handles[$phid] = $handle;
}
break;
case PhabricatorPHIDConstants::PHID_TYPE_MLST:
$object = new PhabricatorMetaMTAMailingList();
$lists = $object->loadAllWhere('phid IN (%Ls)', $phids);
$lists = mpull($lists, null, 'getPHID');
foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
$handle->setType($type);
if (empty($lists[$phid])) {
$handle->setName('Unknown Mailing List');
} else {
$list = $lists[$phid];
$handle->setName($list->getName());
$handle->setURI($list->getURI());
$handle->setFullName($list->getName());
$handle->setComplete(true);
}
$handles[$phid] = $handle;
}
break;
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
$object = new DifferentialRevision();
$revs = $object->loadAllWhere('phid in (%Ls)', $phids);
$revs = mpull($revs, null, 'getPHID');
foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
$handle->setType($type);
if (empty($revs[$phid])) {
$handle->setName('Unknown Revision');
//.........这里部分代码省略.........
示例6: loadImageURI
public function loadImageURI($size)
{
$file = $this->getImage($size);
if ($file) {
return $file->getBestURI();
}
return PhabricatorUser::getDefaultProfileImageURI();
}
示例7: didFilterPage
protected function didFilterPage(array $users)
{
if ($this->needProfile) {
$user_list = mpull($users, null, 'getPHID');
$profiles = new PhabricatorUserProfile();
$profiles = $profiles->loadAllWhere('userPHID IN (%Ls)', array_keys($user_list));
$profiles = mpull($profiles, null, 'getUserPHID');
foreach ($user_list as $user_phid => $user) {
$profile = idx($profiles, $user_phid);
if (!$profile) {
$profile = new PhabricatorUserProfile();
$profile->setUserPHID($user_phid);
}
$user->attachUserProfile($profile);
}
}
if ($this->needProfileImage) {
$rebuild = array();
foreach ($users as $user) {
$image_uri = $user->getProfileImageCache();
if ($image_uri) {
// This user has a valid cache, so we don't need to fetch any
// data or rebuild anything.
$user->attachProfileImageURI($image_uri);
continue;
}
// This user's cache is invalid or missing, so we're going to rebuild
// it.
$rebuild[] = $user;
}
if ($rebuild) {
$file_phids = mpull($rebuild, 'getProfileImagePHID');
$file_phids = array_filter($file_phids);
if ($file_phids) {
// NOTE: We're using the omnipotent user here because older profile
// images do not have the 'profile' flag, so they may not be visible
// to the executing viewer. At some point, we could migrate to add
// this flag and then use the real viewer, or just use the real
// viewer after enough time has passed to limit the impact of old
// data. The consequence of missing here is that we cache a default
// image when a real image exists.
$files = id(new PhabricatorFileQuery())->setParentQuery($this)->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($file_phids)->execute();
$files = mpull($files, null, 'getPHID');
} else {
$files = array();
}
foreach ($rebuild as $user) {
$image_phid = $user->getProfileImagePHID();
if (isset($files[$image_phid])) {
$image_uri = $files[$image_phid]->getBestURI();
} else {
$image_uri = PhabricatorUser::getDefaultProfileImageURI();
}
$user->writeProfileImageCache($image_uri);
$user->attachProfileImageURI($image_uri);
}
}
}
if ($this->needAvailability) {
$rebuild = array();
foreach ($users as $user) {
$cache = $user->getAvailabilityCache();
if ($cache !== null) {
$user->attachAvailability($cache);
} else {
$rebuild[] = $user;
}
}
if ($rebuild) {
$this->rebuildAvailabilityCache($rebuild);
}
}
return $users;
}
示例8: didFilterPage
protected function didFilterPage(array $users)
{
if ($this->needProfile) {
$user_list = mpull($users, null, 'getPHID');
$profiles = new PhabricatorUserProfile();
$profiles = $profiles->loadAllWhere('userPHID IN (%Ls)', array_keys($user_list));
$profiles = mpull($profiles, null, 'getUserPHID');
foreach ($user_list as $user_phid => $user) {
$profile = idx($profiles, $user_phid);
if (!$profile) {
$profile = new PhabricatorUserProfile();
$profile->setUserPHID($user_phid);
}
$user->attachUserProfile($profile);
}
}
if ($this->needProfileImage) {
$user_profile_file_phids = mpull($users, 'getProfileImagePHID');
$user_profile_file_phids = array_filter($user_profile_file_phids);
if ($user_profile_file_phids) {
$files = id(new PhabricatorFileQuery())->setParentQuery($this)->setViewer($this->getViewer())->withPHIDs($user_profile_file_phids)->execute();
$files = mpull($files, null, 'getPHID');
} else {
$files = array();
}
foreach ($users as $user) {
$image_phid = $user->getProfileImagePHID();
if (isset($files[$image_phid])) {
$profile_image_uri = $files[$image_phid]->getBestURI();
} else {
$profile_image_uri = PhabricatorUser::getDefaultProfileImageURI();
}
$user->attachProfileImageURI($profile_image_uri);
}
}
if ($this->needStatus) {
$user_list = mpull($users, null, 'getPHID');
$statuses = id(new PhabricatorCalendarEvent())->loadCurrentStatuses(array_keys($user_list));
foreach ($user_list as $phid => $user) {
$status = idx($statuses, $phid);
if ($status) {
$user->attachStatus($status);
}
}
}
return $users;
}
示例9: buildDict
public function buildDict()
{
$stories = $this->parseStories();
$dict = array();
$viewer = $this->user;
$desktop_key = PhabricatorDesktopNotificationsSetting::SETTINGKEY;
$desktop_enabled = $viewer->getUserSetting($desktop_key);
foreach ($stories as $story) {
if ($story instanceof PhabricatorApplicationTransactionFeedStory) {
$dict[] = array('desktopReady' => $desktop_enabled, 'title' => $story->renderText(), 'body' => $story->renderTextBody(), 'href' => $story->getURI(), 'icon' => $story->getImageURI());
} else {
if ($story instanceof PhabricatorNotificationTestFeedStory) {
$dict[] = array('desktopReady' => $desktop_enabled, 'title' => pht('Test Notification'), 'body' => $story->renderText(), 'href' => null, 'icon' => PhabricatorUser::getDefaultProfileImageURI());
} else {
$dict[] = array('desktopReady' => false, 'title' => null, 'body' => null, 'href' => null, 'icon' => null);
}
}
}
return $dict;
}
示例10: getIconURI
public function getIconURI()
{
return PhabricatorUser::getDefaultProfileImageURI();
}
示例11: buildDict
public function buildDict()
{
$stories = $this->parseStories();
$dict = array();
foreach ($stories as $story) {
if ($story instanceof PhabricatorApplicationTransactionFeedStory) {
$dict[] = array('desktopReady' => true, 'title' => $story->renderText(), 'body' => $story->renderTextBody(), 'href' => $story->getURI(), 'icon' => $story->getImageURI());
} else {
if ($story instanceof PhabricatorNotificationTestFeedStory) {
$dict[] = array('desktopReady' => true, 'title' => pht('Test Notification'), 'body' => $story->renderText(), 'href' => null, 'icon' => PhabricatorUser::getDefaultProfileImageURI());
} else {
$dict[] = array('desktopReady' => false, 'title' => null, 'body' => null, 'href' => null, 'icon' => null);
}
}
}
return $dict;
}