<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/* -------------------------------------------------------------------------
 * Plugin identity
 * ---------------------------------------------------------------------- */

if ( ! defined( 'MISTICEASE_VER' ) ) {
	define( 'MISTICEASE_VER', defined( 'MISTICEASE_VERSION' ) ? MISTICEASE_VERSION : '1.3.0' );
}

function misticease_basefile(): string {
	return defined( 'MISTICEASE_MAIN_FILE' ) ? MISTICEASE_MAIN_FILE : dirname( __DIR__ ) . '/misticease.php';
}

function misticease_asset( string $rel ): array {
	$file = plugin_dir_path( misticease_basefile() ) . ltrim( $rel, '/' );
	$url  = plugins_url( $rel, misticease_basefile() );
	$ver  = is_readable( $file ) ? (string) filemtime( $file ) : MISTICEASE_VER;
	return [ $url, $ver ];
}

/* -------------------------------------------------------------------------
 * Module loader
 * ---------------------------------------------------------------------- */

require_once __DIR__ . '/setup/misticease_setup.php';
require_once __DIR__ . '/app/misticease-options.php';
require_once __DIR__ . '/app/misticease-cache.php';
require_once __DIR__ . '/app/misticease-thumbnails.php';
require_once __DIR__ . '/app/misticease-render.php';
require_once __DIR__ . '/app/misticease-frontend.php';
require_once __DIR__ . '/app/misticease-admin.php';
require_once __DIR__ . '/app/misticease-network.php';
