| 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 |
|