HEX
Server: Apache/2
System: Linux server1c 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64
User: jandjware (1008)
PHP: 8.2.23
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/jandjware/public_html/wp-content/plugins/hostinger/includes/Mcp/EventHandlerFactory.php
<?php

namespace Hostinger\Mcp;

use Hostinger\Admin\Proxy;
use Hostinger\Mcp\Handlers\WebsiteMcpOptInToggled;
use Hostinger\Mcp\Handlers\WebsitePageUpdated;
use Hostinger\Mcp\Handlers\WebsiteUpdated;

defined( 'ABSPATH' ) || exit;

class EventHandlerFactory {

    public const MCP_EVENT_UPDATED       = 'wordpress.website.updated';
    public const MCP_EVENT_PAGE_UPDATED  = 'wordpress.website.page_updated';
    public const MCP_EVENT_OPTIN_TOGGLED = 'wordpress.website.mcp.opt_in_toggled';

    private array $handlers;
    private Proxy $proxy;

    public function __construct( Proxy $proxy ) {
        $this->proxy    = $proxy;
        $this->handlers = array(
            self::MCP_EVENT_UPDATED       => WebsiteUpdated::class,
            self::MCP_EVENT_PAGE_UPDATED  => WebsitePageUpdated::class,
            self::MCP_EVENT_OPTIN_TOGGLED => WebsiteMcpOptInToggled::class,
        );
    }

    public function get_handler( string $event ) {
        $handler = $this->handlers[ $event ] ?? false;
        if ( ! $handler ) {
            throw new \WP_Exception( 'Invalid event' );
        }

        return new $handler( $this->proxy );
    }
}