Development

Changeset 4752

You must first sign up to be able to contribute.

Changeset 4752

Show
Ignore:
Timestamp:
07/31/07 10:58:33 (1 year ago)
Author:
fabien
Message:

fixed sfZendPlugin is broken (closes #1941)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/addon/bridge/sfZendFrameworkBridge.class.php

    r3862 r4752  
    1212{ 
    1313  set_include_path(sfConfig::get('sf_zend_lib_dir').PATH_SEPARATOR.get_include_path()); 
    14   require_once(sfConfig::get('sf_zend_lib_dir').'/Zend.php'); 
    15 } 
    16 else 
    17 { 
    18   require_once('Zend.php'); 
    1914} 
    2015 
     16sfZendFrameworkBridge::requireZendLoader(); 
     17 
    2118/** 
    22  * This class makes easy to use Zend Framework classes within symfony 
     19 * This class makes easy to use Zend Framework classes within symfony. 
    2320 * 
    2421 * @package    symfony 
     
    4946    return true; 
    5047  } 
     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  } 
    5192}