Server IP : 172.67.158.161 / Your IP : 3.139.238.186 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Automation/Engine/Endpoints/Automations/ |
Upload File : |
<?php declare(strict_types = 1); namespace MailPoet\Automation\Engine\Endpoints\Automations; if (!defined('ABSPATH')) exit; use MailPoet\API\REST\Request; use MailPoet\API\REST\Response; use MailPoet\Automation\Engine\API\Endpoint; use MailPoet\Automation\Engine\Data\AutomationTemplate; use MailPoet\Automation\Engine\Registry; use MailPoet\Validator\Builder; class AutomationTemplatesGetEndpoint extends Endpoint { /** @var Registry */ private $registry; public function __construct( Registry $registry ) { $this->registry = $registry; } public function handle(Request $request): Response { $category = $request->getParam('category'); $templates = array_values($this->registry->getTemplates($category ? strval($category) : null)); return new Response(array_map(function (AutomationTemplate $automation) { return $automation->toArray(); }, $templates)); } public static function getRequestSchema(): array { return [ 'category' => Builder::string(), ]; } }