Esempio n. 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);
        }
    }
}
Esempio n. 2
0
 }
 $counter_file_changed = 0;
 $counter_all++;
 echo '<h2>' . $file . '</h2>';
 foreach ($onebox_url_routes as $route) {
     $oneboxs = @$data_obj[$route[0]][$route[1]];
     if (empty($oneboxs)) {
         continue;
     }
     $new_oneboxs = array();
     foreach ($oneboxs as $onebox) {
         $url = $onebox['url'];
         if (empty($url)) {
             continue;
         }
         $res_obj = get_onebox_url($url);
         if (!isset($onebox['time'])) {
             $onebox['time'] = gm_date(time());
         }
         $ctime_str = @$onebox['ctime'];
         if (empty($ctime_str)) {
             $ctime_str = $onebox['time'];
         }
         $new_ctime = __strtotime($res_obj['create_time']);
         $ori_ctime = __strtotime($ctime_str);
         $ctime = gm_date(min($new_ctime, $ori_ctime));
         $new_onebox = array();
         $new_onebox['title'] = $res_obj['title'];
         $new_onebox['desc'] = $res_obj['description'];
         $new_onebox['image'] = $res_obj['image'];
         $new_onebox['url'] = $res_obj['ori_url'];