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
← All changes | vendor/bin/minifyjs +113 -39 3.2.5 → 4.7.0 View file →
@@ -1,45 +1,119 @@
1 1 #!/usr/bin/env php
2 2 <?php
3 -use MatthiasMullie\Minify;
4 3
5 -// command line utility to minify JS
6 -if (file_exists(__DIR__ . '/../../../autoload.php')) {
7 - // if composer install
8 - require_once __DIR__ . '/../../../autoload.php';
9 -} else {
10 - require_once __DIR__ . '/../src/Minify.php';
11 - require_once __DIR__ . '/../src/JS.php';
12 - require_once __DIR__ . '/../src/Exception.php';
13 -}
4 +/**
5 + * Proxy PHP file generated by Composer
6 + *
7 + * This file includes the referenced bin path (../matthiasmullie/minify/bin/minifyjs)
8 + * using a stream wrapper to prevent the shebang from being output on PHP<8
9 + *
10 + * @generated
11 + */
14 12
15 -error_reporting(E_ALL);
16 -// check PHP setup for cli arguments
17 -if (!isset($_SERVER['argv']) && !isset($argv)) {
18 - fwrite(STDERR, 'Please enable the "register_argc_argv" directive in your php.ini' . PHP_EOL);
19 - exit(1);
20 -} elseif (!isset($argv)) {
21 - $argv = $_SERVER['argv'];
13 +namespace Composer;
14 +
15 +$GLOBALS['_composer_bin_dir'] = __DIR__;
16 +$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
17 +
18 +if (PHP_VERSION_ID < 80000) {
19 + if (!class_exists('Composer\BinProxyWrapper')) {
20 + /**
21 + * @internal
22 + */
23 + final class BinProxyWrapper
24 + {
25 + private $handle;
26 + private $position;
27 + private $realpath;
28 +
29 + public function stream_open($path, $mode, $options, &$opened_path)
30 + {
31 + // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
32 + $opened_path = substr($path, 17);
33 + $this->realpath = realpath($opened_path) ?: $opened_path;
34 + $opened_path = $this->realpath;
35 + $this->handle = fopen($this->realpath, $mode);
36 + $this->position = 0;
37 +
38 + return (bool) $this->handle;
39 + }
40 +
41 + public function stream_read($count)
42 + {
43 + $data = fread($this->handle, $count);
44 +
45 + if ($this->position === 0) {
46 + $data = preg_replace('{^#!.*\r?\n}', '', $data);
47 + }
48 +
49 + $this->position += strlen($data);
50 +
51 + return $data;
52 + }
53 +
54 + public function stream_cast($castAs)
55 + {
56 + return $this->handle;
57 + }
58 +
59 + public function stream_close()
60 + {
61 + fclose($this->handle);
62 + }
63 +
64 + public function stream_lock($operation)
65 + {
66 + return $operation ? flock($this->handle, $operation) : true;
67 + }
68 +
69 + public function stream_seek($offset, $whence)
70 + {
71 + if (0 === fseek($this->handle, $offset, $whence)) {
72 + $this->position = ftell($this->handle);
73 + return true;
74 + }
75 +
76 + return false;
77 + }
78 +
79 + public function stream_tell()
80 + {
81 + return $this->position;
82 + }
83 +
84 + public function stream_eof()
85 + {
86 + return feof($this->handle);
87 + }
88 +
89 + public function stream_stat()
90 + {
91 + return array();
92 + }
93 +
94 + public function stream_set_option($option, $arg1, $arg2)
95 + {
96 + return true;
97 + }
98 +
99 + public function url_stat($path, $flags)
100 + {
101 + $path = substr($path, 17);
102 + if (file_exists($path)) {
103 + return stat($path);
104 + }
105 +
106 + return false;
107 + }
108 + }
109 + }
110 +
111 + if (
112 + (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
113 + || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
114 + ) {
115 + return include("phpvfscomposer://" . __DIR__ . '/..'.'/matthiasmullie/minify/bin/minifyjs');
116 + }
22 117 }
23 -// check if path to file given
24 -if (!isset($argv[1])) {
25 - fwrite(STDERR, 'Argument expected: path to file' . PHP_EOL);
26 - exit(1);
27 -}
28 -// check if script run in cli environment
29 -if ('cli' !== php_sapi_name()) {
30 - fwrite(STDERR, $argv[1] . ' must be run in the command line' . PHP_EOL);
31 - exit(1);
32 -}
33 -// check if source file exists
34 -if (!file_exists($argv[1])) {
35 - fwrite(STDERR, 'Source file "' . $argv[1] . '" not found' . PHP_EOL);
36 - exit(1);
37 -}
38 118
39 -try {
40 - $minifier = new Minify\JS($argv[1]);
41 - echo $minifier->minify();
42 -} catch (Exception $e) {
43 - fwrite(STDERR, $e->getMessage(), PHP_EOL);
44 - exit(1);
45 -}
119 +return include __DIR__ . '/..'.'/matthiasmullie/minify/bin/minifyjs';