1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-16 11:03:59 +02:00

V1.9.0 overhaul

This commit is contained in:
Steve Clay
2008-02-28 18:42:56 +00:00
parent 5527771acf
commit 0a939d4f91
65 changed files with 8081 additions and 608 deletions

View File

@@ -0,0 +1,46 @@
<?php
require_once 'Minify/Controller/Base.php';
/**
* Controller class for minifying a set of files
*
* E.g. the following would serve minified Javascript for a site
* <code>
* $dr = $_SERVER['DOCUMENT_ROOT'];
* Minify::minify('Files', array(
* $dr . '/js/jquery.js'
* ,$dr . '/js/plugins.js'
* ,$dr . '/js/site.js'
* ));
* </code>
*
*/
class Minify_Controller_Files extends Minify_Controller_Base {
/**
* @param array $spec array or full paths of files to be minified
*
* @param array $options optional options to pass to Minify
*
* @return null
*/
public function __construct($spec, $options = array()) {
$sources = array();
foreach ($spec as $file) {
$file = realpath($file);
if (file_exists($file)) {
$sources[] = new Minify_Source(array(
'filepath' => $file
));
} else {
return;
}
}
if ($sources) {
$this->requestIsValid = true;
}
parent::__construct($sources, $options);
}
}