PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.5
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.5
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 / min_extras / tools / testRewriteUri.php

testRewriteUri.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.5, at vendor/mrclay/minify/min_extras/tools/testRewriteUri.php

56 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 die('Disabled: use this only for testing');
3
4 $app = (require __DIR__ . '/../../bootstrap.php');
5 /* @var \Minify\App $app */
6
7 $env = $app->env;
8
9 header('Content-Type: text/html;charset=utf-8');
10
11 function h($str)
12 {
13 return htmlspecialchars($str, ENT_QUOTES);
14 }
15
16 function getInput($name, $default = '', $size = 50)
17 {
18 global $env;
19 $val = $env->post($name, $default);
20 return "<input type='text' name='{$name}' value='" . h($val) . "' size='{$size}' />";
21 }
22
23 $defaultCurrentDir = __DIR__;
24 $defaultDocRoot = realpath($env->getDocRoot());
25 $defaultSymLink = '//symlinkPath';
26 $defaultSymTarget = ($defaultCurrentDir[0] === '/') ? '/tmp' : 'C:\\WINDOWS\\Temp';
27 $defaultCss = "url(hello.gif)\nurl(../hello.gif)\nurl(../../hello.gif)\nurl(up/hello.gif)";
28
29 $out = '';
30
31 if ($env->post('css')) {
32 $symlinks = array();
33 if ('' !== ($target = $env->post('symTarget'))) {
34 $symlinks[$env->post('symLink')] = $target;
35 }
36 $css = Minify_CSS_UriRewriter::rewrite(
37 $env->post('css'),
38 $env->post('currentDir'),
39 $env->post('docRoot'),
40 $symlinks
41 );
42 $out = "<hr /><pre><code>" . h($css) . '</code></pre>';
43 }
44
45 ?>
46 <h1>Test <code>Minify_CSS_UriRewriter::rewrite()</code></h1>
47 <p><strong>Warning! Please do not place this application on a public site.</strong> This should be used only for testing.</p>
48 <form action="" method="post">
49 <div><label>document root: <?php echo getInput('docRoot', $defaultDocRoot); ?></label></div>
50 <div><label>symlink: <?php echo getInput('symLink', $defaultSymLink); ?> => <?php echo getInput('symTarget', $defaultSymTarget); ?></label></div>
51 <div><label>current directory: <?php echo getInput('currentDir', $defaultCurrentDir); ?></label></div>
52 <p><label>input CSS: <textarea name="css" cols="80" rows="5"><?php echo h($env->post('css', $defaultCss)); ?></textarea></label></p>
53 <p><input type="submit" value="rewrite()" /></p>
54 </form>
55 <?php echo $out; ?>
56