|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00007 require_once 'Minify/Controller/Base.php'; 00008 00029 class Minify_Controller_Files extends Minify_Controller_Base { 00030 00041 public function setupSources($options) { 00042 // strip controller options 00043 00044 $files = $options['files']; 00045 // if $files is a single object, casting will break it 00046 if (is_object($files)) { 00047 $files = array($files); 00048 } elseif (! is_array($files)) { 00049 $files = (array)$files; 00050 } 00051 unset($options['files']); 00052 00053 $sources = array(); 00054 foreach ($files as $file) { 00055 if ($file instanceof Minify_Source) { 00056 $sources[] = $file; 00057 continue; 00058 } 00059 if (0 === strpos($file, '//')) { 00060 $file = $_SERVER['DOCUMENT_ROOT'] . substr($file, 1); 00061 } 00062 $realPath = realpath($file); 00063 if (is_file($realPath)) { 00064 $sources[] = new Minify_Source(array( 00065 'filepath' => $realPath 00066 )); 00067 } else { 00068 $this->log("The path \"{$file}\" could not be found (or was not a file)"); 00069 return $options; 00070 } 00071 } 00072 if ($sources) { 00073 $this->sources = $sources; 00074 } 00075 return $options; 00076 } 00077 } 00078