From c972cce7404b908165838af89c9ba5233eed0f88 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 8 Jul 2021 16:38:02 +0000 Subject: [PATCH] Avoid notice --- src/Content/Text/BBCode.php | 2 +- src/Model/Event.php | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 954d630eb2..4440f22423 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1729,7 +1729,7 @@ class BBCode // start which is always required). Allow desc with a missing summary for compatibility. if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['start'])) { - $sub = Event::getHTML($ev, $simple_html); + $sub = Event::getHTML($ev, $simple_html, $uriid); $text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism", '', $text); $text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism", '', $text); diff --git a/src/Model/Event.php b/src/Model/Event.php index 6caa4b8715..0cc2aeaa45 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -41,12 +41,14 @@ use Friendica\Util\XML; class Event { - public static function getHTML(array $event, $simple = false) + public static function getHTML(array $event, $simple = false, $uriid = 0) { if (empty($event)) { return ''; } + $uriid = $event['uri-id'] ?? $uriid; + $bd_format = DI::l10n()->t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM. $event_start = DI::l10n()->getDay( @@ -67,11 +69,11 @@ class Event $o = ''; if (!empty($event['summary'])) { - $o .= "

" . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['summary']), $simple) . "

"; + $o .= "

" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['summary']), $simple) . "

"; } if (!empty($event['desc'])) { - $o .= "
" . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['desc']), $simple) . "
"; + $o .= "
" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['desc']), $simple) . "
"; } $o .= "

" . DI::l10n()->t('Starts:') . "

" . $event_start . "

"; @@ -81,7 +83,7 @@ class Event } if (!empty($event['location'])) { - $o .= "

" . DI::l10n()->t('Location:') . "

" . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['location']), $simple) . "

"; + $o .= "

" . DI::l10n()->t('Location:') . "

" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['location']), $simple) . "

"; } return $o; @@ -89,7 +91,7 @@ class Event $o = '
' . "\r\n"; - $o .= '
' . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['summary']), $simple) . '
' . "\r\n"; + $o .= '
' . BBCode::convertForItem($uriid, Strings::escapeHtml($event['summary']), $simple) . '
' . "\r\n"; $o .= '
' . DI::l10n()->t('Starts:') . ' ' . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['desc']), $simple) . '
' . "\r\n"; + $o .= '
' . BBCode::convertForItem($uriid, Strings::escapeHtml($event['desc']), $simple) . '
' . "\r\n"; } if (!empty($event['location'])) { $o .= '
' . DI::l10n()->t('Location:') . ' ' - . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['location']), $simple) + . BBCode::convertForItem($uriid, Strings::escapeHtml($event['location']), $simple) . '
' . "\r\n"; // Include a map of the location if the [map] BBCode is used.