@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 114 lines 2.9 kB view raw
1<?php 2 3final class PhabricatorAuthAccountView extends AphrontView { 4 5 private $externalAccount; 6 private $provider; 7 8 public function setExternalAccount( 9 PhabricatorExternalAccount $external_account) { 10 $this->externalAccount = $external_account; 11 return $this; 12 } 13 14 public function setAuthProvider(PhabricatorAuthProvider $provider) { 15 $this->provider = $provider; 16 return $this; 17 } 18 19 public function render() { 20 $account = $this->externalAccount; 21 $provider = $this->provider; 22 23 require_celerity_resource('auth-css'); 24 25 $content = array(); 26 27 $dispname = $account->getDisplayName(); 28 $username = $account->getUsername(); 29 $realname = $account->getRealName(); 30 31 $use_name = null; 32 if (phutil_nonempty_string($dispname)) { 33 $use_name = $dispname; 34 } else if (phutil_nonempty_string($username) && 35 phutil_nonempty_string($realname)) { 36 $use_name = $username.' ('.$realname.')'; 37 } else if (phutil_nonempty_string($username)) { 38 $use_name = $username; 39 } else if (phutil_nonempty_string($realname)) { 40 $use_name = $realname; 41 } 42 43 $content[] = phutil_tag( 44 'div', 45 array( 46 'class' => 'auth-account-view-name', 47 ), 48 $use_name); 49 50 if ($provider) { 51 $prov_name = pht('%s Account', $provider->getProviderName()); 52 } else { 53 $prov_name = pht('"%s" Account', $account->getProviderType()); 54 } 55 56 $content[] = phutil_tag( 57 'div', 58 array( 59 'class' => 'auth-account-view-provider-name', 60 ), 61 array( 62 $prov_name, 63 )); 64 65 $account_uri = $account->getAccountURI(); 66 if (phutil_nonempty_string($account_uri)) { 67 68 // Make sure we don't link a "javascript:" URI if a user somehow 69 // managed to get one here. 70 71 if (PhabricatorEnv::isValidRemoteURIForLink($account_uri)) { 72 $account_uri = phutil_tag( 73 'a', 74 array( 75 'href' => $account_uri, 76 'target' => '_blank', 77 'rel' => 'noreferrer', 78 ), 79 $account_uri); 80 } 81 82 $content[] = phutil_tag( 83 'div', 84 array( 85 'class' => 'auth-account-view-account-uri', 86 ), 87 $account_uri); 88 } 89 90 $image_file = $account->getProfileImageFile(); 91 $xform = PhabricatorFileTransform::getTransformByKey( 92 PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE); 93 $image_uri = $image_file->getURIForTransform($xform); 94 list($x, $y) = $xform->getTransformedDimensions($image_file); 95 96 $profile_image = phutil_tag( 97 'div', 98 array( 99 'class' => 'auth-account-view-profile-image', 100 'style' => 'background-image: url('.$image_uri.');', 101 )); 102 103 return phutil_tag( 104 'div', 105 array( 106 'class' => 'auth-account-view', 107 ), 108 array( 109 $profile_image, 110 $content, 111 )); 112 } 113 114}