|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package Jquery Mobile |
|
5
|
|
|
* @author Iurii Makukh <[email protected]> |
|
6
|
|
|
* @copyright Copyright (c) 2017, Iurii Makukh <[email protected]> |
|
7
|
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL-3.0+ |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace gplcart\modules\jquery_mobile; |
|
11
|
|
|
|
|
12
|
|
|
use gplcart\core\Library; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Main class for Jquery Mobile module |
|
16
|
|
|
*/ |
|
17
|
|
|
class Main |
|
18
|
|
|
{ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Library class instance |
|
22
|
|
|
* @var \gplcart\core\Library $library |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $library; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @param Library $library |
|
28
|
|
|
*/ |
|
29
|
|
|
public function __construct(Library $library) |
|
30
|
|
|
{ |
|
31
|
|
|
$this->library = $library; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Implements hook "library.list" |
|
36
|
|
|
* @param array $libraries |
|
37
|
|
|
*/ |
|
38
|
|
|
public function hookLibraryList(array &$libraries) |
|
39
|
|
|
{ |
|
40
|
|
|
$libraries['jquery_mobile'] = array( |
|
41
|
|
|
'name' => 'Jquery Mobile', // @text |
|
42
|
|
|
'description' => 'A HTML5-based user interface system designed to make responsive web sites and apps that are accessible on all smartphone, tablet and desktop devices', // @text |
|
43
|
|
|
'type' => 'asset', |
|
44
|
|
|
'module' => 'jquery_mobile', |
|
45
|
|
|
'url' => 'http://jquerymobile.com', |
|
46
|
|
|
'download' => 'http://jquerymobile.com/resources/download/jquery.mobile-1.4.5.zip', |
|
47
|
|
|
'version' => '1.4.5', |
|
48
|
|
|
'files' => array( |
|
49
|
|
|
'jquery.mobile-1.4.5.min.js', |
|
50
|
|
|
'jquery.mobile-1.4.5.min.css' |
|
51
|
|
|
), |
|
52
|
|
|
); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Implements hook "module.install.before" |
|
57
|
|
|
* @param null|string |
|
58
|
|
|
*/ |
|
59
|
|
|
public function hookModuleInstallBefore(&$result) |
|
60
|
|
|
{ |
|
61
|
|
|
$library = $this->library->get('jquery'); |
|
62
|
|
|
|
|
63
|
|
|
if (empty($library['version']) || version_compare($library['version'], '1.8.0', '<')) { |
|
64
|
|
|
$result = gplcart_text('Jquery Mobile requires Jquery >= 1.8.0'); |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
} |
|
69
|
|
|
|