Ejemplo n.º 1
0
    $Reflect = (new ReflectionClass('Phpfox_Locale'))->newInstanceWithoutConstructor();
    return call_user_func_array([$Reflect, 'phrase'], func_get_args());
}
function _p()
{
    return call_user_func_array(['Core\\Phrase', 'get'], func_get_args());
}
function error()
{
    $Reflect = (new ReflectionClass('Core\\Exception'))->newInstanceWithoutConstructor();
    return call_user_func_array([$Reflect, 'toss'], func_get_args());
}
if (!defined('PHPFOX_NO_RUN')) {
    try {
        new Core\App();
        Phpfox::run();
    } catch (\Exception $e) {
        if (\Core\Route\Controller::$isApi) {
            http_response_code(400);
            $content = ['error' => ['message' => $e->getMessage()]];
            header('Content-type: application/json');
            echo json_encode($content, JSON_PRETTY_PRINT);
            exit;
        }
        if (PHPFOX_IS_AJAX_PAGE || Phpfox_Request::instance()->get('is_ajax_post')) {
            header('Content-type: application/json');
            $msg = $e->getMessage();
            if (Phpfox_Request::instance()->get('is_ajax_post')) {
                $msg = '<div class="error_message">' . $msg . '</div>';
            }
            echo json_encode(['error' => $msg]);