Make EMailer util dynamic
authornupplaPhil <admin@philipp.info>
Sat, 25 Jan 2020 22:10:39 +0000 (23:10 +0100)
committernupplaPhil <admin@philipp.info>
Sun, 26 Jan 2020 20:35:03 +0000 (21:35 +0100)
include/enotify.php
mod/item.php
src/DI.php
src/Util/Emailer.php

index 1444606..75ad7ef 100644 (file)
@@ -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,
index a9c5d43..a5ff594 100644 (file)
@@ -816,7 +816,7 @@ function item_post(App $a) {
                                        'htmlVersion' => $message,
                                        'textVersion' => HTML::toPlaintext($html.$disclaimer)
                                ];
-                               Emailer::send($params);
+                               DI::emailer()->send($params);
                        }
                }
        }
index 3034bd9..6eb1ed4 100644 (file)
@@ -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);
+       }
 }
index 41835b6..776d359 100644 (file)
@@ -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;