Minify_Controller_Files

Controller class for minifying a set of files.

Defined (1)

The class is defined in the following location(s).

/lib/Minify/Minify/Controller/Files.php  
  1. class Minify_Controller_Files extends Minify_Controller_Base { 
  2.  
  3. /** 
  4. * Set up file sources 
  5. *  
  6. * @param array $options controller and Minify options 
  7. * @return array Minify options 
  8. *  
  9. * Controller options: 
  10. *  
  11. * 'files': (required) array of complete file paths, or a single path 
  12. */ 
  13. public function setupSources($options) { 
  14. // strip controller options 
  15.  
  16. $files = $options['files']; 
  17. // if $files is a single object, casting will break it 
  18. if (is_object($files)) { 
  19. $files = array($files); 
  20. } elseif (! is_array($files)) { 
  21. $files = (array)$files; 
  22. unset($options['files']); 
  23.  
  24. $sources = array(); 
  25. foreach ($files as $file) { 
  26. if ($file instanceof Minify_Source) { 
  27. $sources[] = $file; 
  28. continue; 
  29. if (0 === strpos($file, '//')) { 
  30. $file = $_SERVER['DOCUMENT_ROOT'] . substr($file, 1); 
  31. $realPath = realpath($file); 
  32. if (is_file($realPath)) { 
  33. $sources[] = new Minify_Source(array( 
  34. 'filepath' => $realPath 
  35. ));  
  36. } else { 
  37. $this->log("The path \"{$file}\" could not be found (or was not a file)"); 
  38. return $options; 
  39. if ($sources) { 
  40. $this->sources = $sources; 
  41. return $options;