Explorar o código

ZF-2533: use autoloading to check for classes before falling back to Zend_Loader
Also addresses: ZF-6016, ZF-6417, ZF-4167, ZF-6495, ZF-6611

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@15576 44c647ce-9c0f-0410-b52a-842ac1e357ba

matthew %!s(int64=16) %!d(string=hai) anos
pai
achega
f9cc0a68fd
Modificáronse 41 ficheiros con 274 adicións e 230 borrados
  1. 1 0
      library/Zend/Amf/Adobe/Introspector.php
  2. 9 7
      library/Zend/Amf/Server.php
  3. 2 1
      library/Zend/Captcha/Word.php
  4. 12 3
      library/Zend/Controller/Front.php
  5. 5 5
      library/Zend/Controller/Router/Rewrite.php
  6. 4 7
      library/Zend/Db.php
  7. 4 7
      library/Zend/Db/Adapter/Abstract.php
  8. 4 6
      library/Zend/Db/Adapter/Db2.php
  9. 4 6
      library/Zend/Db/Adapter/Mysqli.php
  10. 4 6
      library/Zend/Db/Adapter/Oracle.php
  11. 4 7
      library/Zend/Db/Adapter/Pdo/Abstract.php
  12. 12 3
      library/Zend/Db/Table/Abstract.php
  13. 60 41
      library/Zend/Db/Table/Row/Abstract.php
  14. 4 6
      library/Zend/Db/Table/Rowset/Abstract.php
  15. 9 11
      library/Zend/Feed.php
  16. 5 1
      library/Zend/File/Transfer.php
  17. 7 4
      library/Zend/Filter.php
  18. 4 1
      library/Zend/Filter/Encrypt.php
  19. 5 2
      library/Zend/Gdata/App.php
  20. 5 3
      library/Zend/Gdata/Gapps.php
  21. 9 6
      library/Zend/Http/Client.php
  22. 4 7
      library/Zend/InfoCard/Xml/Element.php
  23. 4 6
      library/Zend/InfoCard/Xml/Security/Transform.php
  24. 8 4
      library/Zend/Layout.php
  25. 4 6
      library/Zend/Mail/Transport/Smtp.php
  26. 5 3
      library/Zend/Navigation/Page.php
  27. 1 3
      library/Zend/Reflection/Docblock/Tag.php
  28. 4 2
      library/Zend/Registry.php
  29. 4 3
      library/Zend/Service/Amazon/Ec2.php
  30. 4 6
      library/Zend/Service/Nirvanix.php
  31. 4 7
      library/Zend/Service/StrikeIron.php
  32. 4 8
      library/Zend/Session.php
  33. 4 7
      library/Zend/TimeSync.php
  34. 6 2
      library/Zend/Tool/Framework/Client/Console.php
  35. 5 3
      library/Zend/Tool/Project/Context/Repository.php
  36. 4 1
      library/Zend/Translate.php
  37. 4 6
      library/Zend/Uri.php
  38. 11 11
      library/Zend/Validate.php
  39. 4 2
      library/Zend/View/Helper/Placeholder/Registry.php
  40. 10 4
      library/Zend/Wildfire/Channel/HttpHeaders.php
  41. 7 6
      library/Zend/Wildfire/Plugin/FirePhp.php

+ 1 - 0
library/Zend/Amf/Adobe/Introspector.php

@@ -91,6 +91,7 @@ class Zend_Amf_Adobe_Introspector
 
 
         // Introspect!
         // Introspect!
         if (!class_exists($serviceClass)) {
         if (!class_exists($serviceClass)) {
+            require_once 'Zend/Loader.php';
             Zend_Loader::loadClass($serviceClass, $this->_getServicePath());
             Zend_Loader::loadClass($serviceClass, $this->_getServicePath());
         }
         }
         
         

+ 9 - 7
library/Zend/Amf/Server.php

@@ -178,12 +178,14 @@ class Zend_Amf_Server implements Zend_Server_Interface
                     $classPath[] = $dir . $uriclasspath;
                     $classPath[] = $dir . $uriclasspath;
                 }
                 }
 
 
-                require_once('Zend/Loader.php');
-                try {
-                    Zend_Loader::loadClass($className, $classPath);
-                } catch (Exception $e) {
-                    require_once 'Zend/Amf/Server/Exception.php';
-                    throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist');
+                if (!class_exists($className)) {
+                    try {
+                        require_once 'Zend/Loader.php';
+                        Zend_Loader::loadClass($className, $classPath);
+                    } catch (Exception $e) {
+                        require_once 'Zend/Amf/Server/Exception.php';
+                        throw new Zend_Amf_Server_Exception('Class "' . $className . '" does not exist');
+                    }
                 }
                 }
                 // Add the new loaded class to the server.
                 // Add the new loaded class to the server.
                 $this->setClass($className, $source);
                 $this->setClass($className, $source);
@@ -699,4 +701,4 @@ class Zend_Amf_Server implements Zend_Server_Interface
     {
     {
         return array_keys($this->_table);
         return array_keys($this->_table);
     }
     }
-}
+}

+ 2 - 1
library/Zend/Captcha/Word.php

