2012-05-15 01:15:53 +04:00
|
|
|
<?php
|
|
|
|
|
2012-09-06 01:28:59 +04:00
|
|
|
require_once 'mediawiki/JavaScriptMinifier.php';
|
2012-05-15 01:15:53 +04:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2012-09-07 17:22:01 +04:00
|
|
|
if (!defined('DEBUG') || !DEBUG) {
|
2012-06-14 20:22:48 +04:00
|
|
|
$js_out = JavaScriptMinifier::minify($js_out);
|
|
|
|
}
|
2012-05-15 01:15:53 +04:00
|
|
|
return $js_out;
|
|
|
|
}
|
|
|
|
}
|