From ea9d3b743835bca13091093cd8709ccb825fa417 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sat, 25 Jan 2020 23:10:39 +0100 Subject: [PATCH] Make EMailer util dynamic --- include/enotify.php | 2 +- mod/item.php | 2 +- src/DI.php | 8 ++++++++ src/Util/Emailer.php | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/enotify.php b/include/enotify.php index 144460693d..75ad7ef1fa 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -610,7 +610,7 @@ function notification($params) ]); // use the Emailer class to send the message - return Emailer::send([ + return DI::emailer()->send([ 'uid' => $params['uid'], 'fromName' => $sender_name, 'fromEmail' => $sender_email, diff --git a/mod/item.php b/mod/item.php index a9c5d43580..a5ff594a0c 100644 --- a/mod/item.php +++ b/mod/item.php @@ -816,7 +816,7 @@ function item_post(App $a) { 'htmlVersion' => $message, 'textVersion' => HTML::toPlaintext($html.$disclaimer) ]; - Emailer::send($params); + DI::emailer()->send($params); } } } diff --git a/src/DI.php b/src/DI.php index 3034bd971c..6eb1ed4b63 100644 --- a/src/DI.php +++ b/src/DI.php @@ -363,4 +363,12 @@ abstract class DI { return self::$dice->create(Util\Profiler::class); } + + /** + * @return Util\Emailer + */ + public static function emailer() + { + return self::$dice->create(Util\Emailer::class); + } } diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index 41835b6609..776d359216 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -31,7 +31,7 @@ class Emailer * @return bool * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function send(array $params) + public function send(array $params) { $params['sent'] = false;