Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/minify/lib/Minify/Controller/Groups.php
Go to the documentation of this file.
00001 <?php
00007 require_once 'Minify/Controller/Base.php';
00008 
00031 class Minify_Controller_Groups extends Minify_Controller_Base {
00032     
00044     public function setupSources($options) {
00045         // strip controller options
00046         $groups = $options['groups'];
00047         unset($options['groups']);
00048         
00049         // mod_fcgid places PATH_INFO in ORIG_PATH_INFO
00050         $pi = isset($_SERVER['ORIG_PATH_INFO'])
00051             ? substr($_SERVER['ORIG_PATH_INFO'], 1) 
00052             : (isset($_SERVER['PATH_INFO'])
00053                 ? substr($_SERVER['PATH_INFO'], 1) 
00054                 : false
00055             );
00056         if (false === $pi || ! isset($groups[$pi])) {
00057             // no PATH_INFO or not a valid group
00058             $this->log("Missing PATH_INFO or no group set for \"$pi\"");
00059             return $options;
00060         }
00061         $sources = array();
00062         
00063         $files = $groups[$pi];
00064         // if $files is a single object, casting will break it
00065         if (is_object($files)) {
00066             $files = array($files);
00067         } elseif (! is_array($files)) {
00068             $files = (array)$files;
00069         }
00070         foreach ($files as $file) {
00071             if ($file instanceof Minify_Source) {
00072                 $sources[] = $file;
00073                 continue;
00074             }
00075             if (0 === strpos($file, '//')) {
00076                 $file = $_SERVER['DOCUMENT_ROOT'] . substr($file, 1);
00077             }
00078             $realPath = realpath($file);
00079             if (is_file($realPath)) {
00080                 $sources[] = new Minify_Source(array(
00081                     'filepath' => $realPath
00082                 ));    
00083             } else {
00084                 $this->log("The path \"{$file}\" could not be found (or was not a file)");
00085                 return $options;
00086             }
00087         }
00088         if ($sources) {
00089             $this->sources = $sources;
00090         }
00091         return $options;
00092     }
00093 }
00094 
 All Data Structures Namespaces Files Functions Variables Enumerations