Ian province abbreviation patch - issue 724
[civicrm-core.git] / CRM / Core / ClassLoader.php
index 574b96416f455fe656b90d7a7316a5a63279d44f..3002716fbebc5b91ece2b7633292f359acaed8d2 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -39,7 +39,6 @@ class CRM_Core_ClassLoader {
    * We only need one instance of this object. So we use the singleton
    * pattern and cache the instance in this variable
    * @var object
-   * @static
    */
   private static $_singleton = NULL;
 
@@ -61,7 +60,6 @@ class CRM_Core_ClassLoader {
   protected $_registered;
 
   /**
-   *
    */
   protected function __construct() {
     $this->_registered = FALSE;
@@ -70,7 +68,8 @@ class CRM_Core_ClassLoader {
   /**
    * Registers this instance as an autoloader.
    *
-   * @param Boolean $prepend Whether to prepend the autoloader or not
+   * @param bool $prepend
+   *   Whether to prepend the autoloader or not.
    *
    * @api
    */
@@ -95,13 +94,18 @@ class CRM_Core_ClassLoader {
     $include_paths = array(
       '.',
       $civicrm_base_path,
-      $packages_path
+      $packages_path,
     );
     $include_paths = implode(PATH_SEPARATOR, $include_paths);
     set_include_path($include_paths . PATH_SEPARATOR . get_include_path());
     require_once "$civicrm_base_path/vendor/autoload.php";
   }
 
+  /**
+   * Initialize HTML purifier class.
+   *
+   * @param string $prepend
+   */
   public function initHtmlPurifier($prepend) {
     if (class_exists('HTMLPurifier_Bootstrap')) {
       // HTMLPurifier is already initialized, e.g. by the Drupal module.
@@ -161,9 +165,11 @@ class CRM_Core_ClassLoader {
       $file = strtr($class, '_', '/') . '.php';
       // There is some question about the best way to do this.
       // "require_once" is nice because it's simple and throws
-      // intelligible errors.  The down side is that autoloaders
-      // down the chain cannot try to find the file if we fail.
-      require_once ($file);
+      // intelligible errors.
+      if (FALSE != stream_resolve_include_path($file)) {
+        require_once $file;
+      }
     }
   }
+
 }