X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FClassLoader.php;h=b68cc3d6b911cb3932c64623ecaec690fe05b8f0;hb=16bd56a4590b6ded39eaa6abaa15e7904e410445;hp=46ed87ae1e5aa02cb52c54b141cdb2507d1249df;hpb=88c6259e813c523210e799e874ece50131ebe6d7;p=civicrm-core.git diff --git a/CRM/Core/ClassLoader.php b/CRM/Core/ClassLoader.php index 46ed87ae1e..b68cc3d6b9 100644 --- a/CRM/Core/ClassLoader.php +++ b/CRM/Core/ClassLoader.php @@ -1,7 +1,7 @@ _registered = FALSE; @@ -70,17 +68,18 @@ 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 */ - function register($prepend = FALSE) { + public function register($prepend = FALSE) { if ($this->_registered) { return; } $civicrm_base_path = dirname(dirname(__DIR__)); - require_once dirname(dirname(__DIR__)) . '/packages/vendor/autoload.php'; + require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php'; // we do this to prevent a autoloader errors with joomla / 3rd party packages // use absolute path since we dont know the content of include_path as yet @@ -95,14 +94,19 @@ 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/packages/vendor/autoload.php"; + require_once "$civicrm_base_path/vendor/autoload.php"; } - function initHtmlPurifier($prepend) { + /** + * 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. return; @@ -149,7 +153,7 @@ class CRM_Core_ClassLoader { /** * @param $class */ - function loadClass($class) { + public function loadClass($class) { if ( // Only load classes that clearly belong to CiviCRM. // Note: api/v3 does not use classes, but api_v3's test-suite does @@ -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; + } } } + }