/home/grav/www/html/user/plugins/email/vendor/symfony/mailer/Transport/Dsn.php
private $host;
private $user;
private $password;
private $port;
private $options;
public function __construct(string $scheme, string $host, string $user = null, string $password = null, int $port = null, array $options = [])
{
$this->scheme = $scheme;
$this->host = $host;
$this->user = $user;
$this->password = $password;
$this->port = $port;
$this->options = $options;
}
public static function fromString(string $dsn): self
{
if (false === $parsedDsn = parse_url($dsn)) {
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN is invalid.', $dsn));
}
if (!isset($parsedDsn['scheme'])) {
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a scheme.', $dsn));
}
if (!isset($parsedDsn['host'])) {
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a host (use "default" by default).', $dsn));
}
$user = '' !== ($parsedDsn['user'] ?? '') ? urldecode($parsedDsn['user']) : null;
$password = '' !== ($parsedDsn['pass'] ?? '') ? urldecode($parsedDsn['pass']) : null;
$port = $parsedDsn['port'] ?? null;
parse_str($parsedDsn['query'] ?? '', $query);
return new self($parsedDsn['scheme'], $parsedDsn['host'], $user, $password, $port, $query);
}
public function getScheme(): string
{
Arguments
"The "smtp://" mailer DSN is invalid."
/home/grav/www/html/user/plugins/email/vendor/symfony/mailer/Transport.php
$args[] = $arg;
if (\strlen($dsn) === $offset) {
break;
}
++$offset;
if (')' === $dsn[$offset - 1]) {
break;
}
}
return [new $class($args), $offset];
}
}
if (preg_match('{(\w+)\(}A', $dsn, $matches, 0, $offset)) {
throw new InvalidArgumentException(sprintf('The "%s" keyword is not valid (valid ones are "%s"), ', $matches[1], implode('", "', array_keys($keywords))));
}
if ($pos = strcspn($dsn, ' )', $offset)) {
return [$this->fromDsnObject(Dsn::fromString(substr($dsn, $offset, $pos))), $offset + $pos];
}
return [$this->fromDsnObject(Dsn::fromString(substr($dsn, $offset))), \strlen($dsn)];
}
}
public function fromDsnObject(Dsn $dsn): TransportInterface
{
foreach ($this->factories as $factory) {
if ($factory->supports($dsn)) {
return $factory->create($dsn);
}
}
throw new UnsupportedSchemeException($dsn);
}
/**
* @param EventDispatcherInterface|null $dispatcher
* @param HttpClientInterface|null $client
Arguments
/home/grav/www/html/user/plugins/email/vendor/symfony/mailer/Transport.php
* @param TransportFactoryInterface[] $factories
*/
public function __construct(iterable $factories)
{
$this->factories = $factories;
}
public function fromStrings(array $dsns): Transports
{
$transports = [];
foreach ($dsns as $name => $dsn) {
$transports[$name] = $this->fromString($dsn);
}
return new Transports($transports);
}
public function fromString(string $dsn): TransportInterface
{
[$transport, $offset] = $this->parseDsn($dsn);
if ($offset !== \strlen($dsn)) {
throw new InvalidArgumentException(sprintf('The DSN has some garbage at the end: "%s".', substr($dsn, $offset)));
}
return $transport;
}
private function parseDsn(string $dsn, int $offset = 0): array
{
static $keywords = [
'failover' => FailoverTransport::class,
'roundrobin' => RoundRobinTransport::class,
];
while (true) {
foreach ($keywords as $name => $class) {
$name .= '(';
if ($name === substr($dsn, $offset, \strlen($name))) {
$offset += \strlen($name) - 1;
preg_match('{\(([^()]|(?R))*\)}A', $dsn, $matches, 0, $offset);
Arguments
/home/grav/www/html/user/plugins/email/vendor/symfony/mailer/Transport.php
SendinblueTransportFactory::class,
SesTransportFactory::class,
];
private $factories;
/**
* @param EventDispatcherInterface|null $dispatcher
* @param HttpClientInterface|null $client
* @param LoggerInterface|null $logger
*/
public static function fromDsn(string $dsn/* , EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null */): TransportInterface
{
$dispatcher = 2 <= \func_num_args() ? func_get_arg(1) : null;
$client = 3 <= \func_num_args() ? func_get_arg(2) : null;
$logger = 4 <= \func_num_args() ? func_get_arg(3) : null;
$factory = new self(iterator_to_array(self::getDefaultFactories($dispatcher, $client, $logger)));
return $factory->fromString($dsn);
}
/**
* @param EventDispatcherInterface|null $dispatcher
* @param HttpClientInterface|null $client
* @param LoggerInterface|null $logger
*/
public static function fromDsns(array $dsns/* , EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null */): TransportInterface
{
$dispatcher = 2 <= \func_num_args() ? func_get_arg(1) : null;
$client = 3 <= \func_num_args() ? func_get_arg(2) : null;
$logger = 4 <= \func_num_args() ? func_get_arg(3) : null;
$factory = new self(iterator_to_array(self::getDefaultFactories($dispatcher, $client, $logger)));
return $factory->fromStrings($dsns);
}
/**
* @param TransportFactoryInterface[] $factories
Arguments
/home/grav/www/html/user/plugins/email/classes/Email.php
case 'sendmail':
$dsn = 'sendmail://default';
$bin = $config->get('plugins.email.mailer.sendmail.bin');
if (isset($bin)) {
$dsn .= '?command=' . urlencode($bin);
}
break;
default:
$e = new Event(['engine' => $engine, ]);
Grav::instance()->fireEvent('onEmailTransportDsn', $e);
if (isset($e['dsn'])) {
$dsn = $e['dsn'];
}
break;
}
if ($dsn instanceof TransportInterface) {
$transport = $dsn;
} else {
$transport = Transport::fromDsn($dsn) ;
}
return $transport;
}
/**
* @param array $recipients
* @return string
*/
protected function jsonifyRecipients(array $recipients): string
{
$json = [];
foreach ($recipients as $recipient) {
$json[] = str_replace('"', "", $recipient->toString());
}
return json_encode($json);
}
protected function isValidEmail($email): bool
{
Arguments
/home/grav/www/html/user/plugins/email/classes/Email.php
$name = $data['name'] ?? $data['fullname'] ?? '';
}
} else {
$email = $data[0] ?? '';
$name = $data[1] ?? '';
}
return new Address($email, $name);
}
/**
* @return null|Mailer
* @internal
*/
protected function initMailer(): ?Mailer
{
if (!$this->enabled()) {
return null;
}
if (!$this->mailer) {
$this->transport = $this->getTransport();
// Create the Mailer using your created Transport
$this->mailer = new Mailer($this->transport);
}
return $this->mailer;
}
/**
* @return void
* @throws \Exception
*/
protected function initLog()
{
$log_file = Grav::instance()['locator']->findResource('log://email.log', true, true);
$this->log = new Logger('email');
/** @var UniformResourceLocator $locator */
$this->log->pushHandler(new StreamHandler($log_file, Logger::DEBUG));
}
/**
* @param array $params
/home/grav/www/html/user/plugins/email/classes/Email.php
use Symfony\Component\Mailer\Header\MetadataHeader;
use Symfony\Component\Mailer\Header\TagHeader;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Transport\TransportInterface;
use Symfony\Component\Mime\Address;
class Email
{
/** @var Mailer */
protected $mailer;
/** @var TransportInterface */
protected $transport;
protected $log;
public function __construct()
{
$this->initMailer();
$this->initLog();
}
/**
* Returns true if emails have been enabled in the system.
*
* @return bool
*/
public static function enabled(): bool
{
return Grav::instance()['config']->get('plugins.email.mailer.engine') !== 'none';
}
/**
* Returns true if debugging on emails has been enabled.
*
* @return bool
*/
public static function debug(): bool
{
/home/grav/www/html/user/plugins/email/email.php
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onSchedulerInitialized' => ['onSchedulerInitialized', 0],
'onAdminSave' => ['onAdminSave', 0],
];
}
/**
* @return ClassLoader
*/
public function autoload(): ClassLoader
{
return require __DIR__ . '/vendor/autoload.php';
}
/**
* Initialize emailing.
*/
public function onPluginsInitialized()
{
$this->email = new Email();
if ($this->email::enabled()) {
$this->grav['Email'] = $this->email;
}
}
/**
* Add twig paths to plugin templates.
*/
public function onTwigTemplatePaths()
{
$twig = $this->grav['twig'];
$twig->twig_paths[] = __DIR__ . '/templates';
}
/**
* Force compile during save if admin plugin save
*
* @param Event $event
*/
/home/grav/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
// @deprecated: the ternary operator is part of a BC layer and should be removed in 5.0
$listener($listener instanceof WrappedListener ? new LegacyEventProxy($event) : $event, $eventName, $this);
}
}
/**
* @deprecated since Symfony 4.3, use callListeners() instead
*/
protected function doDispatch($listeners, $eventName, Event $event)
{
foreach ($listeners as $listener) {
if ($event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
*/
private function sortListeners(string $eventName)
{
krsort($this->listeners[$eventName]);
$this->sorted[$eventName] = [];
foreach ($this->listeners[$eventName] as &$listeners) {
foreach ($listeners as $k => &$listener) {
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && 2 >= \count($listener)) {
$listener[0] = $listener[0]();
$listener[1] = $listener[1] ?? '__invoke';
}
$this->sorted[$eventName][] = $listener;
}
}
Arguments
RocketTheme\Toolbox\Event\Event {#138}
"onPluginsInitialized"
Symfony\Component\EventDispatcher\EventDispatcher {#115
-listeners: array:38 [
"onPluginsInitialized" => array:7 [
100002 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ProblemsPlugin {#102}
1 => "autoload"
]
]
100001 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ProblemsPlugin {#102}
1 => "onPluginsInitialized"
]
]
100000 => array:3 [
0 => array:2 [
0 => Grav\Plugin\AdminPlugin {#95}
1 => "setup"
]
1 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "autoload"
]
2 => array:2 [
0 => Grav\Plugin\SitemapPlugin {#104}
1 => "autoload"
]
]
10000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "initializeSession"
]
]
1001 => array:1 [
0 => array:2 [
0 => Grav\Plugin\AdminPlugin {#95}
1 => "onPluginsInitialized"
]
]
1000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "initializeLogin"
]
]
0 => array:5 [
0 => array:2 [
0 => Grav\Plugin\AdminAddonMediaRenamePlugin {#94}
1 => "onPluginsInitialized"
]
1 => array:2 [
0 => Grav\Plugin\EmailPlugin {#97}
1 => "onPluginsInitialized"
]
2 => array:2 [
0 => Grav\Plugin\FlexObjectsPlugin {#99}
1 => "onPluginsInitialized"
]
3 => array:2 [
0 => Grav\Plugin\FormPlugin {#100}
1 => "onPluginsInitialized"
]
4 => array:2 [
0 => Grav\Plugin\SitemapPlugin {#104}
1 => "onPluginsInitialized"
]
]
]
"onRequestHandlerInit" => array:1 [
100000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\AdminPlugin {#95}
1 => "onRequestHandlerInit"
]
]
]
"onFormRegisterTypes" => array:1 [
0 => array:2 [
0 => array:2 [
0 => Grav\Plugin\AdminPlugin {#95}
1 => "onFormRegisterTypes"
]
1 => array:2 [
0 => Grav\Plugin\FlexObjectsPlugin {#99}
1 => "onFormRegisterTypes"
]
]
]
"onPageInitialized" => array:1 [
0 => array:2 [
0 => array:2 [
0 => Grav\Plugin\AdminPlugin {#95}
1 => "onPageInitialized"
]
1 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "authorizePage"
]
]
]
"onShutdown" => array:1 [
1000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\AdminPlugin {#95}
1 => "onShutdown"
]
]
]
"Grav\Events\PermissionsRegisterEvent" => array:2 [
1000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\AdminPlugin {#95}
1 => "onRegisterPermissions"
]
]
100 => array:1 [
0 => array:2 [
0 => Grav\Plugin\FlexObjectsPlugin {#99}
1 => "onRegisterPermissions"
]
]
]
"onFormProcessed" => array:1 [
0 => array:2 [
0 => array:2 [
0 => Grav\Plugin\EmailPlugin {#97}
1 => "onFormProcessed"
]
1 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "onFormProcessed"
]
]
]
"onTwigTemplatePaths" => array:2 [
0 => array:3 [
0 => array:2 [
0 => Grav\Plugin\EmailPlugin {#97}
1 => "onTwigTemplatePaths"
]
1 => array:2 [
0 => Grav\Plugin\FormPlugin {#100}
1 => "onTwigTemplatePaths"
]
2 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "onTwigTemplatePaths"
]
]
-10 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ErrorPlugin {#98}
1 => "onTwigTemplatePaths"
]
]
]
"onSchedulerInitialized" => array:1 [
0 => array:2 [
0 => array:2 [
0 => Grav\Plugin\EmailPlugin {#97}
1 => "onSchedulerInitialized"
]
1 => array:2 [
0 => Grav\Common\Cache {#153}
1 => "onSchedulerInitialized"
]
]
]
"onAdminSave" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\EmailPlugin {#97}
1 => "onAdminSave"
]
]
]
"onCliInitialize" => array:2 [
100000 => array:2 [
0 => array:2 [
0 => Grav\Plugin\ErrorPlugin {#98}
1 => "autoload"
]
1 => array:2 [
0 => Grav\Plugin\FlexObjectsPlugin {#99}
1 => "autoload"
]
]
10 => array:1 [
0 => array:2 [
0 => Grav\Plugin\FlexObjectsPlugin {#99}
1 => "initializeFlex"
]
]
]
"onPageNotFound" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ErrorPlugin {#98}
1 => "onPageNotFound"
]
]
]
"onGetPageTemplates" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ErrorPlugin {#98}
1 => "onGetPageTemplates"
]
]
]
"onDisplayErrorPage.404" => array:1 [
-1 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ErrorPlugin {#98}
1 => "onDisplayErrorPage404"
]
]
]
"Grav\Events\PluginsLoadedEvent" => array:1 [
10 => array:1 [
0 => array:2 [
0 => Grav\Plugin\FlexObjectsPlugin {#99}
1 => "initializeFlex"
]
]
]
"Grav\Events\FlexRegisterEvent" => array:1 [
100 => array:1 [
0 => array:2 [
0 => Grav\Plugin\FlexObjectsPlugin {#99}
1 => "onRegisterFlex"
]
]
]
"onTwigExtensions" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\FormPlugin {#100}
1 => "onTwigExtensions"
]
]
]
"Grav\Events\SessionStartEvent" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "onSessionStart"
]
]
]
"onTask.login.login" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "loginController"
]
]
]
"onTask.login.twofa" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "loginController"
]
]
]
"onTask.login.twofa_cancel" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "loginController"
]
]
]
"onTask.login.forgot" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "loginController"
]
]
]
"onTask.login.logout" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "loginController"
]
]
]
"onTask.login.reset" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "loginController"
]
]
]
"onTask.login.regenerate2FASecret" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "loginController"
]
]
]
"onPagesInitialized" => array:1 [
0 => array:2 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "storeReferrerPage"
]
1 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "pageVisibility"
]
]
]
"onPageFallBackUrl" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "authorizeFallBackUrl"
]
]
]
"onTwigSiteVariables" => array:1 [
-100000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "onTwigSiteVariables"
]
]
]
"onUserLoginAuthenticate" => array:5 [
10003 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginAuthenticateRateLimit"
]
]
10002 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginAuthenticateByRegistration"
]
]
10001 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginAuthenticateByRememberMe"
]
]
10000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginAuthenticateByEmail"
]
]
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginAuthenticate"
]
]
]
"onUserLoginAuthorize" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginAuthorize"
]
]
]
"onUserLoginFailure" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginGuest"
]
]
]
"onUserLoginGuest" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginGuest"
]
]
]
"onUserLogin" => array:2 [
1000 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLoginResetRateLimit"
]
]
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLogin"
]
]
]
"onUserLogout" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\LoginPlugin {#101}
1 => "userLogout"
]
]
]
"onAdminGenerateReports" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ProblemsPlugin {#102}
1 => "onAdminGenerateReports"
]
]
]
"onAdminCompilePresetSCSS" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ProblemsPlugin {#102}
1 => "onAdminCompilePresetSCSS"
]
]
]
"onBlueprintCreated" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\SitemapPlugin {#104}
1 => "onBlueprintCreated"
]
]
]
"onFatalException" => array:1 [
0 => array:1 [
0 => array:2 [
0 => Grav\Plugin\ProblemsPlugin {#102}
1 => "onFatalException"
]
]
]
]
-sorted: []
-optimized: array:4 [
"Grav\Events\PluginsLoadedEvent" => array:1 [
0 => Grav\Plugin\FlexObjectsPlugin::initializeFlex(): void {#121 …4}
]
"Grav\Events\SessionStartEvent" => array:1 [
0 => Grav\Plugin\LoginPlugin::onSessionStart(SessionStartEvent $event) {#135 …3}
]
"onPluginsInitialized" => array:13 [
0 => Grav\Plugin\ProblemsPlugin::autoload(): ClassLoader {#139 …4}
1 => Grav\Plugin\ProblemsPlugin::onPluginsInitialized(): void {#140 …4}
2 => Grav\Plugin\AdminPlugin::setup() {#141 …3}
3 => Grav\Plugin\LoginPlugin::autoload(): ClassLoader {#142 …4}
4 => Grav\Plugin\SitemapPlugin::autoload(): ClassLoader {#143 …4}
5 => Grav\Plugin\LoginPlugin::initializeSession() {#144 …3}
6 => Grav\Plugin\AdminPlugin::onPluginsInitialized() {#145 …3}
7 => Grav\Plugin\LoginPlugin::initializeLogin() {#146 …3}
8 => Grav\Plugin\AdminAddonMediaRenamePlugin::onPluginsInitialized() {#147 …3}
9 => Grav\Plugin\EmailPlugin::onPluginsInitialized() {#148 …3}
10 => Grav\Plugin\FlexObjectsPlugin::onPluginsInitialized(): void {#149 …4}
11 => Grav\Plugin\FormPlugin::onPluginsInitialized(): void {#150 …4}
12 => Grav\Plugin\SitemapPlugin::onPluginsInitialized() {#151 …3}
]
"onFatalException" => array:1 [
0 => Grav\Plugin\ProblemsPlugin::onFatalException(): void {#159 …4}
]
]
}
/home/grav/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php
} else {
$this->removeListener($eventName, [$subscriber, \is_string($params) ? $params : $params[0]]);
}
}
}
/**
* Triggers the listeners of an event.
*
* This method can be overridden to add functionality that is executed
* for each listener.
*
* @param callable[] $listeners The event listeners
* @param string $eventName The name of the event to dispatch
* @param object $event The event object to pass to the event handlers/listeners
*/
protected function callListeners(iterable $listeners, string $eventName, $event)
{
if ($event instanceof Event) {
$this->doDispatch($listeners, $eventName, $event);
return;
}
$stoppable = $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
// @deprecated: the ternary operator is part of a BC layer and should be removed in 5.0
$listener($listener instanceof WrappedListener ? new LegacyEventProxy($event) : $event, $eventName, $this);
}
}
/**
* @deprecated since Symfony 4.3, use callListeners() instead
*/
protected function doDispatch($listeners, $eventName, Event $event)
{
Arguments
array:13 [
0 => Grav\Plugin\ProblemsPlugin::autoload(): ClassLoader {#139 …4}
1 => Grav\Plugin\ProblemsPlugin::onPluginsInitialized(): void {#140 …4}
2 => Grav\Plugin\AdminPlugin::setup() {#141 …3}
3 => Grav\Plugin\LoginPlugin::autoload(): ClassLoader {#142 …4}
4 => Grav\Plugin\SitemapPlugin::autoload(): ClassLoader {#143 …4}
5 => Grav\Plugin\LoginPlugin::initializeSession() {#144 …3}
6 => Grav\Plugin\AdminPlugin::onPluginsInitialized() {#145 …3}
7 => Grav\Plugin\LoginPlugin::initializeLogin() {#146 …3}
8 => Grav\Plugin\AdminAddonMediaRenamePlugin::onPluginsInitialized() {#147 …3}
9 => Grav\Plugin\EmailPlugin::onPluginsInitialized() {#148 …3}
10 => Grav\Plugin\FlexObjectsPlugin::onPluginsInitialized(): void {#149 …4}
11 => Grav\Plugin\FormPlugin::onPluginsInitialized(): void {#150 …4}
12 => Grav\Plugin\SitemapPlugin::onPluginsInitialized() {#151 …3}
]
"onPluginsInitialized"
RocketTheme\Toolbox\Event\Event {#138}
/home/grav/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php
if (\is_object($event)) {
$eventName = $eventName ?? \get_class($event);
} elseif (\is_string($event) && (null === $eventName || $eventName instanceof ContractsEvent || $eventName instanceof Event)) {
@trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.', EventDispatcherInterface::class), \E_USER_DEPRECATED);
$swap = $event;
$event = $eventName ?? new Event();
$eventName = $swap;
} else {
throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, "%s" given.', EventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event)));
}
if (null !== $this->optimized && null !== $eventName) {
$listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName));
} else {
$listeners = $this->getListeners($eventName);
}
if ($listeners) {
$this->callListeners($listeners, $eventName, $event);
}
return $event;
}
/**
* {@inheritdoc}
*/
public function getListeners($eventName = null)
{
if (null !== $eventName) {
if (empty($this->listeners[$eventName])) {
return [];
}
if (!isset($this->sorted[$eventName])) {
$this->sortListeners($eventName);
}
return $this->sorted[$eventName];
Arguments
array:13 [
0 => Grav\Plugin\ProblemsPlugin::autoload(): ClassLoader {#139 …4}
1 => Grav\Plugin\ProblemsPlugin::onPluginsInitialized(): void {#140 …4}
2 => Grav\Plugin\AdminPlugin::setup() {#141 …3}
3 => Grav\Plugin\LoginPlugin::autoload(): ClassLoader {#142 …4}
4 => Grav\Plugin\SitemapPlugin::autoload(): ClassLoader {#143 …4}
5 => Grav\Plugin\LoginPlugin::initializeSession() {#144 …3}
6 => Grav\Plugin\AdminPlugin::onPluginsInitialized() {#145 …3}
7 => Grav\Plugin\LoginPlugin::initializeLogin() {#146 …3}
8 => Grav\Plugin\AdminAddonMediaRenamePlugin::onPluginsInitialized() {#147 …3}
9 => Grav\Plugin\EmailPlugin::onPluginsInitialized() {#148 …3}
10 => Grav\Plugin\FlexObjectsPlugin::onPluginsInitialized(): void {#149 …4}
11 => Grav\Plugin\FormPlugin::onPluginsInitialized(): void {#150 …4}
12 => Grav\Plugin\SitemapPlugin::onPluginsInitialized() {#151 …3}
]
"onPluginsInitialized"
RocketTheme\Toolbox\Event\Event {#138}
/home/grav/www/html/system/src/Grav/Common/Grav.php
return $event;
}
/**
* Fires an event with optional parameters.
*
* @param string $eventName
* @param Event|null $event
* @return Event
*/
public function fireEvent($eventName, Event $event = null)
{
/** @var EventDispatcherInterface $events */
$events = $this['events'];
if (null === $event) {
$event = new Event();
}
$timestamp = microtime(true);
$events->dispatch($event, $eventName);
/** @var Debugger $debugger */
$debugger = $this['debugger'];
$debugger->addEvent($eventName, $event, $events, $timestamp);
return $event;
}
/**
* Set the final content length for the page and flush the buffer
*
* @return void
*/
public function shutdown(): void
{
// Prevent user abort allowing onShutdown event to run without interruptions.
if (function_exists('ignore_user_abort')) {
@ignore_user_abort(true);
}
Arguments
RocketTheme\Toolbox\Event\Event {#138}
"onPluginsInitialized"
/home/grav/www/html/system/src/Grav/Common/Processors/PluginsProcessor.php
* Class PluginsProcessor
* @package Grav\Common\Processors
*/
class PluginsProcessor extends ProcessorBase
{
/** @var string */
public $id = 'plugins';
/** @var string */
public $title = 'Initialize Plugins';
/**
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$this->startTimer();
$grav = $this->container;
$grav->fireEvent('onPluginsInitialized');
$this->stopTimer();
return $handler->handle($request);
}
}
Arguments
/home/grav/www/html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
protected $handler;
/** @var ContainerInterface|null */
protected $container;
/**
* {@inheritdoc}
* @throws InvalidArgumentException
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$middleware = array_shift($this->middleware);
// Use default callable if there is no middleware.
if ($middleware === null) {
return call_user_func($this->handler, $request);
}
if ($middleware instanceof MiddlewareInterface) {
return $middleware->process($request, clone $this);
}
if (null === $this->container || !$this->container->has($middleware)) {
throw new InvalidArgumentException(
sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class),
$middleware
);
}
array_unshift($this->middleware, $this->container->get($middleware));
return $this->handle($request);
}
}
Arguments
Nyholm\Psr7\ServerRequest {#63}
Grav\Framework\RequestHandler\RequestHandler {#137}
/home/grav/www/html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
// Use default callable if there is no middleware.
if ($middleware === null) {
return call_user_func($this->handler, $request);
}
if ($middleware instanceof MiddlewareInterface) {
return $middleware->process($request, clone $this);
}
if (null === $this->container || !$this->container->has($middleware)) {
throw new InvalidArgumentException(
sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class),
$middleware
);
}
array_unshift($this->middleware, $this->container->get($middleware));
return $this->handle($request);
}
}
Arguments
Nyholm\Psr7\ServerRequest {#63}
/home/grav/www/html/system/src/Grav/Common/Processors/InitializeProcessor.php
// Initialize URI (uses session, see issue #3269).
$this->initializeUri($config);
// Grav may return redirect response right away.
$redirectCode = (int)$config->get('system.pages.redirect_trailing_slash', 1);
if ($redirectCode) {
$response = $this->handleRedirectRequest($request, $redirectCode > 300 ? $redirectCode : null);
if ($response) {
$this->stopTimer('_init');
return $response;
}
}
$this->stopTimer('_init');
// Wrap call to next handler so that debugger can profile it.
/** @var Response $response */
$response = $debugger->profile(static function () use ($handler, $request) {
return $handler->handle($request);
});
// Log both request and response and return the response.
return $debugger->logRequest($request, $response);
}
public function processCli(): void
{
// Load configuration.
$config = $this->initializeConfig();
// Initialize logger.
$this->initializeLogger($config);
// Disable debugger.
$this->container['debugger']->enabled(false);
// Set timezone, locale.
$this->initializeLocale($config);
Arguments
Nyholm\Psr7\ServerRequest {#63}
/home/grav/www/html/system/src/Grav/Common/Debugger.php
}
$this->addMeasures();
$this->addDeprecations();
$this->timers = [];
return $this->debugbar->getData();
}
/**
* Hierarchical Profiler support.
*
* @param callable $callable
* @param string|null $message
* @return mixed
*/
public function profile(callable $callable, string $message = null)
{
$this->startProfiling();
$response = $callable();
$this->stopProfiling($message);
return $response;
}
public function addTwigProfiler(Environment $twig): void
{
$clockwork = $this->getClockwork();
if ($clockwork) {
$source = new TwigClockworkDataSource($twig);
$source->listenToEvents();
$clockwork->addDataSource($source);
}
}
/**
* Start profiling code.
*
* @return void
*/
/home/grav/www/html/system/src/Grav/Common/Processors/InitializeProcessor.php
$this->initializeUri($config);
// Grav may return redirect response right away.
$redirectCode = (int)$config->get('system.pages.redirect_trailing_slash', 1);
if ($redirectCode) {
$response = $this->handleRedirectRequest($request, $redirectCode > 300 ? $redirectCode : null);
if ($response) {
$this->stopTimer('_init');
return $response;
}
}
$this->stopTimer('_init');
// Wrap call to next handler so that debugger can profile it.
/** @var Response $response */
$response = $debugger->profile(static function () use ($handler, $request) {
return $handler->handle($request);
});
// Log both request and response and return the response.
return $debugger->logRequest($request, $response);
}
public function processCli(): void
{
// Load configuration.
$config = $this->initializeConfig();
// Initialize logger.
$this->initializeLogger($config);
// Disable debugger.
$this->container['debugger']->enabled(false);
// Set timezone, locale.
$this->initializeLocale($config);
// Load plugins.
Arguments
/home/grav/www/html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
protected $handler;
/** @var ContainerInterface|null */
protected $container;
/**
* {@inheritdoc}
* @throws InvalidArgumentException
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$middleware = array_shift($this->middleware);
// Use default callable if there is no middleware.
if ($middleware === null) {
return call_user_func($this->handler, $request);
}
if ($middleware instanceof MiddlewareInterface) {
return $middleware->process($request, clone $this);
}
if (null === $this->container || !$this->container->has($middleware)) {
throw new InvalidArgumentException(
sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class),
$middleware
);
}
array_unshift($this->middleware, $this->container->get($middleware));
return $this->handle($request);
}
}
Arguments
Nyholm\Psr7\ServerRequest {#63}
Grav\Framework\RequestHandler\RequestHandler {#89}
/home/grav/www/html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
// Use default callable if there is no middleware.
if ($middleware === null) {
return call_user_func($this->handler, $request);
}
if ($middleware instanceof MiddlewareInterface) {
return $middleware->process($request, clone $this);
}
if (null === $this->container || !$this->container->has($middleware)) {
throw new InvalidArgumentException(
sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class),
$middleware
);
}
array_unshift($this->middleware, $this->container->get($middleware));
return $this->handle($request);
}
}
Arguments
Nyholm\Psr7\ServerRequest {#63}
/home/grav/www/html/system/src/Grav/Framework/RequestHandler/Middlewares/MultipartRequestSupport.php
use function in_array;
use function is_array;
use function strlen;
/**
* Multipart request support for PUT and PATCH.
*/
class MultipartRequestSupport implements MiddlewareInterface
{
/**
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$contentType = $request->getHeaderLine('content-type');
$method = $request->getMethod();
if (!str_starts_with($contentType, 'multipart/form-data') || !in_array($method, ['PUT', 'PATH'], true)) {
return $handler->handle($request);
}
$boundary = explode('; boundary=', $contentType, 2)[1] ?? '';
$parts = explode("--{$boundary}", $request->getBody()->getContents());
$parts = array_slice($parts, 1, count($parts) - 2);
$params = [];
$files = [];
foreach ($parts as $part) {
$this->processPart($params, $files, $part);
}
return $handler->handle($request->withParsedBody($params)->withUploadedFiles($files));
}
/**
* @param array $params
* @param array $files
* @param string $part
* @return void
Arguments
Nyholm\Psr7\ServerRequest {#63}
/home/grav/www/html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
protected $handler;
/** @var ContainerInterface|null */
protected $container;
/**
* {@inheritdoc}
* @throws InvalidArgumentException
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$middleware = array_shift($this->middleware);
// Use default callable if there is no middleware.
if ($middleware === null) {
return call_user_func($this->handler, $request);
}
if ($middleware instanceof MiddlewareInterface) {
return $middleware->process($request, clone $this);
}
if (null === $this->container || !$this->container->has($middleware)) {
throw new InvalidArgumentException(
sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class),
$middleware
);
}
array_unshift($this->middleware, $this->container->get($middleware));
return $this->handle($request);
}
}
Arguments
Nyholm\Psr7\ServerRequest {#63}
Grav\Framework\RequestHandler\RequestHandler {#87}
/home/grav/www/html/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php
// Use default callable if there is no middleware.
if ($middleware === null) {
return call_user_func($this->handler, $request);
}
if ($middleware instanceof MiddlewareInterface) {
return $middleware->process($request, clone $this);
}
if (null === $this->container || !$this->container->has($middleware)) {
throw new InvalidArgumentException(
sprintf('The middleware is not a valid %s and is not passed in the Container', MiddlewareInterface::class),
$middleware
);
}
array_unshift($this->middleware, $this->container->get($middleware));
return $this->handle($request);
}
}
Arguments
Nyholm\Psr7\ServerRequest {#63}
/home/grav/www/html/system/src/Grav/Common/Grav.php
},
'pagesProcessor' => function () {
return new PagesProcessor($this);
},
'debuggerAssetsProcessor' => function () {
return new DebuggerAssetsProcessor($this);
},
'renderProcessor' => function () {
return new RenderProcessor($this);
},
]
);
$default = static function () {
return new Response(404, ['Expires' => 0, 'Cache-Control' => 'no-store, max-age=0'], 'Not Found');
};
$collection = new RequestHandler($this->middleware, $default, $container);
$response = $collection->handle($this['request']);
$body = $response->getBody();
/** @var Messages $messages */
$messages = $this['messages'];
// Prevent caching if session messages were displayed in the page.
$noCache = $messages->isCleared();
if ($noCache) {
$response = $response->withHeader('Cache-Control', 'no-store, max-age=0');
}
// Handle ETag and If-None-Match headers.
if ($response->getHeaderLine('ETag') === '1') {
$etag = md5($body);
$response = $response->withHeader('ETag', '"' . $etag . '"');
$search = trim($this['request']->getHeaderLine('If-None-Match'), '"');
if ($noCache === false && $search === $etag) {
$response = $response->withStatus(304);
$body = '';
Arguments
Nyholm\Psr7\ServerRequest {#63}
/home/grav/www/html/index.php
// Register the auto-loader.
$loader = require $autoload;
// Set timezone to default, falls back to system if php.ini not set
date_default_timezone_set(@date_default_timezone_get());
// Set internal encoding.
@ini_set('default_charset', 'UTF-8');
mb_internal_encoding('UTF-8');
use Grav\Common\Grav;
use RocketTheme\Toolbox\Event\Event;
// Get the Grav instance
$grav = Grav::instance(array('loader' => $loader));
// Process the page
try {
$grav->process();
} catch (\Error|\Exception $e) {
$grav->fireEvent('onFatalException', new Event(array('exception' => $e)));
throw $e;
}