Files
piratepoet/mailpoet/lib/AdminPages/Pages/Automation.php
Jan Jakes da2621230d Move automation engine code under "Engine" namespace
This is to separate the engine itself from "integrations" that will be
built on top of the engine.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00

41 lines
918 B
PHP

<?php declare(strict_types=1);
namespace MailPoet\AdminPages\Pages;
use MailPoet\AdminPages\PageRenderer;
use MailPoet\Automation\Engine\Migrations\Migrator;
use MailPoet\WP\Functions as WPFunctions;
class Automation {
/** @var Migrator */
private $migrator;
/** @var PageRenderer */
private $pageRenderer;
/** @var WPFunctions */
private $wp;
public function __construct(
Migrator $migrator,
PageRenderer $pageRenderer,
WPFunctions $wp
) {
$this->migrator = $migrator;
$this->pageRenderer = $pageRenderer;
$this->wp = $wp;
}
public function render() {
if (!$this->migrator->hasSchema()) {
$this->migrator->createSchema();
}
$this->pageRenderer->displayPage('automation.html', [
'api' => [
'root' => rtrim($this->wp->escUrlRaw($this->wp->restUrl()), '/'),
'nonce' => $this->wp->wpCreateNonce('wp_rest'),
],
]);
}
}