public static function unauthorised($message = null) { if ($message) { (new Log(SECURITY_LOG))->setFatal(true)->logMessage($message); } // Show a Friendly Error Page $view = new HTMLView(true); $view->includeTemplate('error.unauthorised', ['app_name' => AppConfig::getValue('app_name')]); $view->render(true); exit; // terminate script (regardless of location) }
private function logStripeException($exception, $identifier) { $response = $exception->getJsonBody(); // Log the Error $log = new Log(STRIPE_LOG); $log->setFatal(true); $log->logMessage(sprintf("Stripe Exception (%s) [%s]: %s (identifier: %s), HTTP Status: %d", get_class($exception), $response['error']['type'], $response['error']['message'], $identifier, $exception->getHttpStatus())); // Show a Friendly Error Page $view = new HTMLView(); $view->includeTemplate('error.fatal', ['app_name' => AppConfig::getValue('app_name')]); $view->render(true); exit; // die now! }
<?php //start session session_start(); ob_start(); //INCLUDE THE FILES NEEDED... require_once 'view/HTMLView.php'; require_once "controller/MasterController.php"; //MAKE SURE ERRORS ARE SHOWN... MIGHT WANT TO TURN THIS OFF ON A PUBLIC SERVER error_reporting(E_ALL); ini_set('display_errors', 'On'); $HTMLView = new HTMLView(); //Create new master, which handles input & acquires view. $master = new MasterController(); $master->handleInput(); $view = $master->generateOutPut(); $HTMLView->render($view, "utf-8");
<?php require_once 'HTMLView.php'; require_once 'Controller.php'; $controller = new Controller(); $stuff = $controller->doMashUp(); $view = new HTMLView(); $view->render($stuff);
<?php require_once "WebServices/SwedishRadioWebService.php"; require_once "Views/HTMLView.php"; $srws = new SwedishRadioWebService(); $srws->getTrafficData(); $v = new HTMLView(); $v->render();