mirror of
https://github.com/mrclay/minify.git
synced 2025-08-15 10:34:02 +02:00
Minify.php : + version
Controller/Page.php : requires to require_once
This commit is contained in:
@@ -29,6 +29,7 @@ require_once 'Minify/Source.php';
|
|||||||
*/
|
*/
|
||||||
class Minify {
|
class Minify {
|
||||||
|
|
||||||
|
const VERSION = '2.2.0';
|
||||||
const TYPE_CSS = 'text/css';
|
const TYPE_CSS = 'text/css';
|
||||||
const TYPE_HTML = 'text/html';
|
const TYPE_HTML = 'text/html';
|
||||||
// there is some debate over the ideal JS Content-Type, but this is the
|
// there is some debate over the ideal JS Content-Type, but this is the
|
||||||
@@ -156,7 +157,8 @@ class Minify {
|
|||||||
* with keys "success" (bool), "statusCode" (int), "content" (string), and
|
* with keys "success" (bool), "statusCode" (int), "content" (string), and
|
||||||
* "headers" (array).
|
* "headers" (array).
|
||||||
*/
|
*/
|
||||||
public static function serve($controller, $options = array()) {
|
public static function serve($controller, $options = array())
|
||||||
|
{
|
||||||
if (is_string($controller)) {
|
if (is_string($controller)) {
|
||||||
// make $controller into object
|
// make $controller into object
|
||||||
$class = 'Minify_Controller_' . $controller;
|
$class = 'Minify_Controller_' . $controller;
|
||||||
@@ -423,7 +425,8 @@ class Minify {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected static function _combineMinify() {
|
protected static function _combineMinify()
|
||||||
|
{
|
||||||
$type = self::$_options['contentType']; // ease readability
|
$type = self::$_options['contentType']; // ease readability
|
||||||
|
|
||||||
// when combining scripts, make sure all statements separated and
|
// when combining scripts, make sure all statements separated and
|
||||||
@@ -496,7 +499,8 @@ class Minify {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected static function _getCacheId() {
|
protected static function _getCacheId()
|
||||||
|
{
|
||||||
return md5(serialize(array(
|
return md5(serialize(array(
|
||||||
Minify_Source::getDigest(self::$_controller->sources)
|
Minify_Source::getDigest(self::$_controller->sources)
|
||||||
,self::$_options['minifiers']
|
,self::$_options['minifiers']
|
||||||
@@ -510,7 +514,8 @@ class Minify {
|
|||||||
* Bubble CSS @imports to the top or prepend a warning if an
|
* Bubble CSS @imports to the top or prepend a warning if an
|
||||||
* @import is detected not at the top.
|
* @import is detected not at the top.
|
||||||
*/
|
*/
|
||||||
protected static function _handleCssImports($css) {
|
protected static function _handleCssImports($css)
|
||||||
|
{
|
||||||
if (self::$_options['bubbleCssImports']) {
|
if (self::$_options['bubbleCssImports']) {
|
||||||
// bubble CSS imports
|
// bubble CSS imports
|
||||||
preg_match_all('/@import.*?;/', $css, $imports);
|
preg_match_all('/@import.*?;/', $css, $imports);
|
||||||
|
@@ -76,8 +76,8 @@ class Minify_Controller_Page extends Minify_Controller_Base {
|
|||||||
if ($this->_loadCssJsMinifiers) {
|
if ($this->_loadCssJsMinifiers) {
|
||||||
// Minify will not call for these so we must manually load
|
// Minify will not call for these so we must manually load
|
||||||
// them when Minify/HTML.php is called for.
|
// them when Minify/HTML.php is called for.
|
||||||
require 'Minify/CSS.php';
|
require_once 'Minify/CSS.php';
|
||||||
require 'JSMin.php';
|
require_once 'JSMin.php';
|
||||||
}
|
}
|
||||||
parent::loadMinifier($minifierCallback); // load Minify/HTML.php
|
parent::loadMinifier($minifierCallback); // load Minify/HTML.php
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user