[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * @package s9e\TextFormatter 5 * @copyright Copyright (c) 2010-2019 The s9e Authors 6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 7 */ 8 namespace s9e\TextFormatter\Configurator\JavaScript; 9 use Exception; 10 abstract class Minifier 11 { 12 public $cacheDir; 13 public $keepGoing = \false; 14 abstract public function minify($src); 15 public function get($src) 16 { 17 try 18 { 19 return (isset($this->cacheDir)) ? $this->getFromCache($src) : $this->minify($src); 20 } 21 catch (Exception $e) 22 { 23 if (!$this->keepGoing) 24 throw $e; 25 } 26 return $src; 27 } 28 public function getCacheDifferentiator() 29 { 30 return ''; 31 } 32 protected function getFromCache($src) 33 { 34 $differentiator = $this->getCacheDifferentiator(); 35 $key = \sha1(\serialize([\get_class($this), $differentiator, $src])); 36 $cacheFile = $this->cacheDir . '/minifier.' . $key . '.js'; 37 if (!\file_exists($cacheFile)) 38 \file_put_contents($cacheFile, $this->minify($src)); 39 return \file_get_contents($cacheFile); 40 } 41 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |