js.php 496 B

12345678910111213141516171819202122
  1. <?php
  2. require_once('mediawiki/JavaScriptMinifier.php');
  3. class OC_Minimizer_JS extends OC_Minimizer
  4. {
  5. protected $contentType = 'application/javascript';
  6. public function minimizeFiles($files) {
  7. $js_out = '';
  8. foreach($files as $file_info) {
  9. $file = $file_info[0] . '/' . $file_info[2];
  10. $js_out .= '/* ' . $file . ' */' . "\n";
  11. $js_out .= file_get_contents($file);
  12. }
  13. if (!defined('DEBUG') || !DEBUG){
  14. $js_out = JavaScriptMinifier::minify($js_out);
  15. }
  16. return $js_out;
  17. }
  18. }