<?php
/**
 * Theme MVC trial entry.
 *
 * Keep original URLs and data files. Front controllers call
 * theme_mvc_dispatch(), controllers prepare data, and views render output.
 */
require_once __DIR__ . '/ThemeView.php';
require_once __DIR__ . '/ThemeController.php';
require_once __DIR__ . '/ThemeRouter.php';

function theme_mvc_view_path($theme, $view){
    $theme = preg_replace('/[^a-z0-9\-_]/i', '', $theme);
    $view = preg_replace('/[^a-z0-9\/_\-]/i', '', $view);
    return __DIR__ . '/../themes/' . $theme . '/views/' . $view . '.php';
}

function theme_mvc_dispatch($module, $action = 'index'){
    ThemeRouter::dispatch($module, $action);
}

