|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* MikoPBX - free phone system for small business |
|
4
|
|
|
* Copyright (C) 2017-2021 Alexey Portnov and Nikolay Beketov |
|
5
|
|
|
* |
|
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
7
|
|
|
* it under the terms of the GNU General Public License as published by |
|
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
9
|
|
|
* (at your option) any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* This program is distributed in the hope that it will be useful, |
|
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14
|
|
|
* GNU General Public License for more details. |
|
15
|
|
|
* |
|
16
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
|
17
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace MikoPBX\AdminCabinet\Plugins; |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
use Phalcon\Assets\Manager; |
|
24
|
|
|
|
|
25
|
|
|
class AssetManager extends Manager |
|
26
|
|
|
{ |
|
27
|
|
|
private string $version; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Sets asset versions |
|
31
|
|
|
* |
|
32
|
|
|
* @param string $version |
|
33
|
|
|
*/ |
|
34
|
|
|
public function setVersion(string $version) |
|
35
|
|
|
{ |
|
36
|
|
|
$this->version = $version; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Prints the HTML for CSS assets |
|
41
|
|
|
* |
|
42
|
|
|
* @param string $collectionName |
|
43
|
|
|
* |
|
44
|
|
|
* @return string |
|
45
|
|
|
*/ |
|
46
|
|
|
public function outputCss(string $collectionName = null): string |
|
47
|
|
|
{ |
|
48
|
|
|
foreach ($this->collection($collectionName) as $resource) { |
|
|
|
|
|
|
49
|
|
|
$resource->setVersion($this->version); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
return parent::outputCss($collectionName); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Prints the HTML for JS assets |
|
57
|
|
|
* |
|
58
|
|
|
* @param string $collectionName |
|
59
|
|
|
* |
|
60
|
|
|
* @return string |
|
61
|
|
|
*/ |
|
62
|
|
|
public function outputJs(string $collectionName = null): string |
|
63
|
|
|
{ |
|
64
|
|
|
foreach ($this->collection($collectionName) as $resource) { |
|
|
|
|
|
|
65
|
|
|
$resource->setVersion($this->version); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
return parent::outputJs($collectionName); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
} |