File manager - Edit - /home/jardides/www/Cloud/apps/admin_notifications/lib/Notification/Notifier.php
Back
<?php /** * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> * * @author Joas Schilling <coding@schilljs.com> * * @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 <http://www.gnu.org/licenses/>. * */ namespace OCA\AdminNotifications\Notification; use OCA\AdminNotifications\AppInfo\Application; use OCP\IURLGenerator; use OCP\L10N\IFactory; use OCP\Notification\INotification; use OCP\Notification\INotifier; class Notifier implements INotifier { /** @var IFactory */ protected $l10nFactory; /** @var IURLGenerator */ protected $urlGenerator; /** * @param IFactory $l10nFactory * @param IURLGenerator $urlGenerator */ public function __construct(IFactory $l10nFactory, IURLGenerator $urlGenerator) { $this->l10nFactory = $l10nFactory; $this->urlGenerator = $urlGenerator; } /** * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification * @return INotification * @throws \InvalidArgumentException When the notification was not prepared by a notifier */ public function prepare(INotification $notification, $languageCode) { if ($notification->getApp() !== Application::APP_ID) { throw new \InvalidArgumentException('Unknown app'); } switch ($notification->getSubject()) { // Deal with known subjects case 'cli': case 'ocs': $subjectParams = $notification->getSubjectParameters(); $notification->setParsedSubject($subjectParams[0]); $messageParams = $notification->getMessageParameters(); if (isset($messageParams[0]) && $messageParams[0] !== '') { $notification->setParsedMessage($messageParams[0]); } $notification->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath(Application::APP_ID, 'app-dark.svg'))); return $notification; default: throw new \InvalidArgumentException('Unknown subject'); } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings