<?php

/**
 * Static Block Ajax script
 *
 * @category Plugins
 * @package  Mtc_Static_Blocks
 * @author   mtc. Martins Fridenbergs <martins.fridenbergs@mtcmedia.co.uk>
 */
namespace Mtc\Plugins\StaticBlocks\Classes;

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

if (! empty($_POST['ajax']) && ! empty($_POST['action']) && $_POST['action'] == 'add_instance') {
    ob_start();
    $block_sizes = StaticBlockSizes::all();
    $unique = microtime(true);
    require 'templates/content.php';
    $html = ob_get_clean();
    echo
        json_encode([
            'status' => 'ok',
            'html' => $html,
        ])
    ;
    exit();
}

http_response_code(404);
