/
Module.php
61 lines (53 loc) · 1.79 KB
/
Module.php
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
57
58
59
60
61
<?php
namespace PhlyBlog;
use Traversable;
use Zend\Console\Adapter\AdapterInterface as Console;
use Zend\ModuleManager\Feature\ConsoleUsageProviderInterface;
use Zend\Stdlib\ArrayUtils;
class Module implements ConsoleUsageProviderInterface
{
public static $config;
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php'
),
);
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
public function getConsoleUsage(Console $console)
{
return array(
'blog compile [--all|-a] [--entries|-e] [--archive|-c] [--year|-y] [--month|-m] [--day|-d] [--tag|-t] [--author|-r]' => 'Compile blog:
--all|-a: Execute all actions (default)
--entries|-e: Compile entries
--archive|-c: Compile paginated archive (and feed)
--year|-y: Compile paginated entries by year
--month|-m: Compile paginated entries by month
--day|-d: Compile paginated entries by day
--tag|-t: Compile paginated entries by tag (and feeds)
--author|-r: Compile paginated entries by author (and feeds)
',
);
}
public function onBootstrap($e)
{
$app = $e->getApplication();
$services = $app->getServiceManager();
self::$config = $services->get('config');
if (self::$config instanceof Traversable) {
self::$config = ArrayUtils::iteratorToArray(self::$config);
}
}
public static function prepareCompilerView($view, $config, $services)
{
$renderer = $services->get('ViewRenderer');
$view->addRenderingStrategy(function($e) use ($renderer) {
return $renderer;
}, 100);
}
}