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 Image extends Module |
19
|
|
|
{ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Library class instance |
23
|
|
|
* @var \gplcart\core\Library $library |
24
|
|
|
*/ |
25
|
|
|
protected $library; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param Library $library |
29
|
|
|
*/ |
30
|
|
|
public function __construct(Library $library) |
31
|
|
|
{ |
32
|
|
|
parent::__construct(); |
33
|
|
|
|
34
|
|
|
$this->library = $library; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Implements hook "library.list" |
39
|
|
|
* @param array $libraries |
40
|
|
|
*/ |
41
|
|
|
public function hookLibraryList(array &$libraries) |
42
|
|
|
{ |
43
|
|
|
$libraries['simpleimage'] = array( |
44
|
|
|
'name' => 'SimpleImage', |
45
|
|
|
'description' => 'A PHP class that simplifies working with images', |
46
|
|
|
'type' => 'php', |
47
|
|
|
'module' => 'image', |
48
|
|
|
'url' => 'https://github.com/claviska/SimpleImage', |
49
|
|
|
'download' => 'https://github.com/claviska/SimpleImage/archive/3.3.0.zip', |
50
|
|
|
'version' => '3.3.0', |
51
|
|
|
'files' => array( |
52
|
|
|
'vendor/claviska/simpleimage/src/claviska/SimpleImage.php' |
53
|
|
|
) |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Implements hook "imagestyle.action.handlers" |
59
|
|
|
* @param array $handlers |
60
|
|
|
*/ |
61
|
|
|
public function hookImagestyleActionHandlers(array &$handlers) |
62
|
|
|
{ |
63
|
|
|
$config = include __DIR__ . '/config/actions.php'; |
64
|
|
|
$handlers = array_merge($handlers, $config); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Implements hook "module.enable.after" |
69
|
|
|
*/ |
70
|
|
|
public function hookModuleEnableAfter() |
71
|
|
|
{ |
72
|
|
|
$this->library->clearCache(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Implements hook "module.disable.after" |
77
|
|
|
*/ |
78
|
|
|
public function hookModuleDisableAfter() |
79
|
|
|
{ |
80
|
|
|
$this->library->clearCache(); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Implements hook "module.install.after" |
85
|
|
|
*/ |
86
|
|
|
public function hookModuleInstallAfter() |
87
|
|
|
{ |
88
|
|
|
$this->library->clearCache(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Implements hook "module.uninstall.after" |
93
|
|
|
*/ |
94
|
|
|
public function hookModuleUninstallAfter() |
95
|
|
|
{ |
96
|
|
|
$this->library->clearCache(); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
} |
100
|
|
|
|