-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApplication.php
More file actions
executable file
·70 lines (64 loc) · 1.55 KB
/
Application.php
File metadata and controls
executable file
·70 lines (64 loc) · 1.55 KB
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
<?php
/**
* Application.php
*
* This file contains the implementation of the WebLab_Application class.
* @see WebLab_Application
*/
/**
* The main class to start an application using WebLab Framework
*
* @author Jorgen Evens <jorgen@wlab.be>
* @package WebLab
*/
class WebLab_Application
{
/**
* Holds the main application currently running.
*
* @var WebLab_Application
*/
protected static $_self;
/**
* Returns the application currently running.
*
* @return WebLab_Application
*/
public static function getApplication() {
return self::$_self;
}
/**
* Application constructor
*
* @param string $config Path to configuration file.
*/
public function __construct( $config )
{
WebLab_Config::setApplicationConfig( $config );
if( empty( self::$_self ) ) {
self::$_self = $this;
}
}
/**
* Starts the application
*/
public function run()
{
$loader = WebLab_Config::getApplicationConfig()->get( 'Application.Loader', WebLab_Config::OBJECT, false );
if( isset( $loader ) )
{
$this->acquire( $loader->location );
$loader = $loader->name;
$loader = new $loader();
}
}
/**
* Require a php file.
*
* @param string $location The file to require.
*/
protected function acquire( $location )
{
require_once( $location );
}
}