]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Event.php
Merge pull request #8696 from MrPetovan/bug/8694-event-network-unkn
[friendica.git] / src / Model / Event.php
index e5932e7c1d9cd43b3589a77b7757691f5b7af8e3..145632fdfcefb8d34e0c3fbc22bb27b4aa2f2939 100644 (file)
@@ -1,14 +1,30 @@
 <?php
 /**
- * @file src/Model/Event.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
 
 namespace Friendica\Model;
 
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
+use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -355,6 +371,7 @@ class Event
                                $item_arr['origin']        = $event['cid'] === 0 ? 1 : 0;
                                $item_arr['body']          = self::getBBCode($event);
                                $item_arr['event-id']      = $event['id'];
+                               $item_arr['network']       = Protocol::DFRN;
 
                                $item_arr['object']  = '<object><type>' . XML::escape(Activity\ObjectType::EVENT) . '</type><title></title><id>' . XML::escape($event['uri']) . '</id>';
                                $item_arr['object'] .= '<content>' . XML::escape(self::getBBCode($event)) . '</content>';
@@ -596,7 +613,7 @@ class Event
 
                        $title = BBCode::convert(Strings::escapeHtml($event['summary']));
                        if (!$title) {
-                               list($title, $_trash) = explode("<br", BBCode::convert(Strings::escapeHtml($event['desc'])), 2);
+                               list($title, $_trash) = explode("<br", BBCode::convert(Strings::escapeHtml($event['desc'])), BBCode::API);
                        }
 
                        $author_link = $event['author-link'];
@@ -856,7 +873,7 @@ class Event
                );
                $dtstart_title = DateTimeFormat::utc($item['event-start'], $item['event-adjust'] ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s');
                // Format: Jan till Dec.
-               $month_short = L10n::getDayShort(
+               $month_short = DI::l10n()->getDayShort(
                        $item['event-adjust'] ?
                                DateTimeFormat::local($item['event-start'], 'M')
                                : DateTimeFormat::utc($item['event-start'], 'M')
@@ -868,7 +885,7 @@ class Event
                $start_time = $item['event-adjust'] ?
                        DateTimeFormat::local($item['event-start'], $tformat)
                        : DateTimeFormat::utc($item['event-start'], $tformat);
-               $start_short = L10n::getDayShort(
+               $start_short = DI::l10n()->getDayShort(
                        $item['event-adjust'] ?
                                DateTimeFormat::local($item['event-start'], $dformat_short)
                                : DateTimeFormat::utc($item['event-start'], $dformat_short)
@@ -883,7 +900,7 @@ class Event
                                        : DateTimeFormat::utc($item['event-finish'], $dformat)
                        );
                        $dtend_title = DateTimeFormat::utc($item['event-finish'], $item['event-adjust'] ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s');
-                       $end_short = L10n::getDayShort(
+                       $end_short = DI::l10n()->getDayShort(
                                $item['event-adjust'] ?
                                        DateTimeFormat::local($item['event-finish'], $dformat_short)
                                        : DateTimeFormat::utc($item['event-finish'], $dformat_short)