mirror of
https://github.com/mrclay/minify.git
synced 2025-08-25 15:00:47 +02:00
Make Minify::combine and mix_extra stuff operational (and disabled by default)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
die('Must be rewritten for new API');
|
||||
die('Disabled: use this only for testing');
|
||||
|
||||
/**
|
||||
* Fetch and minify a URL (auto-detect HTML/JS/CSS)
|
||||
*/
|
||||
@@ -94,6 +95,7 @@ if (isset($_POST['url'])) {
|
||||
|
||||
$sourceSpec['content'] = $content;
|
||||
$sourceSpec['id'] = 'foo';
|
||||
$sourceSpec['contentType'] = $type['minify'];
|
||||
|
||||
if ($type['minify'] === 'text/html') {
|
||||
if (isset($_POST['minJs'])) {
|
||||
@@ -103,7 +105,7 @@ if (isset($_POST['url'])) {
|
||||
$sourceSpec['minifyOptions']['cssMinifier'] = array('Minify_CSSmin', 'minify');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$source = new Minify_Source($sourceSpec);
|
||||
|
||||
$sendType = 'text/plain';
|
||||
@@ -116,10 +118,11 @@ if (isset($_POST['url'])) {
|
||||
header('Content-Type: ' . $sendType);
|
||||
// using combine instead of serve because it allows us to specify a
|
||||
// Content-Type like application/xhtml+xml IF we need to
|
||||
|
||||
$minify = new Minify(new Minify_Cache_Null());
|
||||
|
||||
try {
|
||||
echo Minify::combine(array($source), array(
|
||||
'contentType' => $type['minify']
|
||||
));
|
||||
echo $minify->combine(array($source));
|
||||
} catch (Exception $e) {
|
||||
header('Content-Type: text/html;charset=utf-8');
|
||||
echo htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8');
|
||||
@@ -136,8 +139,7 @@ $ua = get_magic_quotes_gpc()
|
||||
?>
|
||||
<!DOCTYPE html><head><title>Minify URL</title></head>
|
||||
|
||||
<p><strong>Warning! Please do not place this application on a public site.</strong> This should be used
|
||||
only for testing.</p>
|
||||
<p><strong>Warning! Please do not place this application on a public site.</strong> This should be used only for testing.</p>
|
||||
|
||||
<h1>Fetch and Minify a URL</h1>
|
||||
<p>This tool will retrieve the contents of a URL and minify it.
|
||||
|
Reference in New Issue
Block a user