KONTOLODON
/
var
/
www
/
ojs-3.3.0-13
/
lib
/
pkp
/
lib
/
vendor
/
monolog
/
monolog
/
src
/
Monolog
/
Handler
/
Nama File / Folder
Size
Action
Curl
--
NONE
FingersCrossed
--
NONE
Slack
--
NONE
SyslogUdp
--
NONE
AbstractProcessingHandler.php
1.399KB
Hapus
Edit
Rename
AbstractSyslogHandler.php
3.5KB
Hapus
Edit
Rename
BrowserConsoleHandler.php
7.443KB
Hapus
Edit
Rename
DeduplicationHandler.php
5.562KB
Hapus
Edit
Rename
DoctrineCouchDBHandler.php
1.072KB
Hapus
Edit
Rename
ElasticsearchHandler.php
5.342KB
Hapus
Edit
Rename
FallbackGroupHandler.php
1.353KB
Hapus
Edit
Rename
FilterHandler.php
5.798KB
Hapus
Edit
Rename
FingersCrossedHandler.php
7.535KB
Hapus
Edit
Rename
FlowdockHandler.php
3.178KB
Hapus
Edit
Rename
FormattableHandlerInterface.php
0.825KB
Hapus
Edit
Rename
FormattableHandlerTrait.php
1.251KB
Hapus
Edit
Rename
MandrillHandler.php
2.637KB
Hapus
Edit
Rename
MissingExtensionException.php
0.462KB
Hapus
Edit
Rename
NativeMailerHandler.php
5.044KB
Hapus
Edit
Rename
ProcessableHandlerInterface.php
1.053KB
Hapus
Edit
Rename
ProcessableHandlerTrait.php
1.459KB
Hapus
Edit
Rename
RedisHandler.php
2.935KB
Hapus
Edit
Rename
RotatingFileHandler.php
6.04KB
Hapus
Edit
Rename
SlackWebhookHandler.php
3.935KB
Hapus
Edit
Rename
WebRequestRecognizerTrait.php
0.512KB
Hapus
Edit
Rename
WhatFailureGroupHandler.php
1.497KB
Hapus
Edit
Rename
<=Back
<?php declare(strict_types=1); /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Logger; use Swift; use Swift_Message; /** * MandrillHandler uses cURL to send the emails to the Mandrill API * * @author Adam Nicholson <adamnicholson10@gmail.com> */ class MandrillHandler extends MailHandler { /** @var Swift_Message */ protected $message; /** @var string */ protected $apiKey; /** * @psalm-param Swift_Message|callable(): Swift_Message $message * * @param string $apiKey A valid Mandrill API key * @param callable|Swift_Message $message An example message for real messages, only the body will be replaced * @param string|int $level The minimum logging level at which this handler will be triggered * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(string $apiKey, $message, $level = Logger::ERROR, bool $bubble = true) { parent::__construct($level, $bubble); if (!$message instanceof Swift_Message && is_callable($message)) { $message = $message(); } if (!$message instanceof Swift_Message) { throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it'); } $this->message = $message; $this->apiKey = $apiKey; } /** * {@inheritdoc} */ protected function send(string $content, array $records): void { $mime = 'text/plain'; if ($this->isHtmlBody($content)) { $mime = 'text/html'; } $message = clone $this->message; $message->setBody($content, $mime); /** @phpstan-ignore-next-line */ if (version_compare(Swift::VERSION, '6.0.0', '>=')) { $message->setDate(new \DateTimeImmutable()); } else { /** @phpstan-ignore-next-line */ $message->setDate(time()); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'key' => $this->apiKey, 'raw_message' => (string) $message, 'async' => false, ])); Curl\Util::execute($ch); } }
Liking