Elgg  Version 4.3
MinifyHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Views;
4 
11 
19  public function __invoke(\Elgg\Hook $hook) {
20  if (preg_match('~[\.-]min\.~', $hook->getParam('view'))) {
21  // bypass minification
22  return;
23  }
24 
25  switch ($hook->getType()) {
26  case 'js':
27  if (!_elgg_services()->config->simplecache_minify_js) {
28  break;
29  }
30 
31  $minifier = new \MatthiasMullie\Minify\JS($hook->getValue());
32  return $minifier->minify();
33  case 'css':
34  if (!_elgg_services()->config->simplecache_minify_css) {
35  break;
36  }
37 
38  $minifier = new \MatthiasMullie\Minify\CSS($hook->getValue());
39  return $minifier->minify();
40  }
41  }
42 }
Minifies content.
Models an event passed to hook handlers.
Definition: Hook.php:11
__invoke(\Elgg\Hook $hook)
Minifies simplecache CSS and JS views by handling the &#39;simplecache:generate&#39; hook.
_elgg_services()
Get the global service provider.
Definition: elgglib.php:638