PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / mrclay / minify / lib / Minify / JS / JShrink.php

JShrink.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 4.7.0, at vendor/mrclay/minify/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 <[email protected]>
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