Example #1
0
 static function import($filePath, $namespace = JPLANT_LOADER_KEY)
 {
     $includePaths = JPlantLoader::getIncludePaths();
     if (count($includePaths) < 2) {
         return JLoader::import($filePath, $includePaths[0], $namespace);
     }
     $realFilePath = '/' . str_replace(JPLANT_LOADER_SEP, '/', $filePath) . '.php';
     foreach ($includePaths as $includePath) {
         $path = $includePath . $realFilePath;
         if (@file_exists($path)) {
             return JLoader::import($filePath, $includePath, JPLANT_LOADER_KEY);
         }
     }
     JError::raiseError(500, 'Unable to load the following library: "' . $filePath . '"');
     return null;
 }