-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli_api.php
More file actions
39 lines (33 loc) · 891 Bytes
/
cli_api.php
File metadata and controls
39 lines (33 loc) · 891 Bytes
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
#!/usr/bin/env php
<?php
define('MDT_CLI_API', true);
require_once('../../../wp-load.php');
require_once 'Order.php';
require_once 'Product.php';
require_once 'Category.php';
fwrite(STDOUT, "ready\n\n");
/* define('£', $instance);
define('€', Msx_To_Wc); */
while (true){
$data = readline(' > ');
if(!$data)continue;
if($data == 'exit'){
exit(0);
}
if($data == 'r'){
exit(1);
}
$data = str_replace('§', '$mdt->', $data);
if($data == 'help'){
fwrite(STDOUT, "mmmh... no\n");
exit(2);
}
try {
$data = eval( 'return '. $data . ';' );
} catch (Exception $e) {
$data = $e;
}
$result = var_export( $data, true);
fwrite(STDOUT, $result."\n");
}
?>