<?php

use Mtc\Plugins\NewsletterSignup\Classes\NewsletterSignUp;

$path = "../../";
require_once $path . "core/includes/header.inc.php";

$page_meta['title'] = config('app.name') . ' Newsletter signup';

if (!empty($_REQUEST['newsletter_action'])) {
    if ($_REQUEST['newsletter_action'] === 'activate') {
        $twig->addGlobal(
            'activation_status',
            NewsletterSignUp::activateAndGetPrettyStatus(filter_input(INPUT_GET, 'hash'))
        );
    } else {
        require_once __DIR__ . '/includes/subscribe.php';
    }

}

$twig->display('pages/newsletter.twig',[
    'page_meta' => $page_meta,
]);