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