-
Notifications
You must be signed in to change notification settings - Fork 178
/
init_csn_autoloader.php
33 lines (29 loc) · 1.07 KB
/
init_csn_autoloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
// Composer autoloading
if (file_exists('vendor/autoload.php')) {
$loader = include 'vendor/autoload.php';
}
$csnPath = false;
if (is_dir('vendor')) { // vendor/ZF2/library
$csnPath = 'vendor'; // notice how we are in the folder where the library should be
} elseif (getenv('CSN_PATH')) { // Support for ZF2_PATH environment variable or git submodule
$csnPath = getenv('CSN_PATH');
} elseif (get_cfg_var('csn_path')) { // Support for zf2_path directive value
$csnPath = get_cfg_var('csn_path');
}
if ($csnPath) {
if (isset($loader)) {
$loader->add('Csn', $csnPath);
} else {
// ToDo fix it so it works with Csn
include $csnPath . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true
)
));
}
}
if (!class_exists('Zend\Loader\AutoloaderFactory')) {
throw new RuntimeException('Unable to load CSN. Run `php composer.phar install` or define a CSN_PATH environment variable.');
}