CFLoader

Contains the functionality for auto-loading service classes.

Defined (1)

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

/lib/SNS/sdk.class.php  
  1. class CFLoader 
  2.  
  3. /**%******************************************************************************************%*/ 
  4. // AUTO-LOADER 
  5.  
  6. /** 
  7. * Automatically load classes that aren't included. 
  8. * @param string $class (Required) The classname to load. 
  9. * @return void 
  10. */ 
  11. public static function autoloader($class) 
  12. $path = dirname(__FILE__) . DIRECTORY_SEPARATOR; 
  13.  
  14. // Amazon SDK classes 
  15. if (strstr($class, 'Amazon')) 
  16. $path .= 'services' . DIRECTORY_SEPARATOR . str_ireplace('Amazon', '', strtolower($class)) . '.class.php'; 
  17.  
  18. // Utility classes 
  19. elseif (strstr($class, 'CF')) 
  20. $path .= 'utilities' . DIRECTORY_SEPARATOR . str_ireplace('CF', '', strtolower($class)) . '.class.php'; 
  21.  
  22. // Load CacheCore 
  23. elseif (strstr($class, 'Cache')) 
  24. if (file_exists($ipath = 'lib' . DIRECTORY_SEPARATOR . 'cachecore' . DIRECTORY_SEPARATOR . 'icachecore.interface.php')) 
  25. require_once($ipath); 
  26.  
  27. $path .= 'lib' . DIRECTORY_SEPARATOR . 'cachecore' . DIRECTORY_SEPARATOR . strtolower($class) . '.class.php'; 
  28.  
  29. // Load RequestCore 
  30. elseif (strstr($class, 'RequestCore') || strstr($class, 'ResponseCore')) 
  31. $path .= 'lib' . DIRECTORY_SEPARATOR . 'requestcore' . DIRECTORY_SEPARATOR . 'requestcore.class.php'; 
  32.  
  33. // Load Symfony YAML classes 
  34. elseif (strstr($class, 'sfYaml')) 
  35. $path .= 'lib' . DIRECTORY_SEPARATOR . 'yaml' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'sfYaml.php'; 
  36.  
  37. // Fall back to the 'extensions' directory. 
  38. elseif (defined('AWS_ENABLE_EXTENSIONS') && AWS_ENABLE_EXTENSIONS) 
  39. $path .= 'extensions' . DIRECTORY_SEPARATOR . strtolower($class) . '.class.php'; 
  40.  
  41. if (file_exists($path) && !is_dir($path)) 
  42. require_once($path);