X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FContactSelector.php;h=db7ad80ca638664dc50615a11e3736a8d04710a3;hb=a2a7d04fa1f3073e1bf79703e9516b20e502c225;hp=9035d37e73c01d3c838e35c30bbc662e1507acc0;hpb=e56a53647bd5469551bf4f9ef2df50a5dd16b943;p=friendica.git diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 9035d37e73..db7ad80ca6 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -41,7 +41,7 @@ class ContactSelector * @param boolean $disabled optional, default false * @return string */ - public static function pollInterval($current, $disabled = false) + public static function pollInterval(string $current, bool $disabled = false): string { $dis = (($disabled) ? ' disabled="disabled" ' : ''); $o = ''; @@ -84,7 +84,7 @@ class ContactSelector * @return string Server URL * @throws \Exception */ - private static function getServerURLForProfile($profile) + private static function getServerURLForProfile(string $profile): string { if (!empty(self::$server_url[$profile])) { return self::$server_url[$profile]; @@ -111,13 +111,16 @@ class ContactSelector } /** + * Determines network name + * * @param string $network network of the contact * @param string $profile optional, default empty * @param string $protocol (Optional) Protocol that is used for the transmission + * @param int $gsid Server id * @return string * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function networkToName($network, $profile = '', $protocol = '', $gsid = 0) + public static function networkToName(string $network, string $profile = '', string $protocol = '', int $gsid = null): string { $nets = [ Protocol::DFRN => DI::l10n()->t('DFRN'), @@ -179,12 +182,15 @@ class ContactSelector } /** + * Determines network's icon name + * * @param string $network network * @param string $profile optional, default empty - * @return string + * @param int $gsid Server id + * @return string Name for network icon * @throws \Exception */ - public static function networkToIcon($network, $profile = "") + public static function networkToIcon(string $network, string $profile = "", int $gsid = null): string { $nets = [ Protocol::DFRN => 'friendica', @@ -218,7 +224,14 @@ class ContactSelector $network_icon = str_replace($search, $replace, $network); if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) { - $gserver = self::getServerForProfile($profile); + if (!empty($gsid) && !empty(self::$serverdata[$gsid])) { + $gserver = self::$serverdata[$gsid]; + } elseif (!empty($gsid)) { + $gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['id' => $gsid]); + self::$serverdata[$gsid] = $gserver; + } else { + $gserver = self::getServerForProfile($profile); + } if (!empty($gserver['platform'])) { $network_icon = $platform_icons[strtolower($gserver['platform'])] ?? $network_icon; }