PluginProbe
WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript / trunk
WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript vtrunk
trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.4 1.5 1.5.1 1.6 2.0 2.0.1
wp-super-minify / includes / min / lib / Minify / JS / JShrink.php

JShrink.php in WP Super Minify • Minify, Compress and Cache HTML, CSS & JavaScript trunk, at includes/min/lib/Minify/JS/JShrink.php

49 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Minify\JS\JShrink
4 *
5 * @package Minify
6 */
7
8 namespace Minify\JS;
9
10 /**
11 * Wrapper to Javascript Minifier built in PHP http://www.tedivm.com
12 *
13 * @package Minify
14 * @author Elan Ruusamäe <glen@pld-linux.org>
15 * @link https://github.com/tedious/JShrink
16 *
17 */
18 class JShrink
19 {
20 /**
21 * Contains the default options for minification. This array is merged with
22 * the one passed in by the user to create the request specific set of
23 * options (stored in the $options attribute).
24 *
25 * @var string[]
26 */
27 protected static $defaultOptions = array('flaggedComments' => true);
28
29 /**
30 * Takes a string containing javascript and removes unneeded characters in
31 * order to shrink the code without altering it's functionality.
32 *
33 * @param string $js The raw javascript to be minified
34 * @param array $options Various runtime options in an associative array
35 *
36 * @see JShrink\Minifier::minify()
37 * @return string
38 */
39 public static function minify($js, array $options = array())
40 {
41 $options = array_merge(
42 self::$defaultOptions,
43 $options
44 );
45
46 return \JShrink\Minifier::minify($js, $options);
47 }
48 }
49