aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'start.php')
-rw-r--r--start.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/start.php b/start.php
new file mode 100644
index 000000000..33ef6d4f3
--- /dev/null
+++ b/start.php
@@ -0,0 +1,22 @@
+<?php
+
+function minify_init() {
+ //make sure this runs after everyone else is done
+ elgg_register_plugin_hook_handler('view', 'all', 'minify_views', 1000);
+}
+
+function minify_views($hook, $type, $content, $params) {
+ $view = $params['view'];
+
+ if (preg_match("/^js\//", $view)) {
+ if (include_once dirname(__FILE__) . '/vendors/min/lib/JSMin.php') {
+ return JSMin::minify($content);
+ }
+ } elseif (preg_match("/^css\//", $view)) {
+ if (include_once dirname(__FILE__) . '/vendors/min/lib/CSS.php') {
+ return Minify_CSS::minify($content);
+ }
+ }
+}
+
+elgg_register_event_handler('init', 'system', 'minify_init');