+ /**
+ * @param string $network network
+ * @param string $profile optional, default empty
+ * @return string
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ public static function networkToIcon($network, $profile = "")
+ {
+ $nets = [
+ Protocol::DFRN => 'friendica',
+ Protocol::OSTATUS => 'gnu-social',
+ Protocol::FEED => 'rss',
+ Protocol::MAIL => '',
+ Protocol::DIASPORA => 'diaspora',
+ Protocol::ZOT => 'hubzilla',
+ Protocol::LINKEDIN => 'linkedin',
+ Protocol::XMPP => 'xmpp',
+ Protocol::MYSPACE => '',
+ Protocol::GPLUS => 'google-plus',
+ Protocol::PUMPIO => '',
+ Protocol::TWITTER => 'twitter',
+ Protocol::DIASPORA2 => 'diaspora',
+ Protocol::STATUSNET => 'gnu-social',
+ Protocol::ACTIVITYPUB => 'activitypub',
+ Protocol::PNUT => '',
+ ];
+
+ $search = array_keys($nets);
+ $replace = array_values($nets);
+
+ $networkicon = str_replace($search, $replace, $network);
+
+ if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) {
+ $server_url = self::getServerURLForProfile($profile);
+
+ // Now query the GServer for the platform name
+ $gserver = DBA::selectFirst('gserver', ['platform'], ['nurl' => $server_url]);
+
+ if (DBA::isResult($gserver) && !empty($gserver['platform'])) {
+ switch (strtolower($gserver['platform'])) {
+ case 'friendica':
+ $networkicon = 'friendica';
+ break;
+ case 'hubzilla':
+ $networkicon = 'hubzilla';
+ break;
+ case 'mastodon':
+ $networkicon = 'mastodon';
+ break;
+ case 'pleroma':
+ $networkicon = 'pleroma';
+ break;
+ }
+ }
+ }
+
+ if (empty($networkicon)) {
+ $networkicon = 'file-text-o';
+ }
+
+ return $networkicon;
+ }
+