Avoid notice

This commit is contained in:
Michael 2021-07-08 16:38:02 +00:00
parent e72e74f7db
commit c972cce740
2 changed files with 10 additions and 8 deletions

View file

@ -1729,7 +1729,7 @@ class BBCode
// start which is always required). Allow desc with a missing summary for compatibility. // start which is always required). Allow desc with a missing summary for compatibility.
if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['start'])) { 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\-summary\](.*?)\[\/event\-summary\]/ism", '', $text);
$text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism", '', $text); $text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism", '', $text);

View file

@ -41,12 +41,14 @@ use Friendica\Util\XML;
class Event class Event
{ {
public static function getHTML(array $event, $simple = false) public static function getHTML(array $event, $simple = false, $uriid = 0)
{ {
if (empty($event)) { if (empty($event)) {
return ''; return '';
} }
$uriid = $event['uri-id'] ?? $uriid;
$bd_format = DI::l10n()->t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM. $bd_format = DI::l10n()->t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM.
$event_start = DI::l10n()->getDay( $event_start = DI::l10n()->getDay(
@ -67,11 +69,11 @@ class Event
$o = ''; $o = '';
if (!empty($event['summary'])) { if (!empty($event['summary'])) {
$o .= "<h3>" . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['summary']), $simple) . "</h3>"; $o .= "<h3>" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['summary']), $simple) . "</h3>";
} }
if (!empty($event['desc'])) { if (!empty($event['desc'])) {
$o .= "<div>" . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['desc']), $simple) . "</div>"; $o .= "<div>" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['desc']), $simple) . "</div>";
} }
$o .= "<h4>" . DI::l10n()->t('Starts:') . "</h4><p>" . $event_start . "</p>"; $o .= "<h4>" . DI::l10n()->t('Starts:') . "</h4><p>" . $event_start . "</p>";
@ -81,7 +83,7 @@ class Event
} }
if (!empty($event['location'])) { if (!empty($event['location'])) {
$o .= "<h4>" . DI::l10n()->t('Location:') . "</h4><p>" . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['location']), $simple) . "</p>"; $o .= "<h4>" . DI::l10n()->t('Location:') . "</h4><p>" . BBCode::convertForItem($uriid, Strings::escapeHtml($event['location']), $simple) . "</p>";
} }
return $o; return $o;
@ -89,7 +91,7 @@ class Event
$o = '<div class="vevent">' . "\r\n"; $o = '<div class="vevent">' . "\r\n";
$o .= '<div class="summary event-summary">' . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['summary']), $simple) . '</div>' . "\r\n"; $o .= '<div class="summary event-summary">' . BBCode::convertForItem($uriid, Strings::escapeHtml($event['summary']), $simple) . '</div>' . "\r\n";
$o .= '<div class="event-start"><span class="event-label">' . DI::l10n()->t('Starts:') . '</span>&nbsp;<span class="dtstart" title="' $o .= '<div class="event-start"><span class="event-label">' . DI::l10n()->t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
. DateTimeFormat::utc($event['start'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s')) . DateTimeFormat::utc($event['start'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
@ -104,12 +106,12 @@ class Event
} }
if (!empty($event['desc'])) { if (!empty($event['desc'])) {
$o .= '<div class="description event-description">' . BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['desc']), $simple) . '</div>' . "\r\n"; $o .= '<div class="description event-description">' . BBCode::convertForItem($uriid, Strings::escapeHtml($event['desc']), $simple) . '</div>' . "\r\n";
} }
if (!empty($event['location'])) { if (!empty($event['location'])) {
$o .= '<div class="event-location"><span class="event-label">' . DI::l10n()->t('Location:') . '</span>&nbsp;<span class="location">' $o .= '<div class="event-location"><span class="event-label">' . DI::l10n()->t('Location:') . '</span>&nbsp;<span class="location">'
. BBCode::convertForItem($event['uri-id'], Strings::escapeHtml($event['location']), $simple) . BBCode::convertForItem($uriid, Strings::escapeHtml($event['location']), $simple)
. '</span></div>' . "\r\n"; . '</span></div>' . "\r\n";
// Include a map of the location if the [map] BBCode is used. // Include a map of the location if the [map] BBCode is used.