ProfileAction::collection PHP Method

collection() public method

public collection ( )
    public function collection()
    {
        $this->_top();
        $this->_assignUserInfo($this->uid);
        // 获取信息
        if ($_GET['feed_type'] == 'weiba') {
            $map['uid'] = $this->uid;
            $post = M('weiba_favorite')->where($map)->select();
            $maps['post_id'] = array('in', getSubByKey($post, 'post_id'));
            $weiba = M('weiba_post')->where($maps)->select();
            $weiba_ids = getSubByKey($weiba, 'weiba_id');
            $nameArr = $this->_getWeibaName($weiba_ids);
            foreach ($weiba as $k => $v) {
                $weiba[$k]['weiba'] = $nameArr[$v['weiba_id']];
                $weiba[$k]['user'] = model('User')->getUserInfo($v['post_uid']);
                $weiba[$k]['replyuser'] = model('User')->getUserInfo($v['last_reply_uid']);
                // $images = matchImages($v['content']);
                // $images[0] && $weiba[$k]['image'] = array_slice( $images , 0 , 5 );
                $image = getEditorImages($v['content']);
                !empty($image) && ($weiba[$k]['image'] = array($image));
                // 匹配图片的src
                preg_match_all('#<img.*?src="([^"]*)"[^>]*>#i', $v['content'], $match);
                foreach ($match[1] as $imgurl) {
                    $imgurl = $imgurl;
                    if (!empty($imgurl)) {
                        $weiba[$k]['img'][] = $imgurl;
                    }
                }
                $is_digg = M('weiba_post_digg')->where('post_id=' . $v['post_id'] . ' and uid=' . $this->mid)->find();
                $weiba[$k]['digg'] = $is_digg ? 'digg' : 'undigg';
                $weiba[$k]['content'] = t($weiba[$k]['content']);
            }
            $this->assign('weiba', $weiba);
        }
        $this->display();
    }