1 | <?php |
||
11 | class Minify |
||
12 | { |
||
13 | protected $objEnvironment; |
||
14 | |||
15 | /** |
||
16 | * Cache bust file path |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $strCacheBustFile; |
||
21 | |||
22 | /** |
||
23 | * Public folder path |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $strPublicFolderPath; |
||
28 | |||
29 | /** |
||
30 | * File types supported |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $arrFileTypes; |
||
35 | |||
36 | /** |
||
37 | * Destination file extension |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $strDestinationExtension; |
||
42 | |||
43 | /** |
||
44 | * Destination folder |
||
45 | * |
||
46 | * @var |
||
47 | */ |
||
48 | protected $strDestinationFolder; |
||
49 | |||
50 | /** |
||
51 | * Destination file |
||
52 | * |
||
53 | * @var |
||
54 | */ |
||
55 | protected $strDestinationFile; |
||
56 | |||
57 | /** |
||
58 | * Set env to dev |
||
59 | * |
||
60 | * @var |
||
61 | */ |
||
62 | protected $blnIsDev; |
||
63 | |||
64 | /** |
||
65 | * Create a new Minifier Instance |
||
66 | * |
||
67 | * Minify constructor. |
||
68 | */ |
||
69 | public function __construct() |
||
77 | |||
78 | |||
79 | /** |
||
80 | * Set Class Variables |
||
81 | * |
||
82 | * @return null |
||
83 | */ |
||
84 | public function init() |
||
97 | |||
98 | /** |
||
99 | * Build minified file |
||
100 | * |
||
101 | * @var $strFolder string |
||
102 | * @var $strFile string |
||
103 | * @return string |
||
104 | */ |
||
105 | public function js($strFolder = '/js', $strFile = 'app.min.js') |
||
109 | |||
110 | /** |
||
111 | * Build CSS minified file |
||
112 | * |
||
113 | * @var $strFolder string |
||
114 | * @var $strFile string |
||
115 | * @return bool|null|string |
||
116 | */ |
||
117 | public function css($strFolder = '/css', $strFile = 'app.min.css') |
||
121 | |||
122 | /** |
||
123 | * Generate minified file |
||
124 | * |
||
125 | * @param string $strType |
||
126 | * @param string $strFolder |
||
127 | * @param string $strFile |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getMinifiedFile($strType = 'css', $strFolder = '/css', $strFile = 'app.min.css') |
||
138 | |||
139 | /** |
||
140 | * Process Built |
||
141 | * |
||
142 | * @return bool|null|string |
||
143 | */ |
||
144 | public function process() |
||
160 | |||
161 | /** |
||
162 | * Build file |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | public function build() |
||
197 | |||
198 | /** |
||
199 | * Get minified Content |
||
200 | * |
||
201 | * @param $strFileName |
||
202 | * @return bool|string |
||
203 | */ |
||
204 | public function getMinifiedContent($strFileName) |
||
231 | |||
232 | /** |
||
233 | * Minify content |
||
234 | * |
||
235 | * @param $strFile |
||
236 | * @return bool|string |
||
237 | */ |
||
238 | public function minifyContent($strFile) |
||
250 | |||
251 | /** |
||
252 | * Save Cache Bust |
||
253 | * |
||
254 | * @var string $strApplicationFileContents |
||
255 | * @return null |
||
256 | */ |
||
257 | public function saveCacheBust($strApplicationFileContents = '') |
||
276 | |||
277 | /** |
||
278 | * Get Cache Bust |
||
279 | * |
||
280 | * @return bool|string |
||
281 | */ |
||
282 | public function getCacheBust() |
||
292 | |||
293 | /** |
||
294 | * Set env to Dev |
||
295 | * |
||
296 | * @param bool $bln |
||
297 | * @return $this |
||
298 | */ |
||
299 | public function setDev($bln = true) |
||
305 | |||
306 | /** |
||
307 | * Set Cache bust file |
||
308 | * |
||
309 | * @param string $strFile |
||
310 | * @return $this |
||
311 | */ |
||
312 | public function setCacheBustFile($strFile = 'autominifier-cache-bust.txt') |
||
317 | |||
318 | /** |
||
319 | * Set public folder |
||
320 | * |
||
321 | * @param string $strFolder |
||
322 | * @return $this |
||
323 | */ |
||
324 | public function setPublicFolder($strFolder = '/../../../../public') |
||
330 | |||
331 | /** |
||
332 | * Set test folder |
||
333 | * |
||
334 | * @return $this |
||
335 | */ |
||
336 | public function setTest() |
||
346 | |||
347 | /** |
||
348 | * Set destination folder |
||
349 | * |
||
350 | * @param $strFolder |
||
351 | * @return $this |
||
352 | */ |
||
353 | public function setDestinationFolder($strFolder) |
||
358 | |||
359 | /** |
||
360 | * Set destination file |
||
361 | * |
||
362 | * @param $strFile |
||
363 | * @return $this |
||
364 | */ |
||
365 | public function setDestinationFile($strFile) |
||
370 | |||
371 | /** |
||
372 | * Set destination file extension |
||
373 | * |
||
374 | * @param $strDestinationExtension |
||
375 | */ |
||
376 | public function setDestinationExtensionType($strDestinationExtension) |
||
380 | |||
381 | /** |
||
382 | * Get Public folder |
||
383 | * |
||
384 | * @return string |
||
385 | */ |
||
386 | public function getPublicFolder() |
||
390 | |||
391 | /** |
||
392 | * Get destination folder |
||
393 | * |
||
394 | * @return mixed |
||
395 | */ |
||
396 | public function getDestinationFolder() |
||
400 | |||
401 | /** |
||
402 | * Set destination file |
||
403 | * |
||
404 | * @return mixed |
||
405 | */ |
||
406 | public function getDestinationFile() |
||
410 | |||
411 | /** |
||
412 | * Get application file name |
||
413 | * |
||
414 | * @return string |
||
415 | */ |
||
416 | public function getAppFileName() |
||
420 | |||
421 | /** |
||
422 | * Get destination file type extension |
||
423 | * |
||
424 | * @return mixed |
||
425 | */ |
||
426 | public function getDestinationExtension() |
||
430 | |||
431 | public function getFilesFolder() |
||
435 | } |
||
436 |