|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package Image |
|
5
|
|
|
* @author Iurii Makukh |
|
6
|
|
|
* @copyright Copyright (c) 2017, Iurii Makukh |
|
7
|
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL-3.0+ |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace gplcart\modules\image; |
|
11
|
|
|
|
|
12
|
|
|
use gplcart\core\Module, |
|
13
|
|
|
gplcart\core\Library; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Main class for Image module |
|
17
|
|
|
*/ |
|
18
|
|
|
class Main |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Module class instance |
|
23
|
|
|
* @var \gplcart\core\Module $module |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $module; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Library class instance |
|
29
|
|
|
* @var \gplcart\core\Library $library |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $library; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param Module $module |
|
35
|
|
|
* @param Library $library |
|
36
|
|
|
*/ |
|
37
|
|
|
public function __construct(Module $module, Library $library) |
|
38
|
|
|
{ |
|
39
|
|
|
$this->module = $module; |
|
40
|
|
|
$this->library = $library; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Implements hook "library.list" |
|
45
|
|
|
* @param array $libraries |
|
46
|
|
|
*/ |
|
47
|
|
|
public function hookLibraryList(array &$libraries) |
|
48
|
|
|
{ |
|
49
|
|
|
$libraries['simpleimage'] = array( |
|
50
|
|
|
'name' => /* @text */'SimpleImage', |
|
51
|
|
|
'description' => /* @text */'A PHP class that simplifies working with images', |
|
52
|
|
|
'type' => 'php', |
|
53
|
|
|
'module' => 'image', |
|
54
|
|
|
'url' => 'https://github.com/claviska/SimpleImage', |
|
55
|
|
|
'download' => 'https://github.com/claviska/SimpleImage/archive/3.3.0.zip', |
|
56
|
|
|
'version' => '3.3.0', |
|
57
|
|
|
'files' => array( |
|
58
|
|
|
'vendor/claviska/simpleimage/src/claviska/SimpleImage.php' |
|
59
|
|
|
) |
|
60
|
|
|
); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Implements hook "image.style.action.handlers" |
|
65
|
|
|
* @param array $handlers |
|
66
|
|
|
*/ |
|
67
|
|
|
public function hookImageStyleActionHandlers(array &$handlers) |
|
68
|
|
|
{ |
|
69
|
|
|
$handlers = array_merge($handlers, $this->getActionHandlers()); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Implements hook "module.enable.after" |
|
74
|
|
|
*/ |
|
75
|
|
|
public function hookModuleEnableAfter() |
|
76
|
|
|
{ |
|
77
|
|
|
$this->library->clearCache(); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Implements hook "module.disable.after" |
|
82
|
|
|
*/ |
|
83
|
|
|
public function hookModuleDisableAfter() |
|
84
|
|
|
{ |
|
85
|
|
|
$this->library->clearCache(); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Implements hook "module.install.after" |
|
90
|
|
|
*/ |
|
91
|
|
|
public function hookModuleInstallAfter() |
|
92
|
|
|
{ |
|
93
|
|
|
$this->library->clearCache(); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Implements hook "module.uninstall.after" |
|
98
|
|
|
*/ |
|
99
|
|
|
public function hookModuleUninstallAfter() |
|
100
|
|
|
{ |
|
101
|
|
|
$this->library->clearCache(); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Returns an array of image style actions |
|
106
|
|
|
* @return array |
|
107
|
|
|
*/ |
|
108
|
|
|
public function getActionHandlers() |
|
109
|
|
|
{ |
|
110
|
|
|
return gplcart_config_get(__DIR__ . '/config/actions.php'); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
} |
|
114
|
|
|
|