-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.php
45 lines (34 loc) · 1.91 KB
/
app.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
<?php
include "functions.php";
include "menus.php";
// The Application
$Application = new stdClass();
$Application->RunState = 1;
$Application->CurrentMenu = $MainMenu;
$Application->SpecialKeywords = $SpecialKeywords;
while($Application->RunState != 0){
DisplayMenu($Application->CurrentMenu); // show current menu
$Application->command = GetCommmand("Selection: "); // get user input
// Perform any Application wide special keyword checks here
if(!empty( $Application->SpecialKeywords->Actions[strtoupper($Application->command)])){
// if the action is a string function name
if(is_string($Application->SpecialKeywords->Actions[strtoupper($Application->command)])){
call_user_func($Application->SpecialKeywords->Actions[strtoupper($Application->command)]);
}
// if the action is an array [function name, data]
if(is_array($Application->SpecialKeywords->Actions[strtoupper($Application->command)])){
call_user_func($Application->SpecialKeywords->Actions[strtoupper($Application->command)][0] , $Application->SpecialKeywords->Actions[strtoupper($Application->command)][1]);
}
}
// Perform Regular Menu Actions
if(!empty($Application->CurrentMenu->MenuActions[$Application->command])){ // if the menu option has a corresponding menu action
// if the action is a string function name
if(is_string($Application->CurrentMenu->MenuActions[$Application->command])){
call_user_func($Application->CurrentMenu->MenuActions[$Application->command]);
}
// if the action is an array [function name, data]
if(is_array($Application->CurrentMenu->MenuActions[$Application->command])){
call_user_func($Application->CurrentMenu->MenuActions[$Application->command][0] , $Application->CurrentMenu->MenuActions[$Application->command][1]);
}
}
}