@@ -220,7 +220,8 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
     {
     {
         if (!isset($this->_session) || (null === $this->_session)) {
         if (!isset($this->_session) || (null === $this->_session)) {
             $id = $this->getId();
             $id = $this->getId();
-            if(!class_exists($this->_sessionClass, false)) {
+            if (!class_exists($this->_sessionClass)) {
+                require_once 'Zend/Loader.php';
                 Zend_Loader::loadClass($this->_sessionClass);
                 Zend_Loader::loadClass($this->_sessionClass);
             }
             }
             $this->_session = new $this->_sessionClass('Zend_Form_Captcha_' . $id);
             $this->_session = new $this->_sessionClass('Zend_Form_Captcha_' . $id);

+ 12 - 3
library/Zend/Controller/Front.php

@@ -442,7 +442,10 @@ class Zend_Controller_Front
     public function setRequest($request)
     public function setRequest($request)
     {
     {
         if (is_string($request)) {
         if (is_string($request)) {
-            Zend_Loader::loadClass($request);
+            if (!class_exists($request)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($request);
+            }
             $request = new $request();
             $request = new $request();
         }
         }
         if (!$request instanceof Zend_Controller_Request_Abstract) {
         if (!$request instanceof Zend_Controller_Request_Abstract) {
@@ -481,7 +484,10 @@ class Zend_Controller_Front
     public function setRouter($router)
     public function setRouter($router)
     {
     {
         if (is_string($router)) {
         if (is_string($router)) {
-            Zend_Loader::loadClass($router);
+            if (!class_exists($router)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($router);
+            }
             $router = new $router();
             $router = new $router();
         }
         }
 
 
@@ -610,7 +616,10 @@ class Zend_Controller_Front
     public function setResponse($response)
     public function setResponse($response)
     {
     {
         if (is_string($response)) {
         if (is_string($response)) {
-            Zend_Loader::loadClass($response);
+            if (!class_exists($response)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($response);
+            }
             $response = new $response();
             $response = new $response();
         }
         }
         if (!$response instanceof Zend_Controller_Response_Abstract) {
         if (!$response instanceof Zend_Controller_Response_Abstract) {

+ 5 - 5
library/Zend/Controller/Router/Rewrite.php

@@ -19,9 +19,6 @@
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
  */
 
 
-/** Zend_Loader */
-require_once 'Zend/Loader.php';
-
 /** Zend_Controller_Router_Abstract */
 /** Zend_Controller_Router_Abstract */
 require_once 'Zend/Controller/Router/Abstract.php';
 require_once 'Zend/Controller/Router/Abstract.php';
 
 
@@ -197,7 +194,10 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
     protected function _getRouteFromConfig(Zend_Config $info)
     protected function _getRouteFromConfig(Zend_Config $info)
     {
     {
         $class = (isset($info->type)) ? $info->type : 'Zend_Controller_Router_Route';
         $class = (isset($info->type)) ? $info->type : 'Zend_Controller_Router_Route';
-        Zend_Loader::loadClass($class);
+        if (!class_exists($class)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($class);
+        }
               
               
         $route = call_user_func(array($class, 'getInstance'), $info);
         $route = call_user_func(array($class, 'getInstance'), $info);
         
         
@@ -452,4 +452,4 @@ class Zend_Controller_Router_Rewrite extends Zend_Controller_Router_Abstract
     
     
         return $this;
         return $this;
     }
     }
-}
+}

+ 4 - 7
library/Zend/Db.php

@@ -22,12 +22,6 @@
 
 
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-
-/**
  * Class for connecting to SQL databases and performing common operations.
  * Class for connecting to SQL databases and performing common operations.
  *
  *
  * @category   Zend
  * @category   Zend
@@ -254,7 +248,10 @@ class Zend_Db
          * Load the adapter class.  This throws an exception
          * Load the adapter class.  This throws an exception
          * if the specified class cannot be loaded.
          * if the specified class cannot be loaded.
          */
          */
-        Zend_Loader::loadClass($adapterName);
+        if (!class_exists($adapterName)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($adapterName);
+        }
 
 
         /*
         /*
          * Create an instance of the adapter class.
          * Create an instance of the adapter class.

+ 4 - 7
library/Zend/Db/Adapter/Abstract.php

@@ -32,12 +32,6 @@ require_once 'Zend/Db.php';
 require_once 'Zend/Db/Select.php';
 require_once 'Zend/Db/Select.php';
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-
-/**
  * Class for connecting to SQL databases and performing common operations.
  * Class for connecting to SQL databases and performing common operations.
  *
  *
  * @category   Zend
  * @category   Zend
@@ -381,7 +375,10 @@ abstract class Zend_Db_Adapter_Abstract
         }
         }
 
 
         if ($profilerInstance === null) {
         if ($profilerInstance === null) {
-            Zend_Loader::loadClass($profilerClass);
+            if (!class_exists($profilerClass)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($profilerClass);
+            }
             $profilerInstance = new $profilerClass();
             $profilerInstance = new $profilerClass();
         }
         }
 
 

+ 4 - 6
library/Zend/Db/Adapter/Db2.php

@@ -30,11 +30,6 @@ require_once 'Zend/Db.php';
 require_once 'Zend/Db/Adapter/Abstract.php';
 require_once 'Zend/Db/Adapter/Abstract.php';
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * @see Zend_Db_Statement_Db2
  * @see Zend_Db_Statement_Db2
  */
  */
 require_once 'Zend/Db/Statement/Db2.php';
 require_once 'Zend/Db/Statement/Db2.php';
@@ -226,7 +221,10 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
     {
     {
         $this->_connect();
         $this->_connect();
         $stmtClass = $this->_defaultStmtClass;
         $stmtClass = $this->_defaultStmtClass;
-        Zend_Loader::loadClass($stmtClass);
+        if (!class_exists($stmtClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($stmtClass);
+        }
         $stmt = new $stmtClass($this, $sql);
         $stmt = new $stmtClass($this, $sql);
         $stmt->setFetchMode($this->_fetchMode);
         $stmt->setFetchMode($this->_fetchMode);
         return $stmt;
         return $stmt;

+ 4 - 6
library/Zend/Db/Adapter/Mysqli.php

@@ -22,11 +22,6 @@
 
 
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * @see Zend_Db_Adapter_Abstract
  * @see Zend_Db_Adapter_Abstract
  */
  */
 require_once 'Zend/Db/Adapter/Abstract.php';
 require_once 'Zend/Db/Adapter/Abstract.php';
@@ -377,7 +372,10 @@ class Zend_Db_Adapter_Mysqli extends Zend_Db_Adapter_Abstract
             $this->_stmt->close();
             $this->_stmt->close();
         }
         }
         $stmtClass = $this->_defaultStmtClass;
         $stmtClass = $this->_defaultStmtClass;
-        Zend_Loader::loadClass($stmtClass);
+        if (!class_exists($stmtClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($stmtClass);
+        }
         $stmt = new $stmtClass($this, $sql);
         $stmt = new $stmtClass($this, $sql);
         if ($stmt === false) {
         if ($stmt === false) {
             return false;
             return false;

+ 4 - 6
library/Zend/Db/Adapter/Oracle.php

@@ -20,11 +20,6 @@
  */
  */
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * @see Zend_Db_Adapter_Abstract
  * @see Zend_Db_Adapter_Abstract
  */
  */
 require_once 'Zend/Db/Adapter/Abstract.php';
 require_once 'Zend/Db/Adapter/Abstract.php';
@@ -203,7 +198,10 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
     {
     {
         $this->_connect();
         $this->_connect();
         $stmtClass = $this->_defaultStmtClass;
         $stmtClass = $this->_defaultStmtClass;
-        Zend_Loader::loadClass($stmtClass);
+        if (!class_exists($stmtClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($stmtClass);
+        }
         $stmt = new $stmtClass($this, $sql);
         $stmt = new $stmtClass($this, $sql);
         if ($stmt instanceof Zend_Db_Statement_Oracle) {
         if ($stmt instanceof Zend_Db_Statement_Oracle) {
             $stmt->setLobAsString($this->getLobAsString());
             $stmt->setLobAsString($this->getLobAsString());

+ 4 - 7
library/Zend/Db/Adapter/Pdo/Abstract.php

@@ -28,12 +28,6 @@ require_once 'Zend/Db/Adapter/Abstract.php';
 
 
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-
-/**
  * @see Zend_Db_Statement_Pdo
  * @see Zend_Db_Statement_Pdo
  */
  */
 require_once 'Zend/Db/Statement/Pdo.php';
 require_once 'Zend/Db/Statement/Pdo.php';
@@ -177,7 +171,10 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
     {
     {
         $this->_connect();
         $this->_connect();
         $stmtClass = $this->_defaultStmtClass;
         $stmtClass = $this->_defaultStmtClass;
-        Zend_Loader::loadClass($stmtClass);
+        if (!class_exists($stmtClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($stmtClass);
+        }
         $stmt = new $stmtClass($this, $sql);
         $stmt = new $stmtClass($this, $sql);
         $stmt->setFetchMode($this->_fetchMode);
         $stmt->setFetchMode($this->_fetchMode);
         return $stmt;
         return $stmt;

+ 12 - 3
library/Zend/Db/Table/Abstract.php

@@ -1219,7 +1219,10 @@ abstract class Zend_Db_Table_Abstract
             'stored'   => true
             'stored'   => true
         );
         );
 
 
-        Zend_Loader::loadClass($this->_rowsetClass);
+        if (!class_exists($this->_rowsetClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($this->_rowsetClass);
+        }
         return new $this->_rowsetClass($data);
         return new $this->_rowsetClass($data);
     }
     }
 
 
@@ -1264,7 +1267,10 @@ abstract class Zend_Db_Table_Abstract
             'stored'  => true
             'stored'  => true
         );
         );
 
 
-        Zend_Loader::loadClass($this->_rowClass);
+        if (!class_exists($this->_rowClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($this->_rowClass);
+        }
         return new $this->_rowClass($data);
         return new $this->_rowClass($data);
     }
     }
 
 
@@ -1323,7 +1329,10 @@ abstract class Zend_Db_Table_Abstract
             'stored'   => false
             'stored'   => false
         );
         );
 
 
-        Zend_Loader::loadClass($this->_rowClass);
+        if (!class_exists($this->_rowClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($this->_rowClass);
+        }
         $row = new $this->_rowClass($config);
         $row = new $this->_rowClass($config);
         $row->setFromArray($data);
         $row->setFromArray($data);
         return $row;
         return $row;

+ 60 - 41
library/Zend/Db/Table/Row/Abstract.php

@@ -26,11 +26,6 @@
 require_once 'Zend/Db.php';
 require_once 'Zend/Db.php';
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * @category   Zend
  * @category   Zend
  * @package    Zend_Db
  * @package    Zend_Db
  * @subpackage Table
  * @subpackage Table
@@ -122,7 +117,10 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
             $this->_table = $config['table'];
             $this->_table = $config['table'];
             $this->_tableClass = get_class($this->_table);
             $this->_tableClass = get_class($this->_table);
         } else if ($this->_tableClass !== null) {
         } else if ($this->_tableClass !== null) {
-            Zend_Loader::loadClass($this->_tableClass);
+            if (!class_exists($this->_tableClass)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($this->_tableClass);
+            }
             $this->_table = new $this->_tableClass();
             $this->_table = new $this->_tableClass();
         }
         }
 
 
@@ -551,11 +549,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
                 $pkNew = $this->_getPrimaryKey(true);
                 $pkNew = $this->_getPrimaryKey(true);
                 $pkOld = $this->_getPrimaryKey(false);
                 $pkOld = $this->_getPrimaryKey(false);
                 foreach ($depTables as $tableClass) {
                 foreach ($depTables as $tableClass) {
-                    try {
-                        Zend_Loader::loadClass($tableClass);
-                    } catch (Zend_Exception $e) {
-                        require_once 'Zend/Db/Table/Row/Exception.php';
-                        throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                    if (!class_exists($tableClass)) {
+                        try {
+                            require_once 'Zend/Loader.php';
+                            Zend_Loader::loadClass($tableClass);
+                        } catch (Zend_Exception $e) {
+                            require_once 'Zend/Db/Table/Row/Exception.php';
+                            throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                        }
                     }
                     }
                     $t = new $tableClass(array('db' => $db));
                     $t = new $tableClass(array('db' => $db));
                     $t->_cascadeUpdate($this->getTableClass(), $pkOld, $pkNew);
                     $t->_cascadeUpdate($this->getTableClass(), $pkOld, $pkNew);
@@ -629,11 +630,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
             $db = $this->_getTable()->getAdapter();
             $db = $this->_getTable()->getAdapter();
             $pk = $this->_getPrimaryKey();
             $pk = $this->_getPrimaryKey();
             foreach ($depTables as $tableClass) {
             foreach ($depTables as $tableClass) {
-                try {
-                    Zend_Loader::loadClass($tableClass);
-                } catch (Zend_Exception $e) {
-                    require_once 'Zend/Db/Table/Row/Exception.php';
-                    throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                if (!class_exists($tableClass)) {
+                    try {
+                        require_once 'Zend/Loader.php';
+                        Zend_Loader::loadClass($tableClass);
+                    } catch (Zend_Exception $e) {
+                        require_once 'Zend/Db/Table/Row/Exception.php';
+                        throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                    }
                 }
                 }
                 $t = new $tableClass(array('db' => $db));
                 $t = new $tableClass(array('db' => $db));
                 $t->_cascadeDelete($this->getTableClass(), $pk);
                 $t->_cascadeDelete($this->getTableClass(), $pk);
@@ -882,11 +886,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
         $db = $this->_getTable()->getAdapter();
         $db = $this->_getTable()->getAdapter();
 
 
         if (is_string($dependentTable)) {
         if (is_string($dependentTable)) {
-            try {;
-                Zend_Loader::loadClass($dependentTable);
-            } catch (Zend_Exception $e) {
-                require_once 'Zend/Db/Table/Row/Exception.php';
-                throw new Zend_Db_Table_Row_Exception($e->getMessage());
+            if (!class_exists($dependentTable)) {
+                try {
+                    require_once 'Zend/Loader.php';
+                    Zend_Loader::loadClass($dependentTable);
+                } catch (Zend_Exception $e) {
+                    require_once 'Zend/Db/Table/Row/Exception.php';
+                    throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                }
             }
             }
             $dependentTable = new $dependentTable(array('db' => $db));
             $dependentTable = new $dependentTable(array('db' => $db));
         }
         }
@@ -936,11 +943,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
         $db = $this->_getTable()->getAdapter();
         $db = $this->_getTable()->getAdapter();
 
 
         if (is_string($parentTable)) {
         if (is_string($parentTable)) {
-            try {
-                Zend_Loader::loadClass($parentTable);
-            } catch (Zend_Exception $e) {
-                require_once 'Zend/Db/Table/Row/Exception.php';
-                throw new Zend_Db_Table_Row_Exception($e->getMessage());
+            if (!class_exists($parentTable)) {
+                try {
+                    require_once 'Zend/Loader.php';
+                    Zend_Loader::loadClass($parentTable);
+                } catch (Zend_Exception $e) {
+                    require_once 'Zend/Db/Table/Row/Exception.php';
+                    throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                }
             }
             }
             $parentTable = new $parentTable(array('db' => $db));
             $parentTable = new $parentTable(array('db' => $db));
         }
         }
@@ -991,11 +1001,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
         $db = $this->_getTable()->getAdapter();
         $db = $this->_getTable()->getAdapter();
 
 
         if (is_string($intersectionTable)) {
         if (is_string($intersectionTable)) {
-            try {
-                Zend_Loader::loadClass($intersectionTable);
-            } catch (Zend_Exception $e) {
-                require_once 'Zend/Db/Table/Row/Exception.php';
-                throw new Zend_Db_Table_Row_Exception($e->getMessage());
+            if (!class_exists($intersectionTable)) {
+                try {
+                    require_once 'Zend/Loader.php';
+                    Zend_Loader::loadClass($intersectionTable);
+                } catch (Zend_Exception $e) {
+                    require_once 'Zend/Db/Table/Row/Exception.php';
+                    throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                }
             }
             }
             $intersectionTable = new $intersectionTable(array('db' => $db));
             $intersectionTable = new $intersectionTable(array('db' => $db));
         }
         }
@@ -1009,11 +1022,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
         }
         }
 
 
         if (is_string($matchTable)) {
         if (is_string($matchTable)) {
-            try {
-                Zend_Loader::loadClass($matchTable);
-            } catch (Zend_Exception $e) {
-                require_once 'Zend/Db/Table/Row/Exception.php';
-                throw new Zend_Db_Table_Row_Exception($e->getMessage());
+            if (!class_exists($matchTable)) {
+                try {
+                    require_once 'Zend/Loader.php';
+                    Zend_Loader::loadClass($matchTable);
+                } catch (Zend_Exception $e) {
+                    require_once 'Zend/Db/Table/Row/Exception.php';
+                    throw new Zend_Db_Table_Row_Exception($e->getMessage());
+                }
             }
             }
             $matchTable = new $matchTable(array('db' => $db));
             $matchTable = new $matchTable(array('db' => $db));
         }
         }
@@ -1077,11 +1093,14 @@ abstract class Zend_Db_Table_Row_Abstract implements ArrayAccess
         );
         );
 
 
         $rowsetClass = $matchTable->getRowsetClass();
         $rowsetClass = $matchTable->getRowsetClass();
-        try {
-            Zend_Loader::loadClass($rowsetClass);
-        } catch (Zend_Exception $e) {
-            require_once 'Zend/Db/Table/Row/Exception.php';
-            throw new Zend_Db_Table_Row_Exception($e->getMessage());
+        if (!class_exists($rowsetClass)) {
+            try {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($rowsetClass);
+            } catch (Zend_Exception $e) {
+                require_once 'Zend/Db/Table/Row/Exception.php';
+                throw new Zend_Db_Table_Row_Exception($e->getMessage());
+            }
         }
         }
         $rowset = new $rowsetClass($config);
         $rowset = new $rowsetClass($config);
         return $rowset;
         return $rowset;

+ 4 - 6
library/Zend/Db/Table/Rowset/Abstract.php

@@ -21,11 +21,6 @@
  */
  */
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * @category   Zend
  * @category   Zend
  * @package    Zend_Db
  * @package    Zend_Db
  * @subpackage Table
  * @subpackage Table
@@ -116,7 +111,10 @@ abstract class Zend_Db_Table_Rowset_Abstract implements SeekableIterator, Counta
         if (isset($config['rowClass'])) {
         if (isset($config['rowClass'])) {
             $this->_rowClass   = $config['rowClass'];
             $this->_rowClass   = $config['rowClass'];
         }
         }
-        Zend_Loader::loadClass($this->_rowClass);
+        if (!class_exists($this->_rowClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($this->_rowClass);
+        }
         if (isset($config['data'])) {
         if (isset($config['data'])) {
             $this->_data       = $config['data'];
             $this->_data       = $config['data'];
         }
         }

+ 9 - 11
library/Zend/Feed.php

@@ -373,11 +373,11 @@ class Zend_Feed
     public static function importArray(array $data, $format = 'atom')
     public static function importArray(array $data, $format = 'atom')
     {
     {
         $obj = 'Zend_Feed_' . ucfirst(strtolower($format));
         $obj = 'Zend_Feed_' . ucfirst(strtolower($format));
-        /**
-         * @see Zend_Loader
-         */
-        require_once 'Zend/Loader.php';
-        Zend_Loader::loadClass($obj);
+        if (!class_exists($obj)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($obj);
+        }
+
         /**
         /**
          * @see Zend_Feed_Builder
          * @see Zend_Feed_Builder
          */
          */
@@ -395,12 +395,10 @@ class Zend_Feed
     public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom')
     public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom')
     {
     {
         $obj = 'Zend_Feed_' . ucfirst(strtolower($format));
         $obj = 'Zend_Feed_' . ucfirst(strtolower($format));
-        /**
-         * @see Zend_Loader
-         */
-        require_once 'Zend/Loader.php';
-        Zend_Loader::loadClass($obj);
-
+        if (!class_exists($obj)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($obj);
+        }
         return new $obj(null, null, $builder);
         return new $obj(null, null, $builder);
     }
     }
 }
 }

+ 5 - 1
library/Zend/File/Transfer.php

@@ -45,7 +45,11 @@ class Zend_File_Transfer
                 break;
                 break;
         }
         }
         
         
-        Zend_Loader::loadClass($adapter);
+        if (!class_exists($adapter)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($adapter);
+        }
+
         $this->_adapter = new $adapter();
         $this->_adapter = new $adapter();
         if (!$this->_adapter instanceof Zend_File_Transfer_Adapter) {
         if (!$this->_adapter instanceof Zend_File_Transfer_Adapter) {
             require_once 'Zend/File/Transfer/Exception.php';
             require_once 'Zend/File/Transfer/Exception.php';

+ 7 - 4
library/Zend/Filter.php

@@ -91,10 +91,13 @@ class Zend_Filter implements Zend_Filter_Interface
         $namespaces = array_merge((array) $namespaces, array('Zend_Filter'));
         $namespaces = array_merge((array) $namespaces, array('Zend_Filter'));
         foreach ($namespaces as $namespace) {
         foreach ($namespaces as $namespace) {
             $className = $namespace . '_' . ucfirst($classBaseName);
             $className = $namespace . '_' . ucfirst($classBaseName);
-            try {
-                Zend_Loader::loadClass($className);
-            } catch (Zend_Exception $ze) {
-                continue;
+            if (!class_exists($className)) {
+                try {
+                    require_once 'Zend/Loader.php';
+                    Zend_Loader::loadClass($className);
+                } catch (Zend_Exception $ze) {
+                    continue;
+                }
             }
             }
             $class = new ReflectionClass($className);
             $class = new ReflectionClass($className);
             if ($class->implementsInterface('Zend_Filter_Interface')) {
             if ($class->implementsInterface('Zend_Filter_Interface')) {

+ 4 - 1
library/Zend/Filter/Encrypt.php

@@ -89,7 +89,10 @@ class Zend_Filter_Encrypt implements Zend_Filter_Interface
             $adapter = 'Zend_Filter_Encrypt_' . ucfirst($adapter);
             $adapter = 'Zend_Filter_Encrypt_' . ucfirst($adapter);
         }
         }
 
 
-        Zend_Loader::loadClass($adapter);
+        if (!class_exists($adapter)) {
+            Zend_Loader::loadClass($adapter);
+        }
+
         $this->_adapter = new $adapter($options);
         $this->_adapter = new $adapter($options);
         if (!$this->_adapter instanceof Zend_Filter_Encrypt_Interface) {
         if (!$this->_adapter instanceof Zend_Filter_Encrypt_Interface) {
             require_once 'Zend/Filter/Exception.php';
             require_once 'Zend/Filter/Exception.php';

+ 5 - 2
library/Zend/Gdata/App.php

@@ -1020,8 +1020,11 @@ class Zend_Gdata_App
             $foundClassName = null;
             $foundClassName = null;
             foreach ($this->_registeredPackages as $name) {
             foreach ($this->_registeredPackages as $name) {
                  try {
                  try {
-                     @Zend_Loader::loadClass("${name}_${class}");
-                     $foundClassName = "${name}_${class}";
+                     if (!class_exists($name . '_' . $class)) {
+                        require_once 'Zend/Loader.php';
+                        @Zend_Loader::loadClass($name . '_' . $class);
+                     }
+                     $foundClassName = $name . '_' . $class;
                      break;
                      break;
                  } catch (Zend_Exception $e) {
                  } catch (Zend_Exception $e) {
                      // package wasn't here- continue searching
                      // package wasn't here- continue searching

+ 5 - 3
library/Zend/Gdata/Gapps.php

@@ -624,9 +624,11 @@ class Zend_Gdata_Gapps extends Zend_Gdata
             $foundClassName = null;
             $foundClassName = null;
             foreach ($this->_registeredPackages as $name) {
             foreach ($this->_registeredPackages as $name) {
                  try {
                  try {
-                     require_once 'Zend/Loader.php';
-                     @Zend_Loader::loadClass("${name}_${class}");
-                     $foundClassName = "${name}_${class}";
+                     if (!class_exists($name . '_' . $class)) {
+                        require_once 'Zend/Loader.php';
+                        @Zend_Loader::loadClass($name . '_' . $class);
+                     }
+                     $foundClassName = $name . '_' . $class;
                      break;
                      break;
                  } catch (Zend_Exception $e) {
                  } catch (Zend_Exception $e) {
                      // package wasn't here- continue searching
                      // package wasn't here- continue searching

+ 9 - 6
library/Zend/Http/Client.php

@@ -792,12 +792,15 @@ class Zend_Http_Client
     public function setAdapter($adapter)
     public function setAdapter($adapter)
     {
     {
         if (is_string($adapter)) {
         if (is_string($adapter)) {
-            try {
-                Zend_Loader::loadClass($adapter);
-            } catch (Zend_Exception $e) {
-                /** @see Zend_Http_Client_Exception */
-                require_once 'Zend/Http/Client/Exception.php';
-                throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}");
+            if (!class_exists($adapter)) {
+                try {
+                    require_once 'Zend/Loader.php';
+                    Zend_Loader::loadClass($adapter);
+                } catch (Zend_Exception $e) {
+                    /** @see Zend_Http_Client_Exception */
+                    require_once 'Zend/Http/Client/Exception.php';
+                    throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}");
+                }
             }
             }
 
 
             $adapter = new $adapter;
             $adapter = new $adapter;

+ 4 - 7
library/Zend/InfoCard/Xml/Element.php

@@ -26,11 +26,6 @@
 require_once 'Zend/InfoCard/Xml/Element/Interface.php';
 require_once 'Zend/InfoCard/Xml/Element/Interface.php';
 
 
 /**
 /**
- * Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * An abstract class representing a an XML data block
  * An abstract class representing a an XML data block
  *
  *
  * @category   Zend
  * @category   Zend
@@ -85,8 +80,10 @@ abstract class Zend_InfoCard_Xml_Element
      */
      */
     static public function convertToObject(DOMElement $e, $classname)
     static public function convertToObject(DOMElement $e, $classname)
     {
     {
-
-        Zend_Loader::loadClass($classname);
+        if (!class_exists($classname)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($classname);
+        }
 
 
         $reflection = new ReflectionClass($classname);
         $reflection = new ReflectionClass($classname);
 
 

+ 4 - 6
library/Zend/InfoCard/Xml/Security/Transform.php

@@ -21,11 +21,6 @@
  */
  */
 
 
 /**
 /**
- * Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * A class to create a transform rule set based on XML URIs and then apply those rules
  * A class to create a transform rule set based on XML URIs and then apply those rules
  * in the correct order to a given XML input
  * in the correct order to a given XML input
  *
  *
@@ -98,7 +93,10 @@ class Zend_InfoCard_Xml_Security_Transform
     public function applyTransforms($strXmlDocument)
     public function applyTransforms($strXmlDocument)
     {
     {
         foreach($this->_transformList as $transform) {
         foreach($this->_transformList as $transform) {
-            Zend_Loader::loadClass($transform['class']);
+            if (!class_exists($transform['class'])) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($transform['class']);
+            }
 
 
             $transformer = new $transform['class'];
             $transformer = new $transform['class'];
 
 

+ 8 - 4
library/Zend/Layout.php

@@ -264,8 +264,10 @@ class Zend_Layout
         require_once 'Zend/Controller/Front.php';
         require_once 'Zend/Controller/Front.php';
         $front = Zend_Controller_Front::getInstance();
         $front = Zend_Controller_Front::getInstance();
         if (!$front->hasPlugin($pluginClass)) {
         if (!$front->hasPlugin($pluginClass)) {
-            require_once 'Zend/Loader.php';
-            Zend_Loader::loadClass($pluginClass);
+            if (!class_exists($pluginClass)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($pluginClass);
+            }
             $front->registerPlugin(
             $front->registerPlugin(
                 // register to run last | BUT before the ErrorHandler (if its available)
                 // register to run last | BUT before the ErrorHandler (if its available)
                 new $pluginClass($this), 
                 new $pluginClass($this), 
@@ -284,8 +286,10 @@ class Zend_Layout
         $helperClass = $this->getHelperClass();
         $helperClass = $this->getHelperClass();
         require_once 'Zend/Controller/Action/HelperBroker.php';
         require_once 'Zend/Controller/Action/HelperBroker.php';
         if (!Zend_Controller_Action_HelperBroker::hasHelper('layout')) {
         if (!Zend_Controller_Action_HelperBroker::hasHelper('layout')) {
-            require_once 'Zend/Loader.php';
-            Zend_Loader::loadClass($helperClass);
+            if (!class_exists($helperClass)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($helperClass);
+            }
             Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-90, new $helperClass($this));
             Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-90, new $helperClass($this));
         }
         }
     }
     }

+ 4 - 6
library/Zend/Mail/Transport/Smtp.php

@@ -22,11 +22,6 @@
 
 
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * @see Zend_Mime
  * @see Zend_Mime
  */
  */
 require_once 'Zend/Mime.php';
 require_once 'Zend/Mime.php';
@@ -192,7 +187,10 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
             if ($this->_auth) {
             if ($this->_auth) {
                 $connectionClass .= '_Auth_' . ucwords($this->_auth);
                 $connectionClass .= '_Auth_' . ucwords($this->_auth);
             }
             }
-            Zend_Loader::loadClass($connectionClass);
+            if (!class_exists($connectionClass)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($connectionClass);
+            }
             $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config));
             $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config));
             $this->_connection->connect();
             $this->_connection->connect();
             $this->_connection->helo($this->_name);
             $this->_connection->helo($this->_name);

+ 5 - 3
library/Zend/Navigation/Page.php

@@ -190,8 +190,10 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
                         break;
                         break;
                 }
                 }
 
 
-                require_once 'Zend/Loader.php';
-                @Zend_Loader::loadClass($type);
+                if (!class_exists($type)) {
+                    require_once 'Zend/Loader.php';
+                    @Zend_Loader::loadClass($type);
+                }
 
 
                 $page = new $type($options);
                 $page = new $type($options);
                 if (!$page instanceof Zend_Navigation_Page) {
                 if (!$page instanceof Zend_Navigation_Page) {
@@ -1113,4 +1115,4 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container
      * @return string  the page's href
      * @return string  the page's href
      */
      */
     abstract public function getHref();
     abstract public function getHref();
-}
+}

+ 1 - 3
library/Zend/Reflection/Docblock/Tag.php

@@ -19,9 +19,6 @@
  * @version    $Id$
  * @version    $Id$
  */
  */
 
 
-/** Zend_Loader */
-require_once 'Zend/Loader.php';
-
 /**
 /**
  * @category   Zend
  * @category   Zend
  * @package    Zend_Reflection
  * @package    Zend_Reflection
@@ -67,6 +64,7 @@ class Zend_Reflection_Docblock_Tag implements Reflector
         if (array_key_exists($tagName, self::$_tagClasses)) {
         if (array_key_exists($tagName, self::$_tagClasses)) {
             $tagClass = self::$_tagClasses[$tagName];
             $tagClass = self::$_tagClasses[$tagName];
             if (!class_exists($tagClass)) {
             if (!class_exists($tagClass)) {
+                require_once 'Zend/Loader.php';
                 Zend_Loader::loadClass($tagClass);
                 Zend_Loader::loadClass($tagClass);
             }
             }
             return new $tagClass($tagDocblockLine);
             return new $tagClass($tagDocblockLine);

+ 4 - 2
library/Zend/Registry.php

@@ -109,8 +109,10 @@ class Zend_Registry extends ArrayObject
         /**
         /**
          * @see Zend_Loader
          * @see Zend_Loader
          */
          */
-        require_once 'Zend/Loader.php';
-        Zend_Loader::loadClass($registryClassName);
+        if (!class_exists($registryClassName)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($registryClassName);
+        }
 
 
         self::$_registryClassName = $registryClassName;
         self::$_registryClassName = $registryClassName;
     }
     }

+ 4 - 3
library/Zend/Service/Amazon/Ec2.php

@@ -20,8 +20,6 @@
  * @version    $Id$
  * @version    $Id$
  */
  */
 
 
-require_once 'Zend/Loader.php';
-
 /**
 /**
  * Amazon Ec2 Interface to allow easy creation of the Ec2 Components
  * Amazon Ec2 Interface to allow easy creation of the Ec2 Components
  *
  *
@@ -79,7 +77,10 @@ class Zend_Service_Amazon_Ec2
                 break;
                 break;
         }
         }
 
 
-        Zend_Loader::loadClass($class);
+        if (!class_exists($class)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($class);
+        }
         return new $class($key, $secret_key);
         return new $class($key, $secret_key);
     }
     }
 }
 }

+ 4 - 6
library/Zend/Service/Nirvanix.php

@@ -20,11 +20,6 @@
  */
  */
  
  
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * @see Zend_Http_Client
  * @see Zend_Http_Client
  */
  */
 require_once 'Zend/Http/Client.php';
 require_once 'Zend/Http/Client.php';
@@ -91,7 +86,10 @@ class Zend_Service_Nirvanix
         $options['namespace'] = ucfirst($namespace);
         $options['namespace'] = ucfirst($namespace);
         $options = array_merge($this->_options, $options);
         $options = array_merge($this->_options, $options);
 
 
-        Zend_Loader::loadClass($class);
+        if (!class_exists($class)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($class);
+        }
         return new $class($options);
         return new $class($options);
     }
     }
     
     

+ 4 - 7
library/Zend/Service/StrikeIron.php

@@ -22,12 +22,6 @@
 
 
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-
-/**
  * This class allows StrikeIron authentication credentials to be specified
  * This class allows StrikeIron authentication credentials to be specified
  * in one place and provides a factory for returning instances of different
  * in one place and provides a factory for returning instances of different
  * StrikeIron service classes.
  * StrikeIron service classes.
@@ -74,7 +68,10 @@ class Zend_Service_StrikeIron
         }
         }
 
 
         try {
         try {
-            @Zend_Loader::loadClass($class);
+            if (!class_exists($class)) {
+                require_once 'Zend/Loader.php';
+                @Zend_Loader::loadClass($class);
+            }
             if (!class_exists($class, false)) {
             if (!class_exists($class, false)) {
                 throw new Exception('Class file not found');
                 throw new Exception('Class file not found');
             }
             }

+ 4 - 8
library/Zend/Session.php

@@ -721,15 +721,11 @@ class Zend_Session extends Zend_Session_Abstract
      */
      */
     private static function _processValidators()
     private static function _processValidators()
     {
     {
-        if (count($_SESSION['__ZF']['VALID']) > 0) {
-            /**
-             * @see Zend_Loader
-             */
-            require_once 'Zend/Loader.php';
-        }
-
         foreach ($_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) {
         foreach ($_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) {
-            Zend_Loader::loadClass($validator_name);
+            if (!class_exists($validator_name)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($validator_name);
+            }
             $validator = new $validator_name;
             $validator = new $validator_name;
             if ($validator->validate() === false) {
             if ($validator->validate() === false) {
                 /** @see Zend_Session_Exception */
                 /** @see Zend_Session_Exception */

+ 4 - 7
library/Zend/TimeSync.php

@@ -21,11 +21,6 @@
  */
  */
 
 
 /**
 /**
- * Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * Zend_Date
  * Zend_Date
  */
  */
 require_once 'Zend/Date.php';
 require_once 'Zend/Date.php';
@@ -298,8 +293,10 @@ class Zend_TimeSync implements IteratorAggregate
         }
         }
 
 
         $className = 'Zend_TimeSync_' . $protocol;
         $className = 'Zend_TimeSync_' . $protocol;
-
-        Zend_Loader::loadClass($className);
+        if (!class_exists($className)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($className);
+        }
         $timeServerObj = new $className($adress, $port);
         $timeServerObj = new $className($adress, $port);
 
 
         $this->_timeservers[$alias] = $timeServerObj;
         $this->_timeservers[$alias] = $timeServerObj;

+ 6 - 2
library/Zend/Tool/Framework/Client/Console.php

@@ -108,8 +108,12 @@ class Zend_Tool_Framework_Client_Console
         }
         }
         
         
         // support setting the loader from the environment
         // support setting the loader from the environment
-        if (isset($_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS']) && Zend_Loader::loadClass($_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS'])) {
-            $this->_registry->setLoader(new $_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS']);
+        if (isset($_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS'])) {
+            if (class_exists($_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS'])
+                || Zend_Loader::loadClass($_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS'])
+            ) {
+                $this->_registry->setLoader(new $_ENV['ZEND_TOOL_FRAMEWORK_LOADER_CLASS']);
+            }
         }
         }
 
 
         return;
         return;

+ 5 - 3
library/Zend/Tool/Project/Context/Repository.php

@@ -1,6 +1,5 @@
 <?php
 <?php
 
 
-require_once 'Zend/Loader.php';
 require_once 'Zend/Tool/Project/Context/System/Interface.php';
 require_once 'Zend/Tool/Project/Context/System/Interface.php';
 require_once 'Zend/Tool/Project/Context/System/TopLevelRestrictable.php';
 require_once 'Zend/Tool/Project/Context/System/TopLevelRestrictable.php';
 require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php';
 require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php';
@@ -59,7 +58,10 @@ class Zend_Tool_Project_Context_Repository implements Countable
     
     
     public function addContextClass($contextClass)
     public function addContextClass($contextClass)
     {
     {
-        Zend_Loader::loadClass($contextClass);
+        if (!class_exists($contextClass)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($contextClass);
+        }
         $context = new $contextClass();
         $context = new $contextClass();
         return $this->addContext($context);
         return $this->addContext($context);
     }
     }
@@ -155,4 +157,4 @@ class Zend_Tool_Project_Context_Repository implements Countable
         return strtolower($name);
         return strtolower($name);
     }
     }
     
     
-}
+}

+ 4 - 1
library/Zend/Translate.php

@@ -86,7 +86,10 @@ class Zend_Translate {
             $adapter = 'Zend_Translate_Adapter_' . ucfirst($adapter);
             $adapter = 'Zend_Translate_Adapter_' . ucfirst($adapter);
         }
         }
 
 
-        Zend_Loader::loadClass($adapter);
+        if (!class_exists($adapter)) {
+            Zend_Loader::loadClass($adapter);
+        }
+
         if (self::$_cache !== null) {
         if (self::$_cache !== null) {
             call_user_func(array($adapter, 'setCache'), self::$_cache);
             call_user_func(array($adapter, 'setCache'), self::$_cache);
         }
         }

+ 4 - 6
library/Zend/Uri.php

@@ -20,11 +20,6 @@
  */
  */
 
 
 /**
 /**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-/**
  * Abstract class for all Zend_Uri handlers
  * Abstract class for all Zend_Uri handlers
  *
  *
  * @category  Zend
  * @category  Zend
@@ -128,7 +123,10 @@ abstract class Zend_Uri
                 break;
                 break;
         }
         }
 
 
-        Zend_Loader::loadClass($className);
+        if (!class_exists($className)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($className);
+        }
         $schemeHandler = new $className($scheme, $schemeSpecific);
         $schemeHandler = new $className($scheme, $schemeSpecific);
 
 
         return $schemeHandler;
         return $schemeHandler;

+ 11 - 11
library/Zend/Validate.php

@@ -141,18 +141,18 @@ class Zend_Validate implements Zend_Validate_Interface
         foreach ($namespaces as $namespace) {
         foreach ($namespaces as $namespace) {
             $className = $namespace . '_' . ucfirst($classBaseName);
             $className = $namespace . '_' . ucfirst($classBaseName);
             try {
             try {
-                require_once 'Zend/Loader.php';
-                Zend_Loader::loadClass($className);
-                if (class_exists($className, false)) {
-                    $class = new ReflectionClass($className);
-                    if ($class->implementsInterface('Zend_Validate_Interface')) {
-                        if ($class->hasMethod('__construct')) {
-                            $object = $class->newInstanceArgs($args);
-                        } else {
-                            $object = $class->newInstance();
-                        }
-                        return $object->isValid($value);
+                if (!class_exists($className)) {
+                    require_once 'Zend/Loader.php';
+                    Zend_Loader::loadClass($className);
+                }
+                $class = new ReflectionClass($className);
+                if ($class->implementsInterface('Zend_Validate_Interface')) {
+                    if ($class->hasMethod('__construct')) {
+                        $object = $class->newInstanceArgs($args);
+                    } else {
+                        $object = $class->newInstance();
                     }
                     }
+                    return $object->isValid($value);
                 }
                 }
             } catch (Zend_Validate_Exception $ze) {
             } catch (Zend_Validate_Exception $ze) {
                 // if there is an exception while validating throw it
                 // if there is an exception while validating throw it

+ 4 - 2
library/Zend/View/Helper/Placeholder/Registry.php

@@ -158,8 +158,10 @@ class Zend_View_Helper_Placeholder_Registry
      */
      */
     public function setContainerClass($name)
     public function setContainerClass($name)
     {
     {
-        require_once 'Zend/Loader.php';
-        Zend_Loader::loadClass($name);
+        if (!class_exists($name)) {
+            require_once 'Zend/Loader.php';
+            Zend_Loader::loadClass($name);
+        }
 
 
         $reflection = new ReflectionClass($name);
         $reflection = new ReflectionClass($name);
         if (!$reflection->isSubclassOf(new ReflectionClass('Zend_View_Helper_Placeholder_Container_Abstract'))) {
         if (!$reflection->isSubclassOf(new ReflectionClass('Zend_View_Helper_Placeholder_Container_Abstract'))) {

+ 10 - 4
library/Zend/Wildfire/Channel/HttpHeaders.php

@@ -81,24 +81,30 @@ class Zend_Wildfire_Channel_HttpHeaders extends Zend_Controller_Plugin_Abstract
      */
      */
     public static function init($class = null)
     public static function init($class = null)
     {
     {
-        if (self::$_instance!==null) {
+        if (self::$_instance !== null) {
             require_once 'Zend/Wildfire/Exception.php';
             require_once 'Zend/Wildfire/Exception.php';
             throw new Zend_Wildfire_Exception('Singleton instance of Zend_Wildfire_Channel_HttpHeaders already exists!');
             throw new Zend_Wildfire_Exception('Singleton instance of Zend_Wildfire_Channel_HttpHeaders already exists!');
         }
         }
-        if ($class!==null) {
+        if ($class !== null) {
             if (!is_string($class)) {
             if (!is_string($class)) {
                 require_once 'Zend/Wildfire/Exception.php';
                 require_once 'Zend/Wildfire/Exception.php';
                 throw new Zend_Wildfire_Exception('Third argument is not a class string');
                 throw new Zend_Wildfire_Exception('Third argument is not a class string');
             }
             }
-            Zend_Loader::loadClass($class);
+
+            if (!class_exists($class)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($class);
+            }
+
             self::$_instance = new $class();
             self::$_instance = new $class();
+
             if (!self::$_instance instanceof Zend_Wildfire_Channel_HttpHeaders) {
             if (!self::$_instance instanceof Zend_Wildfire_Channel_HttpHeaders) {
                 self::$_instance = null;
                 self::$_instance = null;
                 require_once 'Zend/Wildfire/Exception.php';
                 require_once 'Zend/Wildfire/Exception.php';
                 throw new Zend_Wildfire_Exception('Invalid class to third argument. Must be subclass of Zend_Wildfire_Channel_HttpHeaders.');
                 throw new Zend_Wildfire_Exception('Invalid class to third argument. Must be subclass of Zend_Wildfire_Channel_HttpHeaders.');
             }
             }
         } else {
         } else {
-          self::$_instance = new self();
+            self::$_instance = new self();
         }
         }
 
 
         return self::$_instance;
         return self::$_instance;

+ 7 - 6
library/Zend/Wildfire/Plugin/FirePhp.php

@@ -19,9 +19,6 @@
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
  */
 
 
-/** Zend_Loader */
-require_once 'Zend/Loader.php';
-
 /** Zend_Controller_Request_Abstract */
 /** Zend_Controller_Request_Abstract */
 require_once('Zend/Controller/Request/Abstract.php');
 require_once('Zend/Controller/Request/Abstract.php');
 
 
@@ -176,16 +173,20 @@ class Zend_Wildfire_Plugin_FirePhp implements Zend_Wildfire_Plugin_Interface
      */
      */
     public static function init($class = null)
     public static function init($class = null)
     {
     {
-        if (self::$_instance!==null) {
+        if (self::$_instance !== null) {
             require_once 'Zend/Wildfire/Exception.php';
             require_once 'Zend/Wildfire/Exception.php';
             throw new Zend_Wildfire_Exception('Singleton instance of Zend_Wildfire_Plugin_FirePhp already exists!');
             throw new Zend_Wildfire_Exception('Singleton instance of Zend_Wildfire_Plugin_FirePhp already exists!');
         }
         }
-        if ($class!==null) {
+        if ($class !== null) {
             if (!is_string($class)) {
             if (!is_string($class)) {
                 require_once 'Zend/Wildfire/Exception.php';
                 require_once 'Zend/Wildfire/Exception.php';
                 throw new Zend_Wildfire_Exception('Third argument is not a class string');
                 throw new Zend_Wildfire_Exception('Third argument is not a class string');
             }
             }
-            Zend_Loader::loadClass($class);
+
+            if (!$class_exists($class)) {
+                require_once 'Zend/Loader.php';
+                Zend_Loader::loadClass($class);
+            }
             self::$_instance = new $class();
             self::$_instance = new $class();
             if (!self::$_instance instanceof Zend_Wildfire_Plugin_FirePhp) {
             if (!self::$_instance instanceof Zend_Wildfire_Plugin_FirePhp) {
                 self::$_instance = null;
                 self::$_instance = null;