1 | <?php |
---|
2 | defined('SKELETON_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | function skeleton_ws_add_methods($arr) |
---|
5 | { |
---|
6 | $service = &$arr[0]; |
---|
7 | |
---|
8 | // only the first two parameters are mandatory |
---|
9 | $service->addMethod( |
---|
10 | 'pwg.PHPinfo', // method name |
---|
11 | 'ws_php_info', // linked PHP function |
---|
12 | array( // list of parameters |
---|
13 | 'what' => array( |
---|
14 | 'default' => 'INFO_ALL', // default value |
---|
15 | 'info' => 'This parameter has a default value', // parameter description |
---|
16 | ), |
---|
17 | 'ids' => array( |
---|
18 | 'flags' => WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, // flags are WS_PARAM_OPTIONAL, WS_PARAM_ACCEPT_ARRAY, WS_PARAM_FORCE_ARRAY |
---|
19 | 'type' => WS_TYPE_INT|WS_TYPE_POSITIVE|WS_TYPE_NOTNULL, // types are WS_TYPE_BOOL, WS_TYPE_INT, WS_TYPE_FLOAT, WS_TYPE_POSITIVE, WS_TYPE_NOTNULL, WS_TYPE_ID |
---|
20 | 'info' => 'This one must be an array', |
---|
21 | ), |
---|
22 | 'count' => array( |
---|
23 | 'flags' => WS_PARAM_OPTIONAL, |
---|
24 | 'type' => WS_TYPE_INT|WS_TYPE_POSITIVE, |
---|
25 | 'maxValue' => 100, // maximum value for ints and floats |
---|
26 | ), |
---|
27 | ), |
---|
28 | 'Returns phpinfo', // method description |
---|
29 | null, // file to include after param check and before function exec |
---|
30 | array( |
---|
31 | 'hidden' => false, // you can hide your method from reflection.getMethodList method |
---|
32 | 'admin_only' => true, // you can restrict access to admins only |
---|
33 | 'post_only' => false, // you can disallow GET resquests for this method |
---|
34 | ) |
---|
35 | ); |
---|
36 | } |
---|
37 | |
---|
38 | function ws_php_info($params, &$service) |
---|
39 | { |
---|
40 | return phpinfo(constant($params['what'])); |
---|
41 | } |
---|