-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.php
executable file
·143 lines (98 loc) · 4.26 KB
/
bootstrap.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
//$_SERVER['LOGILIM_ENV'] = 'production';
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
define("DOCROOT", __DIR__);
define("DS", DIRECTORY_SEPARATOR);
define("VENDOR_PATH",getcwd().'/vendor');
// Partial
define("QUEUE_PREFIX","queue");
define("WAIT_FOR_ASAP",90);
define("WAIT_FOR_FUTURE",120);
define("STABLE_API_VERSION",'v1.2');
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH."StickORM"),
get_include_path(),
)));
require_once 'StickORM/Zend/Loader/Autoloader.php';
require 'Slim/Slim.php';
require_once 'Logilim/Autoloader.php';
require 'StickORM/Autoloader.php';
require_once(VENDOR_PATH.DS.'predis'.DS.'autoload.php');
require_once(VENDOR_PATH.DS.'/KLogger/KLogger.php');
// Slim Loader
\Slim\Slim::registerAutoloader();
// Logilim Loader
\Logilim\Autoloader::registrar();
\StickORM\Autoloader::registerLoader();
if(!defined('STDIN'))
require_once 'config/config.php';
function api_url($alias) {
//return HAPPY_URL.'/'.$alias;
return '/api/'.$alias;
}
function buildDoc($blocks) {
if(defined('STDIN') ) {
echo "Are you sure you want to generate the documentation? Type 'yes' to continue: "."\n";
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
if(trim($line) != 'yes'){
echo "ABORTING!\n";
exit;
}
$html = '';
echo 'Building html..'."\n";
$html = '<html>
<head>
<title>Fare Dodger Documentation.</title>
<style type="text/css">
table{max-width: 100%; background-color: transparent;}
.table {width: 100%;margin-bottom: 20px;}
.table th,.table td {padding: 8px;line-height: 20px;text-align: left;vertical-align: top;border-top: 1px solid #dddddd;}
.table th{font-weight: bold;}
.table thead th {vertical-align: bottom;}
.table caption + thead tr:first-child th,.table caption + thead tr:first-child td,.table colgroup + thead tr:first-child th,
.table colgroup + thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td {border-top: 0;}
.table tbody + tbody { border-top: 2px solid #dddddd;}
.table .table { background-color: #ffffff;}
.table-condensed th,.table-condensed td { padding: 4px 5px;}
.table-bordered { border: 1px solid #dddddd;border-collapse: separate; *border-collapse: collapse;border-left: 0;-webkit-border-radius: 4px;-moz-border-radius: 4px;
border-radius: 4px;}
.well {min-height: 20px;padding: 19px;margin:20px 0;background-color: #f5f5f5;font-weight:700;border: 1px solid #e3e3e3;-webkit-border-radius: 4px;-moz-border-radius: 4px;
border-radius: 4px;-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);}
</style>
</head><body><div class="well">Fare Dodger WS Docummentation.</div>
<table class="table table-condensed">';
echo 'Builded html..'."\n";
echo 'Preparing Iteration..'."\n";
$i = 0;
foreach ($blocks as $block) {
$i++;
$html .= '<tr>';
$html .= "<td colspan='2' style='background-color: #000; color: #fff;'>{$i}. {$block->desc}</td>";//Getting Description
$html .= '</tr>';
foreach ($block->tags as $key => $tag) {
$html .= '<tr>';
$tag = array_shift($tag);
$html .= "<td>{$key}</td>";//Getting Description
$html .= "<td>{$tag}</td>";//Getting Description
$html .= '</tr>';
}
}
echo 'Iteration completed..'."\n";
$html .= '</table></body></html>';
file_put_contents('fddb.html',$html);
echo 'Cooked the HTML..'."\n";
echo 'Your FarDodgers Documentation Builder did his job. Find out "fddb.html" in current directory.'."\n";
echo 'Thank You!. Author - Muhammad Ibrahim'."\n";
}
}
/**
* Step 2: Instantiate a Slim application
*
* This example instantiates a Slim application using
* its default settings. However, you will usually configure
* your Slim application now by passing an associative array
* of setting names and values into the application constructor.
*/
$app = new \Slim\Slim();