source: extensions/skeleton/trunk/include/ws_functions.inc.php @ 28650

Last change on this file since 28650 was 28650, checked in by mistic100, 10 years ago

update for 2.7

File size: 1.5 KB
Line 
1<?php
2defined('SKELETON_PATH') or die('Hacking attempt!');
3
4function 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
38function ws_php_info($params, &$service)
39{
40  return phpinfo(constant($params['what']));
41}
Note: See TracBrowser for help on using the repository browser.