Пример #1
0
function s_weibo_sample(&$weibo, $timeshow = 'ago', $autolink = true)
{
    if (s_bad_array($weibo)) {
        return false;
    }
    //添加wid变量和uid变量
    $weibo['wid'] = $weibo['idstr'];
    $weibo['uid'] = $weibo['user']['idstr'];
    //添加缩略图 small 和 big变量
    $weibo['small'] = $weibo['thumbnail_pic'];
    $weibo['big'] = $weibo['original_pic'];
    //添加用户头像 a50 和 a180
    $weibo['a50'] = $weibo['user']['profile_image_url'];
    $weibo['a180'] = $weibo['user']['avatar_large'];
    //添加用户的昵称
    $weibo['purl'] = $weibo['user']['profile_url'];
    $weibo['uname'] = $weibo['user']['screen_name'];
    //时间 ago / x月x日 x时x分
    if ($timeshow === 'ago') {
        // 换成'三天以前'
        $weibo['time'] = s_weibo_ago($weibo['created_at'], false);
    } else {
        // 换成timeshow的格式
        $weibo['time'] = s_weibo_time($weibo['created_at'], $timeshow);
    }
    if ($autolink === true) {
        //将text中所有微博关键字都添加为可点击连接
        $weibo['text'] = s_string_at($weibo['text']);
        $weibo['text'] = s_string_turl($weibo['text']);
        $weibo['text'] = s_string_face($weibo['text']);
        $weibo['text'] = s_string_subject($weibo['text']);
    }
    return $weibo;
}
Пример #2
0
function s_string_whtml(&$string)
{
    if (s_bad_string($string, $trim)) {
        return false;
    }
    $string = s_string_subject($string);
    $string = s_string_face($string);
    $string = s_string_turl($string);
    $string = s_string_at($string);
    return $string;
}