]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Event.php
Removed unused template variables
[friendica.git] / src / Model / Event.php
index 6f309a3397594479075c49d13f30ee4ea05c25d2..6f8ed123c17396bc4fd6e45f8405e13e33018967 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;
@@ -33,13 +49,13 @@ class Event
 
                $bd_format = DI::l10n()->t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM.
 
-               $event_start = L10n::getDay(
+               $event_start = DI::l10n()->getDay(
                        !empty($event['adjust']) ?
                        DateTimeFormat::local($event['start'], $bd_format) : DateTimeFormat::utc($event['start'], $bd_format)
                );
 
                if (!empty($event['finish'])) {
-                       $event_end = L10n::getDay(
+                       $event_end = DI::l10n()->getDay(
                                !empty($event['adjust']) ?
                                DateTimeFormat::local($event['finish'], $bd_format) : DateTimeFormat::utc($event['finish'], $bd_format)
                        );
@@ -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>';
@@ -571,7 +588,7 @@ class Event
                        $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);
-                       $day   = L10n::getDay($day);
+                       $day   = DI::l10n()->getDay($day);
 
                        if ($event['nofinish']) {
                                $end = null;
@@ -596,14 +613,12 @@ 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'];
-                       $plink       = $event['plink'];
 
                        $event['author-link'] = Contact::magicLink($author_link);
-                       $event['plink']       = Contact::magicLink($author_link, $plink);
 
                        $html = self::getHTML($event);
                        $event['summary']  = BBCode::convert(Strings::escapeHtml($event['summary']));
@@ -623,7 +638,7 @@ class Event
                                'is_first' => $is_first,
                                'item'     => $event,
                                'html'     => $html,
-                               'plink'    => [$event['plink'], DI::l10n()->t('link to source'), '', ''],
+                               'plink'    => Item::getPlink($event),
                        ];
                }
 
@@ -849,14 +864,14 @@ class Event
                $tformat       = DI::l10n()->t('g:i A'); // 8:01 AM.
 
                // Convert the time to different formats.
-               $dtstart_dt = L10n::getDay(
+               $dtstart_dt = DI::l10n()->getDay(
                        $item['event-adjust'] ?
                                DateTimeFormat::local($item['event-start'], $dformat)
                                : DateTimeFormat::utc($item['event-start'], $dformat)
                );
                $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 +883,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)
@@ -877,13 +892,13 @@ class Event
                // If the option 'nofinisch' isn't set, we need to format the finish date/time.
                if (!$item['event-nofinish']) {
                        $finish = true;
-                       $dtend_dt  = L10n::getDay(
+                       $dtend_dt  = DI::l10n()->getDay(
                                $item['event-adjust'] ?
                                        DateTimeFormat::local($item['event-finish'], $dformat)
                                        : 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)