<?php /* * MetaPlayer 1.0 * * Licensed under the GPL terms * To use it on other terms please contact us * * Copyright(c) 2010-2011 Val Dubrava [ valery.dubrava@gmail.com ] * */ try { $config = (require_once '../src/bootstrap.php'); \Ding\Mvc\Http\HttpFrontController::handle($config); } catch (Exception $ex) { $logger = \Logger::getLogger("MetaPlayer.index"); $logger->error($ex->getMessage() . "\n" . $ex->getTraceAsString(), $ex); }
<?php require_once __DIR__ . '/bootstrap.php'; \Ding\Mvc\Http\HttpFrontController::handle($properties, '/');
return $modelAndView; } public function forwardAction() { $arguments['Forwarded-From'] = 'forwardAction'; return new ForwardModelAndView('/MyController/some', func_get_args()); } public function someAction() { $session = HttpSession::getSession(); $session->setAttribute('aSessionVariable', array('user' => 'aUser')); $modelAndView = new ModelAndView('some'); $modelAndView->add(array('somestring' => 'Hello World', 'arguments' => func_get_args())); $modelAndView->add(array('headers' => array('Cache-Control: no-cache', 'Pragma: no-cache'))); return $modelAndView; } public function someExceptionAction() { throw new AnException('Woooooow!'); } } class MyErrorHandler { public function onDingError($error) { echo "This is your custom error handler: " . print_r($error, true); } } $properties = array('ding' => array('log4php.properties' => realpath('/tmp/log4php.properties'), 'factory' => array('properties' => array('smarty.compile_dir' => '/tmp/Ding/smartycompile/', 'smarty.config_dir' => '/tmp/Ding/', 'smarty.cache_dir' => '/tmp/Ding/smartycache/', 'smarty.debugging' => false), 'bdef' => array('xml' => array('filename' => 'beans.xml', 'directories' => array(__DIR__)), 'annotation' => array('scanDir' => array(realpath(__DIR__))))), 'cache' => array('proxy' => array('impl' => 'dummy', 'directory' => '/tmp/Ding/proxy'), 'bdef' => array('impl' => 'dummy', 'directory' => '/tmp/Ding/bdef'), 'beans' => array('impl' => 'dummy', 'directory' => '/tmp/Ding/beans')))); HttpFrontController::handle($properties, '/Some/Mapped/Path'); ////////////////////////////////////////////////////////////////////////////////
/** * @test */ public function can_handle_uncatched_exceptions_with_no_exception_mapper() { $properties = array('ding' => array('log4php.properties' => RESOURCES_DIR . DIRECTORY_SEPARATOR . 'log4php.properties', 'factory' => array('properties' => array('prefix' => RESOURCES_DIR), 'bdef' => array('xml' => array('filename' => 'frontcontroller2.xml', 'directories' => array(RESOURCES_DIR)))))); global $_SERVER; $_SERVER['REQUEST_URI'] = '/MyController/somethingWithException'; $_SERVER['REQUEST_METHOD'] = 'GET'; HttpFrontController::handle($properties, '/'); }