use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\Model\Contact;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map;
}
if ($simple) {
- $o = "<h3>" . BBCode::convert($event['summary'], false, $simple) . "</h3>";
+ if (!empty($event['summary'])) {
+ $o = "<h3>" . BBCode::convert($event['summary'], false, $simple) . "</h3>";
+ }
- $o .= "<div>" . BBCode::convert($event['desc'], false, $simple) . "</div>";
+ if (!empty($event['desc'])) {
+ $o .= "<div>" . BBCode::convert($event['desc'], false, $simple) . "</div>";
+ }
$o .= "<h4>" . L10n::t('Starts:') . "</h4><p>" . $event_start . "</p>";
$o .= "<h4>" . L10n::t('Finishes:') . "</h4><p>" . $event_end . "</p>";
}
- if (strlen($event['location'])) {
+ if (!empty($event['location'])) {
$o .= "<h4>" . L10n::t('Location:') . "</h4><p>" . BBCode::convert($event['location'], false, $simple) . "</p>";
}
if (!$event['nofinish']) {
$o .= '<div class="event-end" ><span class="event-label">' . L10n::t('Finishes:') . '</span> <span class="dtend" title="'
- . DateTimeFormat::utc($event['finish'], (($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
+ . DateTimeFormat::utc($event['finish'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
. '" >' . $event_end
. '</span></div>' . "\r\n";
}
- $o .= '<div class="description event-description">' . BBCode::convert($event['desc'], false, $simple) . '</div>' . "\r\n";
+ if (!empty($event['desc'])) {
+ $o .= '<div class="description event-description">' . BBCode::convert($event['desc'], false, $simple) . '</div>' . "\r\n";
+ }
- if (strlen($event['location'])) {
+ if (!empty($event['location'])) {
$o .= '<div class="event-location"><span class="event-label">' . L10n::t('Location:') . '</span> <span class="location">'
. BBCode::convert($event['location'], false, $simple)
. '</span></div>' . "\r\n";
$fmt = L10n::t('l, F j');
foreach ($event_result as $event) {
$item = Item::selectFirst(['plink', 'author-name', 'author-avatar', 'author-link'], ['id' => $event['itemid']]);
- if (DBA::isResult($item)) {
- $event = array_merge($event, $item);
+ if (!DBA::isResult($item)) {
+ // Using default values when no item had been found
+ $item = ['plink' => '', 'author-name' => '', 'author-avatar' => '', 'author-link' => ''];
}
+ $event = array_merge($event, $item);
+
$start = $event['adjust'] ? DateTimeFormat::local($event['start'], 'c') : DateTimeFormat::utc($event['start'], 'c');
$j = $event['adjust'] ? DateTimeFormat::local($event['start'], 'j') : DateTimeFormat::utc($event['start'], 'j');
$day = $event['adjust'] ? DateTimeFormat::local($event['start'], $fmt) : DateTimeFormat::utc($event['start'], $fmt);
$title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
}
+ $author_link = $event['author-link'];
+ $plink = $event['plink'];
+
+ $event['author-link'] = Contact::magicLink($author_link);
+ $event['plink'] = Contact::magicLink($author_link, $plink);
+
$html = self::getHTML($event);
$event['desc'] = BBCode::convert($event['desc']);
$event['location'] = BBCode::convert($event['location']);