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