HummingBirdAnimeClient/index.php

74 lines
1.6 KiB
PHP
Raw Normal View History

2015-05-22 12:36:26 -04:00
<?php
/**
* Here begins everything!
*/
2015-05-22 12:36:26 -04:00
// -----------------------------------------------------------------------------
// ! Start config
// -----------------------------------------------------------------------------
/**
* Well, whose list is it?
*/
define('WHOSE', "Tim's");
// -----------------------------------------------------------------------------
// ! End config
// -----------------------------------------------------------------------------
2015-06-29 09:46:49 -04:00
\session_start();
// Work around the silly timezone error
$timezone = ini_get('date.timezone');
if ($timezone === '' || $timezone === FALSE)
{
ini_set('date.timezone', 'GMT');
}
2015-06-29 09:46:49 -04:00
// Define base directories
define('ROOT_DIR', __DIR__);
define('APP_DIR', ROOT_DIR . DIRECTORY_SEPARATOR . 'app');
define('SRC_DIR', ROOT_DIR . DIRECTORY_SEPARATOR . 'src');
define('CONF_DIR', APP_DIR . DIRECTORY_SEPARATOR . 'config');
define('BASE_DIR', SRC_DIR . DIRECTORY_SEPARATOR . 'Base');
/**
* Joins paths together. Variadic to take an
* arbitrary number of arguments
*
* @return string
*/
function _dir()
{
return implode(DIRECTORY_SEPARATOR, func_get_args());
}
/**
* Set up autoloaders
*
* @codeCoverageIgnore
* @return void
*/
function _setup_autoloaders()
{
require _dir(ROOT_DIR, '/vendor/autoload.php');
spl_autoload_register(function ($class) {
$class_parts = explode('\\', $class);
array_shift($class_parts);
$ns_path = SRC_DIR . '/' . implode('/', $class_parts) . ".php";
if (file_exists($ns_path))
{
require_once($ns_path);
return;
}
});
}
// Setup autoloaders
_setup_autoloaders();
2015-05-22 12:36:26 -04:00
2015-06-29 09:46:49 -04:00
// Do dependency injection, and go!
require _dir(APP_DIR, 'bootstrap.php');
2015-05-22 12:36:26 -04:00
// End of index.php