| | 48 | |
|---|
| | 49 | /** |
|---|
| | 50 | * Detect and return the path to current Zend loader class. |
|---|
| | 51 | * |
|---|
| | 52 | * Starting from ZF 0.9.0 autoloading function has been moved |
|---|
| | 53 | * from Zend.php to Zend/Version.php class. |
|---|
| | 54 | * Starting from ZF 1.0.0 Zend.php class no longer exists. |
|---|
| | 55 | * |
|---|
| | 56 | * This function tries to detect whether Zend_Version exists |
|---|
| | 57 | * and returns its path if yes. |
|---|
| | 58 | * If the first step fails, the class will try to find Zend.php library |
|---|
| | 59 | * available in ZF <= 0.9.0 and returns its path if its exists. |
|---|
| | 60 | * |
|---|
| | 61 | * If neither Zend/Version.php nor Zend.php exists, |
|---|
| | 62 | * then this function will raise a sfAutoloadException exception. |
|---|
| | 63 | * |
|---|
| | 64 | * @return string Path to default Zend Loader class |
|---|
| | 65 | * @throws sfAutoloadException |
|---|
| | 66 | * |
|---|
| | 67 | * @author Simone Carletti <weppos@weppos.net> |
|---|
| | 68 | */ |
|---|
| | 69 | public static function requireZendLoader() |
|---|
| | 70 | { |
|---|
| | 71 | // get base path according to sf setting |
|---|
| | 72 | $base = sfConfig::get('sf_zend_lib_dir') ? sfConfig::get('sf_zend_lib_dir').'/' : ''; |
|---|
| | 73 | |
|---|
| | 74 | // first check whether Zend/Version.php exists |
|---|
| | 75 | // Zend/Version.php is available starting from ZF 0.9.0 |
|---|
| | 76 | // Before ZF 0.9.0 you should call Zend.php |
|---|
| | 77 | // Plese note that Zend.php is still available in ZF 0.9.0 |
|---|
| | 78 | // but it should not be called because deprecated |
|---|
| | 79 | if (file_exists($base.'Zend/Version.php')) |
|---|
| | 80 | { |
|---|
| | 81 | require_once($base.'Zend/Version.php'); |
|---|
| | 82 | } |
|---|
| | 83 | else if (file_exists($base.'Zend.php')) |
|---|
| | 84 | { |
|---|
| | 85 | require_once($base.'Zend.php'); |
|---|
| | 86 | } |
|---|
| | 87 | else |
|---|
| | 88 | { |
|---|
| | 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'); |
|---|
| | 90 | } |
|---|
| | 91 | } |
|---|