-[submodule "library/ZendFramework"]
- path = library/ZendFramework
+[submodule "vendor/ZendFramework"]
+ path = vendor/ZendFramework
url = git://github.com/zendframework/zf2.git
--- /dev/null
+<?php
+return array(
+ 'module_paths' => array(
+ realpath(dirname(__DIR__) . '/module'),
+ realpath(dirname(__DIR__) . '/vendor'),
+ ),
+ 'modules' => array(
+ 'Application',
+ ),
+ 'module_listener_options' => array(
+ 'config_cache_enabled' => false,
+ 'cache_dir' => realpath(dirname(__DIR__) . '/data/cache'),
+ 'application_environment' => getenv('APPLICATION_ENV'),
+ ),
+);
--- /dev/null
+About this directory:
+=====================
+
+By default, this application is configured to load all configs in
+`./config/autoload/*.config.php`. Doing this provides a location for a
+developer to drop in configuration override files provided by modules, as well
+as cleanly provide individual, application-wide config files for things like
+database connections, etc.
+++ /dev/null
-<?php
-return array(
- 'module_paths' => array(
- realpath(__DIR__ . '/../modules'),
- realpath(__DIR__ . '/../vendors'),
- ),
- 'modules' => array(
- 'Application',
- ),
- 'module_listener_options' => array(
- 'config_cache_enabled' => false,
- 'cache_dir' => realpath(__DIR__ . '/../data/cache'),
- ),
-);
+++ /dev/null
-Subproject commit 9fdf610f5e8bc3f6426753cee9a81efe5d0b5e53
--- /dev/null
+/*
+!Application/
+!.gitignore
--- /dev/null
+<?php
+
+namespace Application;
+
+use Zend\Module\Manager,
+ Zend\EventManager\StaticEventManager,
+ Zend\Module\Consumer\AutoloaderProvider;
+
+class Module implements AutoloaderProvider
+{
+ protected $view;
+ protected $viewListener;
+
+ public function init(Manager $moduleManager)
+ {
+ $events = StaticEventManager::getInstance();
+ $events->attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 100);
+ }
+
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\ClassMapAutoloader' => array(
+ __DIR__ . '/autoload_classmap.php',
+ ),
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
+
+ public function getConfig($env = null)
+ {
+ return include __DIR__ . '/configs/module.config.php';
+ }
+
+ public function initializeView($e)
+ {
+ $app = $e->getParam('application');
+ $locator = $app->getLocator();
+ $config = $e->getParam('config');
+ $view = $this->getView($app);
+ $viewListener = $this->getViewListener($view, $config);
+ $app->events()->attachAggregate($viewListener);
+ $events = StaticEventManager::getInstance();
+ $viewListener->registerStaticListeners($events, $locator);
+ }
+
+ protected function getViewListener($view, $config)
+ {
+ if ($this->viewListener instanceof View\Listener) {
+ return $this->viewListener;
+ }
+
+ $viewListener = new View\Listener($view, $config->layout);
+ $viewListener->setDisplayExceptionsFlag($config->display_exceptions);
+
+ $this->viewListener = $viewListener;
+ return $viewListener;
+ }
+
+ protected function getView($app)
+ {
+ if ($this->view) {
+ return $this->view;
+ }
+
+ $di = $app->getLocator();
+ $view = $di->get('view');
+ $url = $view->plugin('url');
+ $url->setRouter($app->getRouter());
+
+ $view->plugin('headTitle')->setSeparator(' - ')
+ ->setAutoEscape(false)
+ ->append('Application');
+ $this->view = $view;
+ return $view;
+ }
+}
--- /dev/null
+<?php
+return array(
+ 'Application\View\Listener' => __DIR__ . '/src/Application/View/Listener.php',
+ 'Application\Controller\IndexController' => __DIR__ . '/src/Application/Controller/IndexController.php',
+ 'Application\Controller\ErrorController' => __DIR__ . '/src/Application/Controller/ErrorController.php',
+ 'Application\Module' => __DIR__ . '/Module.php',
+);
\ No newline at end of file
--- /dev/null
+<?php
+return function ($class) {
+ static $map;
+ if (!$map) {
+ $map = include __DIR__ . '/autoload_classmap.php';
+ }
+
+ if (!isset($map[$class])) {
+ return false;
+ }
+ return include $map[$class];
+};
--- /dev/null
+<?php
+spl_autoload_register(include __DIR__ . '/autoload_function.php');
--- /dev/null
+<?php
+return array(
+ 'layout' => 'layouts/layout.phtml',
+ 'di' => array(
+ 'instance' => array(
+ 'alias' => array(
+ 'index' => 'Application\Controller\IndexController',
+ 'error' => 'Application\Controller\ErrorController',
+ 'view' => 'Zend\View\PhpRenderer',
+ ),
+ 'Zend\View\PhpRenderer' => array(
+ 'parameters' => array(
+ 'resolver' => 'Zend\View\TemplatePathStack',
+ 'options' => array(
+ 'script_paths' => array(
+ 'application' => __DIR__ . '/../views',
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ 'routes' => array(
+ 'default' => array(
+ 'type' => 'Zend\Mvc\Router\Http\Segment',
+ 'options' => array(
+ 'route' => '/[:controller[/:action]]',
+ 'constraints' => array(
+ 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
+ ),
+ 'defaults' => array(
+ 'controller' => 'index',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ 'home' => array(
+ 'type' => 'Zend\Mvc\Router\Http\Literal',
+ 'options' => array(
+ 'route' => '/',
+ 'defaults' => array(
+ 'controller' => 'index',
+ 'action' => 'index',
+ ),
+ ),
+ ),
+ ),
+);
--- /dev/null
+<?php
+
+namespace Application\Controller;
+
+use Zend\Mvc\Controller\ActionController;
+
+class ErrorController extends ActionController
+{
+ const ERROR_NO_ROUTE = 404;
+ const ERROR_NO_CONTROLLER = 404;
+
+ public function indexAction()
+ {
+ $error = $this->request->getMetadata('error', false);
+ if (!$error) {
+ $error = array(
+ 'type' => 404,
+ 'message' => 'Page not found',
+ );
+ }
+
+ switch ($error['type']) {
+ case self::ERROR_NO_ROUTE:
+ case self::ERROR_NO_CONTROLLER:
+ default:
+ // 404 error -- controller or action not found
+ $this->response->setStatusCode(404);
+ break;
+ }
+
+ return array('message' => $error['message']);
+ }
+}
--- /dev/null
+<?php
+
+namespace Application\Controller;
+
+use Zend\Mvc\Controller\ActionController;
+
+class IndexController extends ActionController
+{
+ public function indexAction()
+ {
+ return array();
+ }
+}
--- /dev/null
+<?php
+
+namespace Application\View;
+
+use ArrayAccess,
+ Zend\Di\Locator,
+ Zend\EventManager\EventCollection,
+ Zend\EventManager\ListenerAggregate,
+ Zend\EventManager\StaticEventCollection,
+ Zend\Http\PhpEnvironment\Response,
+ Zend\Mvc\Application,
+ Zend\Mvc\MvcEvent,
+ Zend\View\Renderer;
+
+class Listener implements ListenerAggregate
+{
+ protected $layout;
+ protected $listeners = array();
+ protected $staticListeners = array();
+ protected $view;
+ protected $displayExceptions = false;
+
+ public function __construct(Renderer $renderer, $layout = 'layout.phtml')
+ {
+ $this->view = $renderer;
+ $this->layout = $layout;
+ }
+
+ public function setDisplayExceptionsFlag($flag)
+ {
+ $this->displayExceptions = (bool) $flag;
+ return $this;
+ }
+
+ public function displayExceptions()
+ {
+ return $this->displayExceptions;
+ }
+
+ public function attach(EventCollection $events)
+ {
+ $this->listeners[] = $events->attach('dispatch.error', array($this, 'renderError'));
+ $this->listeners[] = $events->attach('dispatch', array($this, 'render404'), -80);
+ $this->listeners[] = $events->attach('dispatch', array($this, 'renderLayout'), -1000);
+ }
+
+ public function detach(EventCollection $events)
+ {
+ foreach ($this->listeners as $key => $listener) {
+ $events->detach($listener);
+ unset($this->listeners[$key]);
+ unset($listener);
+ }
+ }
+
+ public function registerStaticListeners(StaticEventCollection $events, $locator)
+ {
+ $ident = 'Application\Controller\PageController';
+ $handler = $events->attach($ident, 'dispatch', array($this, 'renderPageController'), -50);
+ $this->staticListeners[] = array($ident, $handler);
+
+ $ident = 'Zend\Mvc\Controller\ActionController';
+ $handler = $events->attach($ident, 'dispatch', array($this, 'renderView'), -50);
+ $this->staticListeners[] = array($ident, $handler);
+ }
+
+ public function detachStaticListeners(StaticEventCollection $events)
+ {
+ foreach ($this->staticListeners as $i => $info) {
+ list($id, $handler) = $info;
+ $events->detach($id, $handler);
+ unset($this->staticListeners[$i]);
+ }
+ }
+
+ public function renderPageController(MvcEvent $e)
+ {
+ $page = $e->getResult();
+ if ($page instanceof Response) {
+ return;
+ }
+
+ $response = $e->getResponse();
+ if ($response->isNotFound()) {
+ return;
+ }
+
+ $routeMatch = $e->getRouteMatch();
+
+ if (!$routeMatch) {
+ $page = '404';
+ } else {
+ $page = $routeMatch->getParam('action', '404');
+ }
+
+ if ($page == '404') {
+ $response->setStatusCode(404);
+ }
+
+ $script = 'pages/' . $page . '.phtml';
+
+ // Action content
+ $content = $this->view->render($script);
+ $e->setResult($content);
+
+ return $this->renderLayout($e);
+ }
+
+ public function renderView(MvcEvent $e)
+ {
+ $response = $e->getResponse();
+ if (!$response->isSuccess()) {
+ return;
+ }
+
+ $routeMatch = $e->getRouteMatch();
+ $controller = $routeMatch->getParam('controller', 'index');
+ $action = $routeMatch->getParam('action', 'index');
+ $script = $controller . '/' . $action . '.phtml';
+
+ $vars = $e->getResult();
+ if (is_scalar($vars)) {
+ $vars = array('content' => $vars);
+ } elseif (is_object($vars) && !$vars instanceof ArrayAccess) {
+ $vars = (array) $vars;
+ }
+
+ $content = $this->view->render($script, $vars);
+
+ $e->setResult($content);
+ return $content;
+ }
+
+ public function renderLayout(MvcEvent $e)
+ {
+ $response = $e->getResponse();
+ if (!$response) {
+ $response = new Response();
+ $e->setResponse($response);
+ }
+ if ($response->isRedirect()) {
+ return $response;
+ }
+
+ $footer = $e->getParam('footer', false);
+ $vars = array('footer' => $footer);
+
+ if (false !== ($contentParam = $e->getParam('content', false))) {
+ $vars['content'] = $contentParam;
+ } else {
+ $vars['content'] = $e->getResult();
+ }
+
+ $layout = $this->view->render($this->layout, $vars);
+ $response->setContent($layout);
+ return $response;
+ }
+
+ public function render404(MvcEvent $e)
+ {
+ $vars = $e->getResult();
+ if ($vars instanceof Response) {
+ return;
+ }
+
+ $response = $e->getResponse();
+ if ($response->getStatusCode() != 404) {
+ // Only handle 404's
+ return;
+ }
+
+ $vars = array(
+ 'message' => 'Page not found.',
+ 'exception' => $e->getParam('exception'),
+ 'display_exceptions' => $this->displayExceptions(),
+ );
+
+ $content = $this->view->render('pages/404.phtml', $vars);
+
+ $e->setResult($content);
+
+ return $this->renderLayout($e);
+ }
+
+ public function renderError(MvcEvent $e)
+ {
+ $error = $e->getError();
+ $app = $e->getTarget();
+ $response = $e->getResponse();
+ if (!$response) {
+ $response = new Response();
+ $e->setResponse($response);
+ }
+
+ switch ($error) {
+ case Application::ERROR_CONTROLLER_NOT_FOUND:
+ case Application::ERROR_CONTROLLER_INVALID:
+ $vars = array(
+ 'message' => 'Page not found.',
+ 'exception' => $e->getParam('exception'),
+ 'display_exceptions' => $this->displayExceptions(),
+ );
+ $response->setStatusCode(404);
+ break;
+
+ case Application::ERROR_EXCEPTION:
+ default:
+ $exception = $e->getParam('exception');
+ $vars = array(
+ 'message' => 'An error occurred during execution; please try again later.',
+ 'exception' => $e->getParam('exception'),
+ 'display_exceptions' => $this->displayExceptions(),
+ );
+ $response->setStatusCode(500);
+ break;
+ }
+
+ $content = $this->view->render('error/index.phtml', $vars);
+
+ $e->setResult($content);
+
+ return $this->renderLayout($e);
+ }
+}
--- /dev/null
+<h1>An error occurred</h1>
+<h2><?php echo $this->message ?></h2>
+
+<?php if (isset($this->exception)): ?>
+
+<h3>Exception information:</h3>
+<p>
+ <b>Message:</b> <?php echo $this->exception->getMessage() ?>
+</p>
+
+<h3>Stack trace:</h3>
+<pre><?php echo $this->exception->getTraceAsString() ?></pre>
+
+<?php endif ?>
--- /dev/null
+<strong>Module:</strong> Application »
+<strong>Controller:</strong> Index »
+<strong>Action:</strong> index
--- /dev/null
+<?php echo $this->doctype() ?>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <?php echo $this->headTitle() ?>
+ <?php echo $this->headMeta() ?>
+ <?php echo $this->headLink() ?>
+ <?php echo $this->headScript() ?>
+
+</head>
+<body>
+<?php echo $this->raw('content'); ?>
+</body>
+</html>
+++ /dev/null
-/*
-!Application/
-!.gitignore
+++ /dev/null
-<?php
-
-namespace Application;
-
-use Zend\Module\Manager,
- Zend\EventManager\StaticEventManager,
- Zend\Module\Consumer\AutoloaderProvider;
-
-class Module implements AutoloaderProvider
-{
- protected $view;
- protected $viewListener;
-
- public function init(Manager $moduleManager)
- {
- $events = StaticEventManager::getInstance();
- $events->attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 100);
- }
-
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\ClassMapAutoloader' => array(
- __DIR__ . '/autoload_classmap.php',
- ),
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
- public function getConfig($env = null)
- {
- return include __DIR__ . '/configs/module.config.php';
- }
-
- public function initializeView($e)
- {
- $app = $e->getParam('application');
- $locator = $app->getLocator();
- $config = $e->getParam('config');
- $view = $this->getView($app);
- $viewListener = $this->getViewListener($view, $config);
- $app->events()->attachAggregate($viewListener);
- $events = StaticEventManager::getInstance();
- $viewListener->registerStaticListeners($events, $locator);
- }
-
- protected function getViewListener($view, $config)
- {
- if ($this->viewListener instanceof View\Listener) {
- return $this->viewListener;
- }
-
- $viewListener = new View\Listener($view, $config->layout);
- $viewListener->setDisplayExceptionsFlag($config->display_exceptions);
-
- $this->viewListener = $viewListener;
- return $viewListener;
- }
-
- protected function getView($app)
- {
- if ($this->view) {
- return $this->view;
- }
-
- $di = $app->getLocator();
- $view = $di->get('view');
- $url = $view->plugin('url');
- $url->setRouter($app->getRouter());
-
- $view->plugin('headTitle')->setSeparator(' - ')
- ->setAutoEscape(false)
- ->append('Application');
- $this->view = $view;
- return $view;
- }
-}
+++ /dev/null
-<?php
-return array(
- 'Application\View\Listener' => __DIR__ . '/src/Application/View/Listener.php',
- 'Application\Controller\IndexController' => __DIR__ . '/src/Application/Controller/IndexController.php',
- 'Application\Controller\ErrorController' => __DIR__ . '/src/Application/Controller/ErrorController.php',
- 'Application\Module' => __DIR__ . '/Module.php',
-);
\ No newline at end of file
+++ /dev/null
-<?php
-return function ($class) {
- static $map;
- if (!$map) {
- $map = include __DIR__ . '/autoload_classmap.php';
- }
-
- if (!isset($map[$class])) {
- return false;
- }
- return include $map[$class];
-};
+++ /dev/null
-<?php
-spl_autoload_register(include __DIR__ . '/autoload_function.php');
+++ /dev/null
-<?php
-return array(
- 'layout' => 'layouts/layout.phtml',
- 'di' => array(
- 'instance' => array(
- 'alias' => array(
- 'index' => 'Application\Controller\IndexController',
- 'error' => 'Application\Controller\ErrorController',
- 'view' => 'Zend\View\PhpRenderer',
- ),
- 'Zend\View\PhpRenderer' => array(
- 'parameters' => array(
- 'resolver' => 'Zend\View\TemplatePathStack',
- 'options' => array(
- 'script_paths' => array(
- 'application' => __DIR__ . '/../views',
- ),
- ),
- ),
- ),
- ),
- ),
- 'routes' => array(
- 'default' => array(
- 'type' => 'Zend\Mvc\Router\Http\Segment',
- 'options' => array(
- 'route' => '/[:controller[/:action]]',
- 'constraints' => array(
- 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- ),
- 'defaults' => array(
- 'controller' => 'index',
- 'action' => 'index',
- ),
- ),
- ),
- 'home' => array(
- 'type' => 'Zend\Mvc\Router\Http\Literal',
- 'options' => array(
- 'route' => '/',
- 'defaults' => array(
- 'controller' => 'index',
- 'action' => 'index',
- ),
- ),
- ),
- ),
-);
+++ /dev/null
-<?php
-
-namespace Application\Controller;
-
-use Zend\Mvc\Controller\ActionController;
-
-class ErrorController extends ActionController
-{
- const ERROR_NO_ROUTE = 404;
- const ERROR_NO_CONTROLLER = 404;
-
- public function indexAction()
- {
- $error = $this->request->getMetadata('error', false);
- if (!$error) {
- $error = array(
- 'type' => 404,
- 'message' => 'Page not found',
- );
- }
-
- switch ($error['type']) {
- case self::ERROR_NO_ROUTE:
- case self::ERROR_NO_CONTROLLER:
- default:
- // 404 error -- controller or action not found
- $this->response->setStatusCode(404);
- break;
- }
-
- return array('message' => $error['message']);
- }
-}
+++ /dev/null
-<?php
-
-namespace Application\Controller;
-
-use Zend\Mvc\Controller\ActionController;
-
-class IndexController extends ActionController
-{
- public function indexAction()
- {
- return array();
- }
-}
+++ /dev/null
-<?php
-
-namespace Application\View;
-
-use ArrayAccess,
- Zend\Di\Locator,
- Zend\EventManager\EventCollection,
- Zend\EventManager\ListenerAggregate,
- Zend\EventManager\StaticEventCollection,
- Zend\Http\PhpEnvironment\Response,
- Zend\Mvc\Application,
- Zend\Mvc\MvcEvent,
- Zend\View\Renderer;
-
-class Listener implements ListenerAggregate
-{
- protected $layout;
- protected $listeners = array();
- protected $staticListeners = array();
- protected $view;
- protected $displayExceptions = false;
-
- public function __construct(Renderer $renderer, $layout = 'layout.phtml')
- {
- $this->view = $renderer;
- $this->layout = $layout;
- }
-
- public function setDisplayExceptionsFlag($flag)
- {
- $this->displayExceptions = (bool) $flag;
- return $this;
- }
-
- public function displayExceptions()
- {
- return $this->displayExceptions;
- }
-
- public function attach(EventCollection $events)
- {
- $this->listeners[] = $events->attach('dispatch.error', array($this, 'renderError'));
- $this->listeners[] = $events->attach('dispatch', array($this, 'render404'), -80);
- $this->listeners[] = $events->attach('dispatch', array($this, 'renderLayout'), -1000);
- }
-
- public function detach(EventCollection $events)
- {
- foreach ($this->listeners as $key => $listener) {
- $events->detach($listener);
- unset($this->listeners[$key]);
- unset($listener);
- }
- }
-
- public function registerStaticListeners(StaticEventCollection $events, $locator)
- {
- $ident = 'Application\Controller\PageController';
- $handler = $events->attach($ident, 'dispatch', array($this, 'renderPageController'), -50);
- $this->staticListeners[] = array($ident, $handler);
-
- $ident = 'Zend\Mvc\Controller\ActionController';
- $handler = $events->attach($ident, 'dispatch', array($this, 'renderView'), -50);
- $this->staticListeners[] = array($ident, $handler);
- }
-
- public function detachStaticListeners(StaticEventCollection $events)
- {
- foreach ($this->staticListeners as $i => $info) {
- list($id, $handler) = $info;
- $events->detach($id, $handler);
- unset($this->staticListeners[$i]);
- }
- }
-
- public function renderPageController(MvcEvent $e)
- {
- $page = $e->getResult();
- if ($page instanceof Response) {
- return;
- }
-
- $response = $e->getResponse();
- if ($response->isNotFound()) {
- return;
- }
-
- $routeMatch = $e->getRouteMatch();
-
- if (!$routeMatch) {
- $page = '404';
- } else {
- $page = $routeMatch->getParam('action', '404');
- }
-
- if ($page == '404') {
- $response->setStatusCode(404);
- }
-
- $script = 'pages/' . $page . '.phtml';
-
- // Action content
- $content = $this->view->render($script);
- $e->setResult($content);
-
- return $this->renderLayout($e);
- }
-
- public function renderView(MvcEvent $e)
- {
- $response = $e->getResponse();
- if (!$response->isSuccess()) {
- return;
- }
-
- $routeMatch = $e->getRouteMatch();
- $controller = $routeMatch->getParam('controller', 'index');
- $action = $routeMatch->getParam('action', 'index');
- $script = $controller . '/' . $action . '.phtml';
-
- $vars = $e->getResult();
- if (is_scalar($vars)) {
- $vars = array('content' => $vars);
- } elseif (is_object($vars) && !$vars instanceof ArrayAccess) {
- $vars = (array) $vars;
- }
-
- $content = $this->view->render($script, $vars);
-
- $e->setResult($content);
- return $content;
- }
-
- public function renderLayout(MvcEvent $e)
- {
- $response = $e->getResponse();
- if (!$response) {
- $response = new Response();
- $e->setResponse($response);
- }
- if ($response->isRedirect()) {
- return $response;
- }
-
- $footer = $e->getParam('footer', false);
- $vars = array('footer' => $footer);
-
- if (false !== ($contentParam = $e->getParam('content', false))) {
- $vars['content'] = $contentParam;
- } else {
- $vars['content'] = $e->getResult();
- }
-
- $layout = $this->view->render($this->layout, $vars);
- $response->setContent($layout);
- return $response;
- }
-
- public function render404(MvcEvent $e)
- {
- $vars = $e->getResult();
- if ($vars instanceof Response) {
- return;
- }
-
- $response = $e->getResponse();
- if ($response->getStatusCode() != 404) {
- // Only handle 404's
- return;
- }
-
- $vars = array(
- 'message' => 'Page not found.',
- 'exception' => $e->getParam('exception'),
- 'display_exceptions' => $this->displayExceptions(),
- );
-
- $content = $this->view->render('pages/404.phtml', $vars);
-
- $e->setResult($content);
-
- return $this->renderLayout($e);
- }
-
- public function renderError(MvcEvent $e)
- {
- $error = $e->getError();
- $app = $e->getTarget();
- $response = $e->getResponse();
- if (!$response) {
- $response = new Response();
- $e->setResponse($response);
- }
-
- switch ($error) {
- case Application::ERROR_CONTROLLER_NOT_FOUND:
- case Application::ERROR_CONTROLLER_INVALID:
- $vars = array(
- 'message' => 'Page not found.',
- 'exception' => $e->getParam('exception'),
- 'display_exceptions' => $this->displayExceptions(),
- );
- $response->setStatusCode(404);
- break;
-
- case Application::ERROR_EXCEPTION:
- default:
- $exception = $e->getParam('exception');
- $vars = array(
- 'message' => 'An error occurred during execution; please try again later.',
- 'exception' => $e->getParam('exception'),
- 'display_exceptions' => $this->displayExceptions(),
- );
- $response->setStatusCode(500);
- break;
- }
-
- $content = $this->view->render('error/index.phtml', $vars);
-
- $e->setResult($content);
-
- return $this->renderLayout($e);
- }
-}
+++ /dev/null
-<h1>An error occurred</h1>
-<h2><?php echo $this->message ?></h2>
-
-<?php if (isset($this->exception)): ?>
-
-<h3>Exception information:</h3>
-<p>
- <b>Message:</b> <?php echo $this->exception->getMessage() ?>
-</p>
-
-<h3>Stack trace:</h3>
-<pre><?php echo $this->exception->getTraceAsString() ?></pre>
-
-<?php endif ?>
+++ /dev/null
-<strong>Module:</strong> Application »
-<strong>Controller:</strong> Index »
-<strong>Action:</strong> index
+++ /dev/null
-<?php echo $this->doctype() ?>
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <?php echo $this->headTitle() ?>
- <?php echo $this->headMeta() ?>
- <?php echo $this->headLink() ?>
- <?php echo $this->headScript() ?>
-
-</head>
-<body>
-<?php echo $this->raw('content'); ?>
-</body>
-</html>
<?php
-// Define application environment
-defined('APPLICATION_ENV')
- || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
-
-// Ensure ZF is on the include path
-set_include_path(implode(PATH_SEPARATOR, array(
- realpath(__DIR__ . '/../library'),
- realpath(__DIR__ . '/../library/ZendFramework/library'),
- get_include_path(),
-)));
-
-require_once 'Zend/Loader/AutoloaderFactory.php';
+require_once dirname(__DIR__) . '/vendor/ZendFramework/library/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
-$appConfig = include __DIR__ . '/../configs/application.config.php';
+$appConfig = include dirname(__DIR__) . '/config/application.config.php';
$moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']);
$moduleLoader->register();
$moduleManager = new Zend\Module\Manager($appConfig['modules']);
$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
$moduleManager->setDefaultListenerOptions($listenerOptions);
+$moduleManager->getConfigListener()->addConfigGlobPath(dirname(__DIR__) . '/config/autoload/*.config.php');
$moduleManager->loadModules();
// Create application, bootstrap, and run
-$bootstrap = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig());
-$application = new Zend\Mvc\Application;
+$bootstrap = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig());
+$application = new Zend\Mvc\Application;
$bootstrap->bootstrap($application);
$application->run()->send();
--- /dev/null
+/*
+!README.md
+!.gitignore
--- /dev/null
+This `vendors/` directory is where third-party modules should be installed.
+++ /dev/null
-/*
-!README.md
-!.gitignore
+++ /dev/null
-This `vendors/` directory is where third-party modules should be installed.