Пример #1
0
 /**
  */
 public function minify()
 {
     if (!is_executable($this->_opts['java']) || !is_readable($this->_opts['closure'])) {
         $this->_opts['logger']->log('The java path or Closure location can not be accessed.', Horde_Log::ERR);
         return parent::minify();
     }
     /* --warning_level QUIET - closure default is "DEFAULT" which will
      * cause code with compiler warnings to output bad js (see Bug
      * #13789) */
     $cmd = trim(escapeshellcmd($this->_opts['java']) . ' -jar ' . escapeshellarg($this->_opts['closure']) . ' --warning_level QUIET');
     if (isset($this->_opts['sourcemap']) && is_array($this->_data)) {
         $this->_sourcemap = Horde_Util::getTempFile();
         $cmd .= ' --create_source_map ' . escapeshellarg($this->_sourcemap) . ' --source_map_format=V3';
         $suffix = "\n//# sourceMappingURL=" . $this->_opts['sourcemap'];
     } else {
         $suffix = '';
     }
     if (isset($this->_opts['cmdline'])) {
         $cmd .= ' ' . trim($this->_opts['cmdline']);
     }
     if (is_array($this->_data)) {
         $js = '';
         foreach ($this->_data as $val) {
             $cmd .= ' ' . $val;
         }
     } else {
         $js = $this->_data;
     }
     $cmdline = new Horde_JavascriptMinify_Util_Cmdline();
     return $cmdline->runCmd($js, $cmd, $this->_opts['logger']) . $suffix . $this->_sourceUrls();
 }
Пример #2
0
 /**
  */
 public function minify()
 {
     if (!is_executable($this->_opts['java']) || !is_readable($this->_opts['closure'])) {
         $this->_opts['logger']->log('The java path or Closure location can not be accessed.', Horde_Log::ERR);
         return parent::minify();
     }
     $cmd = trim(escapeshellcmd($this->_opts['java']) . ' -jar ' . escapeshellarg($this->_opts['closure']));
     if (isset($this->_opts['sourcemap']) && is_array($this->_data)) {
         $this->_sourcemap = Horde_Util::getTempFile();
         $cmd .= ' --create_source_map ' . escapeshellarg($this->_sourcemap) . ' --source_map_format=V3';
         $suffix = "\n//# sourceMappingURL=" . $this->_opts['sourcemap'];
     } else {
         $suffix = '';
     }
     if (isset($this->_opts['cmdline'])) {
         $cmd .= ' ' . trim($this->_opts['cmdline']);
     }
     if (is_array($this->_data)) {
         $js = '';
         foreach ($this->_data as $val) {
             $cmd .= ' ' . $val;
         }
     } else {
         $js = $this->_data;
     }
     $cmdline = new Horde_JavascriptMinify_Util_Cmdline();
     return $cmdline->runCmd($js, $cmd, $this->_opts['logger']) . $suffix . $this->_sourceUrls();
 }
Пример #3
0
 /**
  */
 public function minify()
 {
     $js = parent::minify();
     if (!is_executable($this->_opts['java']) || !is_readable($this->_opts['yui'])) {
         $this->_opts['logger']->log('The java path or YUI location can not be accessed.', Horde_Log::ERR);
         return $js;
     }
     $cmd = escapeshellcmd($this->_opts['java']) . ' -jar ' . escapeshellarg($this->_opts['yui']) . ' --type js';
     if (isset($this->_opts['cmdline'])) {
         $cmd .= ' ' . $this->_opts['cmdline'];
     }
     $cmdline = new Horde_JavascriptMinify_Util_Cmdline();
     return $cmdline->runCmd($js, trim($cmd), $this->_opts['logger']) . $this->_sourceUrls();
 }
Пример #4
0
 /**
  */
 public function minify()
 {
     if (!is_readable($this->_opts['uglifyjs'])) {
         $this->_opts['logger']->log('The UglifyJS binary cannot be accessed.', Horde_Log::ERR);
         return parent::minify();
     }
     $cmd = escapeshellcmd($this->_opts['uglifyjs']);
     if (isset($this->_opts['sourcemap']) && is_array($this->_data)) {
         $this->_sourcemap = Horde_Util::getTempFile();
         $cmd .= ' --source-map ' . escapeshellarg($this->_sourcemap) . ' --source-map-url ' . escapeshellarg($this->_opts['sourcemap']);
     }
     if (is_array($this->_data)) {
         $js = '';
         foreach ($this->_data as $val) {
             $cmd .= ' ' . $val;
         }
     } else {
         $js = $this->_data;
     }
     $cmdline = new Horde_JavascriptMinify_Util_Cmdline();
     return $cmdline->runCmd($js, trim($cmd . ' ' . $this->_opts['cmdline']), $this->_opts['logger']) . $this->_sourceUrls();
 }
Пример #5
0
 /**
  */
 public function minify()
 {
     $jsmin = new Horde_JavascriptMinify_Jsmin_Minifier(parent::minify());
     return $jsmin->minify() . $this->_sourceUrls();
 }