Changeset 5851
- Timestamp:
- 11/04/07 17:05:37 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/addon/bridge/sfZendFrameworkBridge.class.php
r4752 r5851 26 26 class sfZendFrameworkBridge 27 27 { 28 static protected 29 $withLoader = true; 30 28 31 public static function autoload($class) 29 32 { 30 33 try 31 34 { 32 if ( class_exists('Zend_Version'))35 if (self::$withLoader) 33 36 { 34 37 Zend_Loader::loadClass($class); … … 46 49 return true; 47 50 } 48 51 49 52 /** 50 53 * Detect and return the path to current Zend loader class. 51 54 * 52 55 * Starting from ZF 0.9.0 autoloading function has been moved 53 * from Zend.php to Zend/ Version.php class.56 * from Zend.php to Zend/Loader.php class. 54 57 * Starting from ZF 1.0.0 Zend.php class no longer exists. 55 58 * 56 * This function tries to detect whether Zend_ Versionexists59 * This function tries to detect whether Zend_Loader exists 57 60 * and returns its path if yes. 58 61 * If the first step fails, the class will try to find Zend.php library 59 62 * available in ZF <= 0.9.0 and returns its path if its exists. 60 * 61 * If neither Zend/ Version.php nor Zend.php exists,63 * 64 * If neither Zend/Loader.php nor Zend.php exists, 62 65 * then this function will raise a sfAutoloadException exception. 63 66 * … … 72 75 $base = sfConfig::get('sf_zend_lib_dir') ? sfConfig::get('sf_zend_lib_dir').'/' : ''; 73 76 74 // first check whether Zend/ Version.php exists75 // Zend/ Version.php is available starting from ZF 0.9.077 // first check whether Zend/Loader.php exists 78 // Zend/Loader.php is available starting from ZF 0.9.0 76 79 // Before ZF 0.9.0 you should call Zend.php 77 80 // Plese note that Zend.php is still available in ZF 0.9.0 78 81 // but it should not be called because deprecated 79 if (file_exists($base.'Zend/ Version.php'))82 if (file_exists($base.'Zend/Loader.php')) 80 83 { 81 require_once($base.'Zend/Version.php'); 84 require_once($base.'Zend/Loader.php'); 85 self::$withLoader = true; 82 86 } 83 87 else if (file_exists($base.'Zend.php')) 84 88 { 85 89 require_once($base.'Zend.php'); 90 self::$withLoader = false; 86 91 } 87 92 else 88 93 { 89 throw new sfAutoloadException('Invalid Zend Framework library structure, unable to find Zend/ Version.php (ZF >= 0.9.0) or Zend.php (ZF < 0.9.0) library');94 throw new sfAutoloadException('Invalid Zend Framework library structure, unable to find Zend/Loader.php (ZF >= 0.9.0) or Zend.php (ZF < 0.9.0) library'); 90 95 } 91 96 }