|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00007 require_once 'Minify/Controller/Base.php'; 00008 00016 class Minify_Controller_Page extends Minify_Controller_Base { 00017 00038 public function setupSources($options) { 00039 if (isset($options['file'])) { 00040 $sourceSpec = array( 00041 'filepath' => $options['file'] 00042 ); 00043 } else { 00044 // strip controller options 00045 $sourceSpec = array( 00046 'content' => $options['content'] 00047 ,'id' => $options['id'] 00048 ); 00049 unset($options['content'], $options['id']); 00050 } 00051 if (isset($options['minifyAll'])) { 00052 // this will be the 2nd argument passed to Minify_HTML::minify() 00053 $sourceSpec['minifyOptions'] = array( 00054 'cssMinifier' => array('Minify_CSS', 'minify') 00055 ,'jsMinifier' => array('JSMin', 'minify') 00056 ); 00057 $this->_loadCssJsMinifiers = true; 00058 unset($options['minifyAll']); 00059 } 00060 $this->sources[] = new Minify_Source($sourceSpec); 00061 00062 $options['contentType'] = Minify::TYPE_HTML; 00063 return $options; 00064 } 00065 00066 protected $_loadCssJsMinifiers = false; 00067 00071 public function loadMinifier($minifierCallback) 00072 { 00073 if ($this->_loadCssJsMinifiers) { 00074 // Minify will not call for these so we must manually load 00075 // them when Minify/HTML.php is called for. 00076 require_once 'Minify/CSS.php'; 00077 require_once 'JSMin.php'; 00078 } 00079 parent::loadMinifier($minifierCallback); // load Minify/HTML.php 00080 } 00081 } 00082