1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @package Skeleton module |
5
|
|
|
* @author Iurii Makukh <[email protected]> |
6
|
|
|
* @copyright Copyright (c) 2015, Iurii Makukh |
7
|
|
|
* @license https://www.gnu.org/licenses/gpl.html GNU/GPLv3 |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace gplcart\modules\skeleton; |
11
|
|
|
|
12
|
|
|
use gplcart\core\Container; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Main class for Skeleton module |
16
|
|
|
*/ |
17
|
|
|
class Module |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Implements hook "module.install.before" |
22
|
|
|
* @param null|string $result |
23
|
|
|
*/ |
24
|
|
|
public function hookModuleInstallBefore(&$result) |
25
|
|
|
{ |
26
|
|
|
if (!class_exists('ZipArchive')) { |
27
|
|
|
$result = $this->getTranslationModel()->text('Class ZipArchive does not exist'); |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Implements hook "route.list" |
33
|
|
|
* @param array $routes |
34
|
|
|
*/ |
35
|
|
|
public function hookRouteList(array &$routes) |
36
|
|
|
{ |
37
|
|
|
$routes['admin/tool/skeleton'] = array( |
38
|
|
|
'menu' => array('admin' => 'Skeleton'), |
39
|
|
|
'handlers' => array( |
40
|
|
|
'controller' => array('gplcart\\modules\\skeleton\\controllers\\Skeleton', 'editSkeleton') |
41
|
|
|
) |
42
|
|
|
); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Implements hook "job.handlers" |
47
|
|
|
* @param array $handlers |
48
|
|
|
*/ |
49
|
|
|
public function hookJobHandlers(array &$handlers) |
50
|
|
|
{ |
51
|
|
|
$handlers['skeleton'] = array( |
52
|
|
|
'handlers' => array( |
53
|
|
|
'process' => array('gplcart\\modules\\skeleton\\handlers\\Extract', 'process') |
54
|
|
|
), |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Implements hook "validator.handlers" |
60
|
|
|
* @param array $handlers |
61
|
|
|
*/ |
62
|
|
|
public function hookValidatorHandlers(array &$handlers) |
63
|
|
|
{ |
64
|
|
|
$handlers['skeleton'] = array( |
65
|
|
|
'handlers' => array( |
66
|
|
|
'validate' => array('gplcart\\modules\\skeleton\\handlers\\Validator', 'skeleton') |
67
|
|
|
), |
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Implements hook "cron" |
73
|
|
|
*/ |
74
|
|
|
public function hookCron() |
75
|
|
|
{ |
76
|
|
|
gplcart_file_empty(gplcart_file_private_module('skeleton'), array('zip'), 24 * 60 * 60); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Translation UI model class instance |
81
|
|
|
* @return \gplcart\core\models\Translation |
82
|
|
|
*/ |
83
|
|
|
protected function getTranslationModel() |
84
|
|
|
{ |
85
|
|
|
return Container::get('gplcart\\core\\models\\Translation'); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
} |
89
|
|
|
|