Browse Source

Fix invalid "emailer_prepare" Hook

- Use IEmail instead of array data
- Introduce "composer" based library for phpmailer
pull/8196/head
nupplaPhil 2 years ago
parent
commit
f6aea0d65a
No known key found for this signature in database GPG Key ID: D8365C3D36B77D90
  1. 2
      doc/de/Addons.md
  2. 21
      src/Object/Email.php
  3. 6
      src/Util/Emailer.php

2
doc/de/Addons.md

@ -475,7 +475,7 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
### src/Util/Emailer.php
Hook::callAll('emailer_send_prepare', $params);
Hook::callAll('emailer_send_prepare', $email);
Hook::callAll("emailer_send", $hookdata);
### src/Util/Map.php

21
src/Object/Email.php

@ -132,4 +132,25 @@ class Email implements IEmail
return $newEmail;
}
/**
* Creates a new Email instance based on a given prototype
*
* @param static $prototype The base prototype
* @param array $data The delta-data (key must be an existing property)
*
* @return static The new email instance
*/
public static function createFromPrototype(Email $prototype, array $data = [])
{
$newMail = clone $prototype;
foreach ($data as $key => $value) {
if (property_exists($newMail, $key)) {
$newMail->{$key} = $value;
}
}
return $newMail;
}
}

6
src/Util/Emailer.php

@ -45,11 +45,9 @@ class Emailer
*/
public function send(IEmail $email)
{
$params['sent'] = false;
Hook::callAll('emailer_send_prepare', $email);
Hook::callAll('emailer_send_prepare', $params);
if ($params['sent']) {
if (empty($email)) {
return true;
}

Loading…
Cancel
Save