Skip to content
Snippets Groups Projects

Resolve "Remove all use of GLOBALS"

Merged Stein Magne Bjorklund requested to merge 13-remove-all-use-of-globals into master
1 file
+ 17
2
Compare changes
  • Side-by-side
  • Inline
+ 17
2
@@ -15,7 +15,7 @@ require_once __DIR__ . '/common.inc.php';
global $conf;
$configuration = new uib\ub\loadspeakr\Configuration($conf);
$utils = new uib\ub\loadspeakr\Utils($configuration);
$utils = new Utils($configuration);
if (isset($_GET['q']) && $_GET['q'] === 'import') {
$imp = new Importer($configuration);
@@ -70,16 +70,31 @@ if ($uri === $conf['basedir']) {
$localUri = $conf['basedir'] . $_GET['q'];
$uri = Utils::getMirroredUri($localUri);
/**
* Update running configuration before launching Loadspekr modules.
*/
global $lodspk;
$boostrapConfig = [
'localUri' => $localUri,
'uri' => $uri,
'acceptContentType' => $acceptContentType,
'endpoints' => $endpoints['local'],
'extension' => $extension,
'lodspk' => $lodspk,
];
$modulesConfig = $configuration->add('bootstrap', $boostrapConfig);
/**
* Load Loadspeakr modules.
*/
foreach ($conf['modules']['available'] as $loadspkrModule) {
$loader = new LoadModules($configuration, $utils);
$loader = new LoadModules($modulesConfig, new Utils($configuration));
$module = $loader->loadModule($loadspkrModule);
$matching = $module->match($uri);
if ($matching) {
$module->execute($matching);
if ($conf['logfile'] !== null) {
fwrite($conf['logfile'], "]}");
fclose($conf['logfile']);
Loading