当前位置: 首页>>代码示例>>PHP>>正文


PHP wbModule::isAvailable方法代码示例

本文整理汇总了PHP中wbModule::isAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP wbModule::isAvailable方法的具体用法?PHP wbModule::isAvailable怎么用?PHP wbModule::isAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wbModule的用法示例。


在下文中一共展示了wbModule::isAvailable方法的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;
}
开发者ID:wiliamdecosta,项目名称:ifalconi_ws_oci_responsive,代码行数:54,代码来源:wsdl.php

示例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
    }
}
开发者ID:rayminami,项目名称:cc_webservice,代码行数:39,代码来源:ws.php


注:本文中的wbModule::isAvailable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。