@@ -22,15 +22,26 @@ class CPanel {
22
22
23
23
//-----------------------------------------------------
24
24
25
- public function __construct ()
25
+ public function __construct ($ cpanel_domain = null , $ cpanel_api_token = null , $ cpanel_username = null , $ protocol = ' https ' , $ port = 2083 )
26
26
{
27
+
27
28
$ this ->config = Config::get ('cpanel ' );
28
29
29
- $ this ->protocol = $ this ->config ['protocol ' ];
30
- $ this ->domain = $ this ->config ['domain ' ];
31
- $ this ->port = $ this ->config ['port ' ];
32
- $ this ->username = $ this ->config ['username ' ];
33
- $ this ->token = $ this ->config ['api_token ' ];
30
+ if (isset ($ this ->config ) && isset ($ this ->config ['domain ' ]))
31
+ {
32
+ $ this ->protocol = $ this ->config ['protocol ' ];
33
+ $ this ->domain = $ this ->config ['domain ' ];
34
+ $ this ->port = $ this ->config ['port ' ];
35
+ $ this ->username = $ this ->config ['username ' ];
36
+ $ this ->token = $ this ->config ['api_token ' ];
37
+ } else {
38
+ $ this ->protocol = $ protocol ;
39
+ $ this ->port = $ port ;
40
+ $ this ->domain = $ cpanel_domain ;
41
+ $ this ->username = $ cpanel_username ;
42
+ $ this ->token = $ cpanel_api_token ;
43
+ }
44
+
34
45
35
46
}
36
47
@@ -137,7 +148,7 @@ public function call($module, $function, $args = array())
137
148
138
149
$ url = $ this ->protocol .':// ' .$ this ->domain . ': ' . $ this ->port . '/execute/ ' . $ module ;
139
150
$ url .= "/ " .$ function ;
140
-
151
+
141
152
if (count ($ args ) > 0 )
142
153
{
143
154
$ url .= '? ' . $ parameters ;
@@ -198,4 +209,4 @@ public function call($module, $function, $args = array())
198
209
199
210
//-----------------------------------------------------
200
211
201
- }
212
+ }
0 commit comments