diff options
author | Andrew Dolgov <[email protected]> | 2018-11-22 16:55:37 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-11-22 16:55:37 +0300 |
commit | e08990f753c73a6a65a1bc840dec8e44a527d259 (patch) | |
tree | 09f0d753cfb63b35e992d49880f76dae546e07c2 | |
parent | ac5e55c2bdd1c986129d44bdc6ffa1ca3c743ba4 (diff) |
mailer: fix indents
-rw-r--r-- | classes/mailer.php | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/classes/mailer.php b/classes/mailer.php index 974e33bc4..93a9279e5 100644 --- a/classes/mailer.php +++ b/classes/mailer.php @@ -1,52 +1,52 @@ <?php class Mailer { - // TODO: support HTML mail (i.e. MIME messages) + // TODO: support HTML mail (i.e. MIME messages) - private $last_error = "Unable to send mail: check local configuration."; + private $last_error = "Unable to send mail: check local configuration."; - function mail($params) { + function mail($params) { - $to_name = $params["to_name"]; - $to_address = $params["to_address"]; - $subject = $params["subject"]; - $message = $params["message"]; - $message_html = $params["message_html"]; - $from_name = $params["from_name"] ? $params["from_name"] : SMTP_FROM_NAME; - $from_address = $params["from_address"] ? $params["from_address"] : SMTP_FROM_ADDRESS; + $to_name = $params["to_name"]; + $to_address = $params["to_address"]; + $subject = $params["subject"]; + $message = $params["message"]; + $message_html = $params["message_html"]; + $from_name = $params["from_name"] ? $params["from_name"] : SMTP_FROM_NAME; + $from_address = $params["from_address"] ? $params["from_address"] : SMTP_FROM_ADDRESS; - $additional_headers = $params["headers"] ? $params["headers"] : []; + $additional_headers = $params["headers"] ? $params["headers"] : []; - $from_combined = $from_name ? "$to_name <$to_address>" : $to_address; - $to_combined = $to_name ? "$to_name <$to_address>" : $to_address; + $from_combined = $from_name ? "$to_name <$to_address>" : $to_address; + $to_combined = $to_name ? "$to_name <$to_address>" : $to_address; - Logger::get()->log("Sending mail from $from_combined to $to_combined <$to_address> [$subject]: $message"); + Logger::get()->log("Sending mail from $from_combined to $to_combined <$to_address> [$subject]: $message"); - // HOOK_SEND_MAIL plugin instructions: - // 1. return 1 or true if mail is handled - // 2. return -1 if there's been a fatal error and no further action is allowed - // 3. any other return value will allow cycling to the next handler and, eventually, to default mail() function - // 4. set error message if needed via passed Mailer instance function set_error() + // HOOK_SEND_MAIL plugin instructions: + // 1. return 1 or true if mail is handled + // 2. return -1 if there's been a fatal error and no further action is allowed + // 3. any other return value will allow cycling to the next handler and, eventually, to default mail() function + // 4. set error message if needed via passed Mailer instance function set_error() - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEND_MAIL) as $p) { - $rc = $p->hook_send_mail($this, $params); + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEND_MAIL) as $p) { + $rc = $p->hook_send_mail($this, $params); - if ($rc == 1) - return $rc; + if ($rc == 1) + return $rc; - if ($rc == -1) - return 0; - } + if ($rc == -1) + return 0; + } - $headers[] = "From: $from_combined"; + $headers[] = "From: $from_combined"; - return mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers))); - } + return mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers))); + } - function set_error($message) { - $this->last_error = $message; - } + function set_error($message) { + $this->last_error = $message; + } - function error() { - return $this->last_error; - } + function error() { + return $this->last_error; + } } |