PageRenderTime 55ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/w3-total-cache/lib/Minify/Minify/Packer.php

https://bitbucket.org/openfarmtech/weblog-content
PHP | 37 lines | 15 code | 2 blank | 20 comment | 1 complexity | cd2f4b1ba22c322feb6ef8030ec06d6c MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.0, LGPL-3.0, BSD-3-Clause, GPL-3.0, LGPL-2.1, AGPL-3.0, CC-BY-SA-3.0
  1. <?php
  2. /**
  3. * Class Minify_Packer
  4. *
  5. * To use this class you must first download the PHP port of Packer
  6. * and place the file "class.JavaScriptPacker.php" in /lib (or your
  7. * include_path).
  8. * @link http://joliclic.free.fr/php/javascript-packer/en/
  9. *
  10. * Be aware that, as long as HTTP encoding is used, scripts minified with JSMin
  11. * will provide better client-side performance, as they need not be unpacked in
  12. * client-side code.
  13. *
  14. * @package Minify
  15. */
  16. if (false === (@include W3TC_LIB_MINIFY_DIR . '/class.JavaScriptPacker.php')) {
  17. trigger_error(
  18. 'The script "class.JavaScriptPacker.php" is required. Please see: http:'
  19. .'//code.google.com/p/minify/source/browse/trunk/min/lib/Minify/Packer.php'
  20. ,E_USER_ERROR
  21. );
  22. }
  23. /**
  24. * Minify Javascript using Dean Edward's Packer
  25. *
  26. * @package Minify
  27. */
  28. class Minify_Packer {
  29. public static function minify($code, $options = array())
  30. {
  31. // @todo: set encoding options based on $options :)
  32. $packer = new JavascriptPacker($code, 'Normal', true, false);
  33. return trim($packer->pack());
  34. }
  35. }