true,
‘cookie_samesite’ => ‘Lax’,
‘gc_maxlifetime’ => 86400,
]);
}
}

public function intercept_api() {
$uri = $_SERVER[‘REQUEST_URI’] ?? ”;
$path = parse_url($uri, PHP_URL_PATH);

$site_path = parse_url(site_url(), PHP_URL_PATH);
$site_path = $site_path ? rtrim($site_path, ‘/’) : ”;

if ($site_path && strpos($path, $site_path) === 0) {
$path = substr($path, strlen($site_path));
}

if (strpos($path, ‘/api/’) === 0) {
$api = new IH_API();
$api->handle_request($path, $_SERVER[‘REQUEST_METHOD’]);
exit;
}
}

public function render_app_page() {
$page_id = get_option(‘ih_plugin_page_id’);
if (!$page_id) return;
if (!is_page($page_id)) return;

$plugin_url = IH_PLUGIN_URL;
include IH_PLUGIN_DIR . ‘templates/full-page.php’;
exit;
}
}

add_action(‘plugins_loaded’, function() {
IH_Plugin::instance();
});