-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.shadow
executable file
·121 lines (98 loc) · 2.73 KB
/
console.shadow
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
<?php
$handle = fopen("php://stdin","r");
try
{
echo "
\033[1m
\033[36m
_____ _ _ ______ _
/ ___| | | | | ___| | |
\ `--.| |__ __ _ __| | _____ __ | |_ _ __ __ _ _ __ ___ _____ _____ ___ _ __| | __
`--. \ '_ \ / _` |/ _` |/ _ \ \ /\ / / | _| '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \/ _ \| '__| |/ /
/\__/ / | | | (_| | (_| | (_) \ V V / | | | | | (_| | | | | | | __/\ V V / __/ (_) | | | <
\____/|_| |_|\__,_|\__,_|\___/ \_/\_/ \_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___|\___/|_| |_|\_\
\n";
echo
"
\033[0m
Choose Option:
\033[31m
1) Create Controller
\033[33m
2) Create Model
\033[0m
\n";
echo "Type Option: ";
$opt = strtolower(trim(fgets($handle)));
switch($opt)
{
/*
* Controller
*/
case 1:
echo "\n\n Type Name Of Controller: ";
$controller_name = strtolower(trim(fgets($handle)));
echo "\n";
if(file_exists("shadowapp/sh_controllers/".ucfirst($controller_name)."Shadow.php"))
{
echo " \033[41m Controller Allready Exists ! \033[0m \n";
return;
}
$controller_file = fopen("shadowapp/sh_controllers/".ucfirst($controller_name)."Shadow.php", "w+");
$cName = ucfirst($controller_name)."Shadow";
fwrite($controller_file,
"
<?php
namespace Shadowapp\Controllers;
use Shadowapp\Sys\View as View;
class $cName
{
public function __construct()
{
#code here
}
}
?>");
fclose($controller_file);
echo "\n \033[35m Controller Created Succesfully... \033[0m \n\n";
break;
/*
* Model
*/
case 2:
echo "\n\n Type Name Of Table: ";
$model_name = strtolower(trim(fgets($handle)));
echo "\n";
if(file_exists("shadowapp/sh_models/".ucfirst($model_name)."Shadow.php"))
{
echo " \033[41m Model Allready Exists ! \033[0m \n";
return;
}
$model_file = fopen("shadowapp/sh_models/".ucfirst($model_name)."Shadow.php", "w+");
$mName = ucfirst($model_name)."Shadow";
fwrite($model_file,
"
<?php
namespace Shadowapp\Models;
use \Shadowapp\Sys\Dbmanager as Dbmanager;
class $mName
{
public function __construct()
{
#code here
}
}
?>");
fclose($model_file);
echo "\n \033[35m Model Created Succesfully... \033[0m \n\n";
break;
default:
echo "Wrong Option \n";
return;
}
return;
}catch(Exception $e)
{
echo $e->getMessage();
}
?>