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