Example #1
0
function process_onebox_result($req_url, $res_type)
{
    if ($res_obj = get_onebox_url($req_url)) {
        if ($res_type === 'json') {
            $res_obj['status'] = 'ok';
            return jsonp_nocache_exit($res_obj);
        }
        return html_nocache_exit(onebox_output($res_obj));
    } else {
        if ($res_type === 'json') {
            return jsonp_nocache_exit(array('status' => 'error', 'error' => 'no handler'));
        } else {
            return html_nocache_exit($req_url);
        }
    }
}
Example #2
0
    jsonp_nocache_exit(['status' => 'error', 'error' => 'not found schema.json']);
}
$mapper = object_read("{$table_root}/mapper.json");
$map_key = mapper_key($req_map_key);
$map_val = @$mapper[$map_key];
if (empty($map_val)) {
    $map_val = strval(intval($req_map_key));
}
$map_file = "{$table_root}/{$map_val}.json";
if (!file_exists($map_file)) {
    jsonp_nocache_exit(['status' => 'error', 'error' => 'not found target file']);
}
$onebox = onebox_object($schema, $map_file);
$res = array();
$res['provider_name'] = '任玩堂游戏数据库';
$res['provider_url'] = 'http://db.appgame.com/';
$res['favicon_url'] = 'http://www.appgame.com/favicon.ico';
$res['ori_url'] = $onebox['url'];
$res['ID'] = $onebox['id'];
$res['title'] = $onebox['title'];
$res['image'] = $onebox['image'];
$res['update_time'] = $onebox['time'];
$res['create_time'] = $onebox['ctime'];
$res['description'] = $onebox['desc'];
$res_type = @$req['type'];
if ($res_type === 'json') {
    $res['status'] = 'ok';
    return jsonp_nocache_exit($res);
}
return html_nocache_exit(onebox_output($res));