-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.php
More file actions
56 lines (47 loc) · 1.77 KB
/
Module.php
File metadata and controls
56 lines (47 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace Site;
use Zend\Mvc\MvcEvent;
use Zend\Mvc\Application;
class Module
{
public function onBootstrap(MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR,
array($this,
'handleControllerNotFoundAndControllerInvalidAndRouteNotFound'), 100);
}
public function handleControllerNotFoundAndControllerInvalidAndRouteNotFound(MvcEvent $e)
{
$error = $e->getError();
if ($error == Application::ERROR_CONTROLLER_NOT_FOUND) {
//there is no controller named $e->getRouteMatch()->getParam('controller')
$logText = 'The requested controller '
.$e->getRouteMatch()->getParam('controller'). ' could not be mapped to an existing controller class.';
$sm = $e->getApplication()->getServiceManager();
$pagesContent = new \Front\Pages\ControlContent($sm, $e->getRequest()->getRequestUri(), __NAMESPACE__);
if($pagesContent->checkPageFileSystem()) {
echo $pagesContent->getContent();
exit();
}
}
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
public function getServiceConfig()
{
return include __DIR__ . '/config/services.config.php';
}
}