summaryrefslogtreecommitdiffstats
path: root/lib/minimizer/js.php
blob: bd2d836deb084b4466c2de36f49723159216d4ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

require_once 'mediawiki/JavaScriptMinifier.php';

class OC_Minimizer_JS extends OC_Minimizer
{
	protected $contentType = 'application/javascript';

	public function minimizeFiles($files) {
		$js_out = '';
		foreach($files as $file_info) {
			$file = $file_info[0] . '/' . $file_info[2];
			$js_out .= '/* ' . $file . ' */' . "\n";
			$js_out .= file_get_contents($file);
		}
		if (!defined('DEBUG') || !DEBUG) {
			$js_out = JavaScriptMinifier::minify($js_out);
		}
		return $js_out;
	}
}