-
Notifications
You must be signed in to change notification settings - Fork 3
/
seezoo.php
81 lines (70 loc) · 1.99 KB
/
seezoo.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
77
78
79
80
81
<?php
/**
* ====================================================================
*
* Seezoo-Framework bootstrap file
*
* Define Path constants and load Core files.
*
* @author Yoshiaki Sugimoto <[email protected]>
*
* ====================================================================
*/
// Initial, force clean output buffer
@ob_end_clean();
// System always handles the UTF-8 encoding.
ini_set('default_charset', 'UTF-8');
mb_internal_encoding('UTF-8');
// Framework version
define('SZ_VERSION', '0.6');
// System path constants difinition
define('SZ_EXEC', TRUE);
define('DISPATCHER', basename($_SERVER['SCRIPT_FILENAME']));
define('ROOTPATH', realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . '/');
define('SZPATH', dirname(__FILE__) . '/');
// Prepare Exceptions
require_once(SZPATH . 'core/system/exceptions.php');
// Autoloader register
require_once(SZPATH . 'core/system/Autoloader.php');
Autoloader::init();
Seezoo::startup();
// Did you request from CLI?
if ( PHP_SAPI === 'cli' )
{
// Unit test handling
if ( strpos($_SERVER['argv'][0], 'phpunit') !== FALSE )
{
define('SZ_COMMANDLINE_WORKER', 1);
$application = Application::init()->extendAll();
Seezoo::addApplication($application);
Seezoo::prepare($application, SZ_MODE_CLI, '');
spl_autoload_register(array('Autoloader', 'loadTestModule'));
}
else
{
// detect application
$app = SZ_BASE_APPLICATION_NAME;
$prefix = SZ_PREFIX_BASE;
$argInput = array();
foreach ( $_SERVER['argv'] as $key => $argv )
{
if ( preg_match('/^\-\-app=(.+)$/u', trim($argv), $match) )
{
$app = $match[1];
continue;
}
else if ( preg_match('/^\-\-prefix=(.+)$/u', trim($argv), $match) )
{
$prefix = $match[1];
continue;
}
$argInput[] = $argv;
}
$application = Application::init($app, $prefix);
Seezoo::addApplication($application);
// Command line tools ignittion
$dog = Seezoo::$Importer->classes('Console');
$dog->executeCommandLine($argInput);
exit;
}
}