本文整理汇总了PHP中Hooks::serve_scripts方法的典型用法代码示例。如果您正苦于以下问题:PHP Hooks::serve_scripts方法的具体用法?PHP Hooks::serve_scripts怎么用?PHP Hooks::serve_scripts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hooks
的用法示例。
在下文中一共展示了Hooks::serve_scripts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
// not a valid request
} elseif (!$parameters || empty($parameters['method'])) {
$response['error'] = array('code' => -32700, 'message' => 'Parse error');
// dispatch the request
} else {
// remember parameters if debug mode
if (isset($context['debug_rpc']) && $context['debug_rpc'] == 'Y') {
Logger::remember('services/json_rpc.php: json_rpc ' . $parameters['method'], $parameters['params'], 'debug');
}
// sanitize parameters
if (!isset($parameters['params'])) {
$parameters['params'] = array();
}
// depending on method name
if (is_callable(array('Hooks', 'serve_scripts'))) {
$response['result'] = Hooks::serve_scripts($parameters['method'], $parameters['params']);
}
// unknown method
if ($response['result'] === NULL) {
$response['error'] = array('code' => -32601, 'message' => 'Method not found "' . $parameters['method'] . '"');
if (isset($context['debug_rpc']) && $context['debug_rpc'] == 'Y') {
Logger::remember('services/json_rpc.php: json_rpc unsupported method ' . $parameters['method'], NULL, 'debug');
}
// error passed in result
} elseif (is_array($response['result']) && !empty($response['result']['code']) && !empty($response['result']['message'])) {
$response['error'] = $response['result'];
$response['result'] = NULL;
}
}
// copy request id in response, if any
if (empty($parameters['id'])) {
示例2: array
$parameters = @$result[1];
// nothing to parse
if (!$raw_data) {
$response = array('faultCode' => 1, 'faultString' => 'Empty request, please retry');
// parse has failed
} elseif (!$status) {
$response = array('faultCode' => 1, 'faultString' => 'Impossible to parse parameters');
// dispatch the request
} else {
// remember parameters if debug mode
if (isset($context['debug_rpc']) && $context['debug_rpc'] == 'Y') {
Logger::remember('services/xml_rpc.php: xml_rpc ' . $parameters['methodName'], $parameters['params'], 'debug');
}
// depending on method name
if (is_callable(array('Hooks', 'serve_scripts'))) {
$response = Hooks::serve_scripts($parameters['methodName'], $parameters['params']);
}
}
// unknown method
if (!isset($response)) {
$response = array('faultCode' => 1, 'faultString' => 'Do not know how to process ' . $parameters['methodName']);
if (isset($context['debug_rpc']) && $context['debug_rpc'] == 'Y') {
Logger::remember('services/xml_rpc.php: xml_rpc unsupported methodName ' . $parameters['methodName'], $parameters, 'debug');
}
}
// encode the response as an XML snippet
if (!is_string($response) || !preg_match('/^<\\?xml/', $response)) {
$result = $codec->export_response($response);
$status = @$result[0];
$response = @$result[1];
}