$replace = array_values($nets);
$networkname = str_replace($search, $replace, $network);
+ $platform = '';
if (in_array($network, Protocol::FEDERATED) && !empty($gsid)) {
$gserver = self::getServerForId($gsid);
if (!empty($gserver['platform'])) {
- $platform = $gserver['platform'];
+ $platform = (string) $gserver['platform'];
} elseif (!empty($gserver['network']) && ($gserver['network'] != Protocol::ACTIVITYPUB)) {
$platform = self::networkToName($gserver['network']);
}
- if (!empty($platform)) {
+ if ($platform !== '') {
$networkname = $platform;
}
}
$networkname = DI::l10n()->t('%s (via %s)', $networkname, self::networkToName($protocol));
} elseif (in_array($network, ['', $protocol]) && ($network == Protocol::DFRN)) {
$networkname .= ' (DFRN)';
- } elseif (in_array($network, ['', $protocol]) && ($network == Protocol::DIASPORA) && ($platform != 'diaspora')) {
+ } elseif (in_array($network, ['', $protocol]) && ($network == Protocol::DIASPORA) && ($platform !== 'diaspora')) {
$networkname .= ' (Diaspora)';
}
$nets = [
Protocol::ACTIVITYPUB => 'activitypub', // https://commons.wikimedia.org/wiki/File:ActivityPub-logo-symbol.svg
Protocol::BLUESKY => 'bluesky', // https://commons.wikimedia.org/wiki/File:Bluesky_Logo.svg
- Protocol::DFRN => 'friendica',
+ Protocol::DFRN => 'friendica',
Protocol::DIASPORA => 'diaspora', // https://www.svgrepo.com/svg/362315/diaspora
Protocol::DIASPORA2 => 'diaspora', // https://www.svgrepo.com/svg/362315/diaspora
Protocol::DISCOURSE => 'discourse', // https://commons.wikimedia.org/wiki/File:Discourse_icon.svg
public static function replaceTag(string &$body, int $profile_uid, string $tag, string $network = '')
{
$replaced = false;
+ $contact = [];
//is it a person tag?
if (Tag::isType($tag, Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION)) {
}
}
+ $newname = '';
+
// Check if $contact has been successfully loaded
if (DBA::isResult($contact)) {
$profile = $contact['url'];
$oembed->thumbnail_height = $data['images'][0]['height'];
}
- Hook::callAll('oembed_fetch_url', $embedurl, $oembed);
+ Hook::callAll('oembed_fetch_url', $embedurl);
return $oembed;
}
return $attachments;
}
- $heights = [];
+ $heights = [];
$selected = '';
$previews = [];
+ $video = [];
foreach ($PostMedias as $PostMedia) {
foreach ($links as $link) {
return $npf;
}
+ $block = [];
+
$media = Post\Media::getByURL($uri_id, $attributes['src'], [Post\Media::AUDIO, Post\Media::VIDEO]);
if (!empty($media)) {
switch ($media['type']) {
$post['text'] = trim($item['title']);
}
+ $abstract = '';
+
// Fetch the abstract from the given target network
switch ($htmlmode) {
case BBCode::TWITTER:
case BBCode::BLUESKY:
$abstract = BBCode::getAbstract($item['body'], Protocol::BLUESKY);
break;
-
+
default: // We don't know the exact target.
// We fetch an abstract since there is a posting limit.
if ($limit > 0) {
$limit = $baselimit;
while ($message) {
+ $word = $message;
+ $message = '';
+ $pos = 0;
$pos_word = mb_strpos($message, ' ');
$pos_paragraph = mb_strpos($message, "\n");
$pos = $pos_word + 1;
} elseif ($pos_paragraph !== false) {
$pos = $pos_paragraph + 1;
- } else {
- $word = $message;
- $message = '';
}
if (trim($message)) {
$break = mb_strrpos($word, "\n") !== false;
if (!$break && (mb_strrpos($word, '. ') !== false || mb_strrpos($word, '? ') !== false || mb_strrpos($word, '! ') !== false)) {
$break = IntlChar::isupper(mb_substr($message, 0, 1));
- }
+ }
$comma = (mb_strrpos($word, ', ') !== false) && IntlChar::isalpha(mb_substr($message, 0, 1));
$break_pos = 0;
$comma_pos = 0;
} elseif ($break) {
- $break_pos = $pos + mb_strlen($part);
+ $break_pos = $pos + mb_strlen($part);
} elseif ($comma) {
$comma_pos = $pos + mb_strlen($part);
}
return '';
}
- $commonContacts = Contact\Relation::listCommon($localPCid, $visitorPCid, $condition, 0, 5, true);
+ $commonContacts = Contact\Relation::listCommon($localPCid, $visitorPCid, $condition, 0, 5);
if (!DBA::isResult($commonContacts)) {
return '';
}
DI::cache()->set($cachekey, $dthen, Duration::HOUR);
}
+ $cutoffday = '';
+ $thisday = '';
+ $nextday = '';
+
if ($dthen) {
// Set the start and end date to the beginning of the month
$cutoffday = $dthen;
return $o;
}
-
$cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years;
$cutoff = array_key_exists($cutoff_year, $ret);
public static function getHTML(array $contact, bool $hide_mention = false, bool $hide_follow = false): string
{
if (!isset($contact['network']) || !isset($contact['id'])) {
- Logger::warning('Incomplete contact', ['contact' => $contact ?? []]);
+ Logger::warning('Incomplete contact', ['contact' => $contact]);
}
$contact_url = Contact::getProfileLink($contact);
$hide_follow = true;
$hide_mention = true;
}
-
+
if ($contact['uid']) {
$id = $contact['id'];
$rel = $contact['rel'];