diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 5a00feeaf6..4e75ea34d1 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -142,17 +142,18 @@ class ContactSelector $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; } } @@ -161,7 +162,7 @@ class ContactSelector $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)'; } @@ -191,7 +192,7 @@ class ContactSelector $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 diff --git a/src/Content/Item.php b/src/Content/Item.php index a5a1a17a19..66a3328b04 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -180,6 +180,7 @@ class Item 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)) { @@ -247,6 +248,8 @@ class Item } } + $newname = ''; + // Check if $contact has been successfully loaded if (DBA::isResult($contact)) { $profile = $contact['url']; diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index 4d3c589041..e5841ea22e 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -178,7 +178,7 @@ class OEmbed $oembed->thumbnail_height = $data['images'][0]['height']; } - Hook::callAll('oembed_fetch_url', $embedurl, $oembed); + Hook::callAll('oembed_fetch_url', $embedurl); return $oembed; } diff --git a/src/Content/Post/Repository/PostMedia.php b/src/Content/Post/Repository/PostMedia.php index e46bd99486..778591c1ab 100644 --- a/src/Content/Post/Repository/PostMedia.php +++ b/src/Content/Post/Repository/PostMedia.php @@ -116,9 +116,10 @@ class PostMedia extends BaseRepository return $attachments; } - $heights = []; + $heights = []; $selected = ''; $previews = []; + $video = []; foreach ($PostMedias as $PostMedia) { foreach ($links as $link) { diff --git a/src/Content/Text/NPF.php b/src/Content/Text/NPF.php index a0dd84fafa..c830d64a0f 100644 --- a/src/Content/Text/NPF.php +++ b/src/Content/Text/NPF.php @@ -543,6 +543,8 @@ class NPF return $npf; } + $block = []; + $media = Post\Media::getByURL($uri_id, $attributes['src'], [Post\Media::AUDIO, Post\Media::VIDEO]); if (!empty($media)) { switch ($media['type']) { diff --git a/src/Content/Text/Plaintext.php b/src/Content/Text/Plaintext.php index d2362714f4..04af33cf7d 100644 --- a/src/Content/Text/Plaintext.php +++ b/src/Content/Text/Plaintext.php @@ -114,6 +114,8 @@ class Plaintext $post['text'] = trim($item['title']); } + $abstract = ''; + // Fetch the abstract from the given target network switch ($htmlmode) { case BBCode::TWITTER: @@ -123,7 +125,7 @@ class Plaintext 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) { @@ -246,6 +248,9 @@ class Plaintext $limit = $baselimit; while ($message) { + $word = $message; + $message = ''; + $pos = 0; $pos_word = mb_strpos($message, ' '); $pos_paragraph = mb_strpos($message, "\n"); @@ -255,9 +260,6 @@ class Plaintext $pos = $pos_word + 1; } elseif ($pos_paragraph !== false) { $pos = $pos_paragraph + 1; - } else { - $word = $message; - $message = ''; } if (trim($message)) { @@ -272,7 +274,7 @@ class Plaintext $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)); @@ -291,7 +293,7 @@ class Plaintext $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); } diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 6f030b640f..0c73df9091 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -402,7 +402,7 @@ class Widget 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 ''; } @@ -479,6 +479,10 @@ class Widget 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; @@ -513,7 +517,6 @@ class Widget return $o; } - $cutoff_year = intval(DateTimeFormat::localNow('Y')) - $visible_years; $cutoff = array_key_exists($cutoff_year, $ret); diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php index 737db45ac2..cda7bb53b8 100644 --- a/src/Content/Widget/VCard.php +++ b/src/Content/Widget/VCard.php @@ -34,7 +34,7 @@ class VCard 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); @@ -61,7 +61,7 @@ class VCard $hide_follow = true; $hide_mention = true; } - + if ($contact['uid']) { $id = $contact['id']; $rel = $contact['rel'];