Exemplo n.º 1
0
function appgame_onebox_callback($match)
{
    $ori_url = $match[0];
    $api_prefix = $match[1];
    $can_save = false;
    $res_body = get_oembed_from_api($api_prefix, $ori_url);
    $return = make_oembed_template($res_body, $ori_url, $can_save);
    return $return;
}
Exemplo n.º 2
0
function get_appgame_oembed_content($api_prefix, $ori_url)
{
    if ($res = get_cache_data($ori_url)) {
        return $res;
    }
    if ($res = get_cache_data($ori_url . ERROR_NAME)) {
        return $res;
    }
    $can_save = false;
    $res_body = get_oembed_from_api($api_prefix, $ori_url);
    $return = make_oembed_template($res_body, $ori_url, $can_save);
    if ($can_save) {
        put_cache_data($ori_url, $return);
        error_log('new done: ' . $ori_url . ' from ' . $_SERVER['REQUEST_URI']);
    } else {
        put_cache_data($ori_url . ERROR_NAME, $return);
        //资料不全?需要通知相关人等
        error_log('not done: ' . $ori_url . ' from ' . $_SERVER['REQUEST_URI']);
    }
    return $return;
}