web/lib/Zend/Loader/PluginLoader.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Loader
    16  * @package    Zend_Loader
    17  * @subpackage PluginLoader
    17  * @subpackage PluginLoader
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: PluginLoader.php 22603 2010-07-17 00:02:10Z ramon $
    20  * @version    $Id: PluginLoader.php 24877 2012-06-04 14:04:53Z adamlundrigan $
    21  */
    21  */
    22 
    22 
    23 /** Zend_Loader_PluginLoader_Interface */
    23 /** Zend_Loader_PluginLoader_Interface */
    24 require_once 'Zend/Loader/PluginLoader/Interface.php';
    24 require_once 'Zend/Loader/PluginLoader/Interface.php';
    25 
    25 
    30  * Generic plugin class loader
    30  * Generic plugin class loader
    31  *
    31  *
    32  * @category   Zend
    32  * @category   Zend
    33  * @package    Zend_Loader
    33  * @package    Zend_Loader
    34  * @subpackage PluginLoader
    34  * @subpackage PluginLoader
    35  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    35  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    36  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    36  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    37  */
    37  */
    38 class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
    38 class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface
    39 {
    39 {
    40     /**
    40     /**
   125     {
   125     {
   126         if($prefix == "") {
   126         if($prefix == "") {
   127             return $prefix;
   127             return $prefix;
   128         }
   128         }
   129 
   129 
   130         $last = strlen($prefix) - 1;
   130         $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_';
   131         if ($prefix{$last} == '\\') {
   131         return rtrim($prefix, $nsSeparator) . $nsSeparator;
   132             return $prefix;
       
   133         }
       
   134 
       
   135         return rtrim($prefix, '_') . '_';
       
   136     }
   132     }
   137 
   133 
   138     /**
   134     /**
   139      * Add prefixed paths to the registry of paths
   135      * Add prefixed paths to the registry of paths
   140      *
   136      *
   370             $registry = $this->_prefixToPaths;
   366             $registry = $this->_prefixToPaths;
   371         }
   367         }
   372 
   368 
   373         $registry  = array_reverse($registry, true);
   369         $registry  = array_reverse($registry, true);
   374         $found     = false;
   370         $found     = false;
   375         $classFile = str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php';
   371         if (false !== strpos($name, '\\')) {
       
   372             $classFile = str_replace('\\', DIRECTORY_SEPARATOR, $name) . '.php';
       
   373         } else {
       
   374             $classFile = str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php';
       
   375         }
   376         $incFile   = self::getIncludeFileCache();
   376         $incFile   = self::getIncludeFileCache();
   377         foreach ($registry as $prefix => $paths) {
   377         foreach ($registry as $prefix => $paths) {
   378             $className = $prefix . $name;
   378             $className = $prefix . $name;
   379 
   379 
   380             if (class_exists($className, false)) {
   380             if (class_exists($className, false)) {