本文整理汇总了PHP中wbModule::call方法的典型用法代码示例。如果您正苦于以下问题:PHP wbModule::call方法的具体用法?PHP wbModule::call怎么用?PHP wbModule::call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wbModule
的用法示例。
在下文中一共展示了wbModule::call方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ws_proccess
function ws_proccess($search, $getParams, $controller, $postParams, $jsonItems, $start, $limit)
{
$GLOBALS["Webi_PageTime"] = microtime(true);
include 'lib/bootstrap.php';
/* Load Webi Core */
sys::import('webi.core');
wbCore::init();
$_GET['jsonItems'] = $jsonItems;
if (!empty($getParams)) {
$getParams =& wbUtil::jsonDecode($getParams);
} else {
$getParams = array();
}
if (json_decode($postParams) > 0) {
$postParams = json_decode($postParams);
} else {
$postParams = array();
}
$controller =& wbUtil::jsonDecode($controller);
$type = $controller['type'];
if (!empty($getParams)) {
foreach ($getParams as $key => $value) {
$_GET[$key] = $value;
}
}
if (!empty($postParams)) {
foreach ($postParams as $key => $value) {
$_POST[$key] = $value;
}
}
$_GET['module'] = $controller['module'];
$_GET['class'] = $controller['class'];
$_GET['method'] = $controller['method'];
list($module, $class, $method) = wbRequest::getController();
$callback = wbRequest::getVarClean('callback');
if (!wbModule::isAvailable($module, $class, $type)) {
header("HTTP/1.1 400 Bad Request");
return;
}
try {
$result = wbModule::call($module, $class, $method, array(), $type);
} catch (Exception $e) {
$result = array('items' => array(), 'total' => 0, 'success' => false, 'message' => $e->getMessage());
}
$return = array();
$return['success'] = $result['success'];
$return['message'] = $result['message'];
$return['total'] = (int) $result['total'];
$return['data'] = $result['items'];
$return['current'] = (int) $result['current'];
$return['rowCount'] = (int) $result['rowCount'];
$return = base64_encode(serialize($return));
return $return;
}
示例2: wbWSMain
function wbWSMain()
{
// TODO: don't load the whole core
wbCore::init();
/*
determine the server type, then
create an instance of an that server and
serve the request according the ther servers protocol
*/
$type = wbRequest::getVarClean('type');
switch ($type) {
case 'json':
list($module, $class, $method) = wbRequest::getController();
$callback = wbRequest::getVarClean('callback');
if (!wbModule::isAvailable($module, $class, $type)) {
header("HTTP/1.1 400 Bad Request");
return;
}
try {
$result = wbModule::call($module, $class, $method, array(), $type);
} catch (Exception $e) {
$result = array('items' => array(), 'total' => 0, 'success' => false, 'message' => $e->getMessage());
}
if ($result || is_array($result)) {
if (empty($callback)) {
header('Content-Type: application/json');
echo json_encode($result);
} else {
header('Content-Type: text/javascript');
echo $callback . '(' . json_encode($result) . ')';
}
} else {
header("HTTP/1.1 500 Internal Server Error");
}
break;
default:
// nothing todo for now
}
}