-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_coder.module
40 lines (37 loc) · 1.56 KB
/
php_coder.module
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
<?php
/**
* Example function.
*/
function _drush_execute_phpc($area = NULL, $action = NULL, $additional_option_array = array()) {
require_once 'src/php_coder_object.php';
$phpc_ob = new php_coder_object($area, $action, $additional_option_array);
$phpc_ob->unpack();
// switch instead of if-else to make more extensible
switch ($phpc_ob->output_message_type) {
case 'success':
$limit = $limit == 'EEMPTY' ? 0:$limit;
$limit = $limit == 'all' ? 0:$limit;
$type = 'success';
$type_debug_string = $phpc_ob->output_message_type;
// $message = 'Okay, I\'ll Compose the SQL';
$message = $phpc_ob->output_message;
break;
default:
$type = 'error';
$type_debug_string = $phpc_ob->output_message_type;
$command = $command == NULL?'NNULL':$command;
// $message = 'The "' . $command . '" command is not supported, something went very wrong. Please asks for assistance.';
$message = $phpc_ob->output_message;
break;
}
drupal_set_message(t($message), $type);
drupal_set_message(t("[message set {$type_debug_string}]"), $type);
$test_output_array = array(
'Feather'=>'Named for his Tail',
'Marcy'=>'Named for Mt. Marcy in the Adirondacks',
'Chester'=>'Named for Chester Creek',
'Marais'=>'Named for Grand Marais on the North Shore of Lake Superior',
);
// $phpc_ob->output_string = '<pre>' . print_r($test_output_array, TRUE) . '</pre>';
drush_print($phpc_ob->output_string);
}