forked from rubensayshi/gw2spidy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoload.php
76 lines (58 loc) · 1.94 KB
/
autoload.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
// PEAR is a pain in the ass, this fixes our problems
set_include_path(get_include_path() . PATH_SEPARATOR . "/usr/share/php");
// autoload.php generated by Composer
if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
require __DIR__ . '/vendor/composer' . '/ClassLoader.php';
}
$loader = new \Composer\Autoload\ClassLoader();
$composerDir = __DIR__ . '/vendor/composer';
$map = require $composerDir . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = require $composerDir . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->add('GW2Spidy', __DIR__.'/src');
$loader->add('ShroudMagic', __DIR__.'/src');
$loader->add('SamuiraiMagic', __DIR__.'/src');
$loader->add('Predis', __DIR__.'/vendor/nrk-predis/lib');
$loader->add('Igorw', __DIR__.'/vendor/igorw/src');
$loader->register();
/**
* @return \Igorw\Silex\Env
*/
function getAppEnv() {
static $env = null;
if (is_null($env)) {
$env = new \Igorw\Silex\Env(__DIR__ . "/config/cnf");
}
return $env;
}
/**
* @return \Igorw\Silex\Config
*/
function getAppConfig($key = null) {
static $cnf = null;
if (is_null($cnf)) {
$cnf = new \Igorw\Silex\Config(getAppEnv());
}
if (!is_null($key)) {
return $cnf->getConfig($key);
}
return $cnf;
}
// Include the main Propel script
require_once __DIR__ . '/vendor/propel/runtime/lib/Propel.php';
// Initialize Propel with the runtime configuration
$propelcnf = (array)getAppConfig('propel');
$propelcnf['classmap'] = include(__DIR__ . '/config/classmap-gw2spidy-conf.php');
Propel::setConfiguration($propelcnf);
Propel::initialize();
// set newrelic_background_job if on CLI and newrelic is enabled
if (function_exists('newrelic_background_job') && php_sapi_name() == 'cli') {
newrelic_background_job(true);
}
require_once __DIR__ . '/vendor/simple_html_dom/simple_html_dom.php';