(2018-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Panel * @since 0.10.0 * */ // This file is being included in admin_index and customer_index // and therefore does not need to require lib/init.php try { $json_result = Froxlor::getLocal($userinfo)->listFunctions(); } catch (Exception $e) { dynamic_error($e->getMessage()); } $result = json_decode($json_result, true)['data']; // get response data $m_arr = $result; // initialize output-array $output_arr = array(); // check every module foreach ($m_arr as $module) { // initialize module array for sorting if (! isset($output_arr[$module['module']]) || ! is_array($output_arr[$module['module']])) { $output_arr[$module['module']] = array(); } // set necessary data $output_arr[$module['module']][$module['function']] = array( 'return_type' => (isset($module['return']['type']) && $module['return']['type'] != "" ? $module['return']['type'] : - 1), 'return_desc' => (isset($module['return']['desc']) && $module['return']['desc'] != "" ? $module['return']['desc'] : - 1), 'params_list' => array(), 'head' => $module['head'], 'access' => isset($module['access']) ? $module['access'] : null ); if (isset($module['params']) && is_array($module['params'])) { foreach ($module['params'] as $param) { $output_arr[$module['module']][$module['function']]['params_list'][] = array( 'type' => $param['type'], 'name' => $param['parameter'], 'desc' => $param['desc'] ); } } } // sort array ksort($output_arr); $apihelp = ""; // output ALL the modules foreach ($output_arr as $module => $functions) { // sort by function ksort($functions); $apihelp .= "
| Field | Type | Description |
|---|---|---|
";
// check whether the parameter is optional
if (! empty($param['desc']) && strtolower(substr(trim($param['desc']), 0, 8)) == "optional") {
$parms .= "" . $param['name'] . "";
$param['desc'] = substr(trim($param['desc']), 8);
if (substr($param['desc'], 0, 1) == ',') {
$param['desc'] = substr(trim($param['desc']), 1);
}
} else {
$parms .= "" . $param['name'] . "";
}
$parms .= " | " . (strtolower($param['type']) == 'unknown' ? "unknown" : $param['type']) . " | "; $parms .= ""; if (! empty($param['desc'])) { $parms .= trim($param['desc']); } $parms .= " | "; $parms .= "