public function getWeiboDetail($id)
 {
     $weibo = S('weibo_' . $id);
     $check_empty = empty($weibo);
     if ($check_empty) {
         $weibo = $this->where(array('status' => 1, 'id' => $id))->find();
         if (!$weibo) {
             return null;
         }
         $weibo_data = unserialize($weibo['data']);
         $class_exists = true;
         $type = array('repost', 'feed', 'image', 'share');
         if (!in_array($weibo['type'], $type)) {
             $class_exists = class_exists('Addons\\Insert' . ucfirst($weibo['type']) . '\\Insert' . ucfirst($weibo['type']) . 'Addon');
         }
         $weibo['content'] = parse_topic(parse_weibo_content($weibo['content']));
         if ($weibo['type'] === 'feed' || $weibo['type'] == '' || !$class_exists) {
             $fetchContent = "<p class='word-wrap'>" . $weibo['content'] . "</p>";
         } elseif ($weibo['type'] === 'repost') {
             $fetchContent = A('Weibo/Type')->fetchRepost($weibo);
         } elseif ($weibo['type'] === 'image') {
             $fetchContent = A('Weibo/Type')->fetchImage($weibo);
         } elseif ($weibo['type'] === 'share') {
             $fetchContent = R('Weibo/Share/getFetchHtml', array('param' => unserialize($weibo['data']), 'weibo' => $weibo), 'Widget');
         } else {
             $fetchContent = Hook::exec('Addons\\Insert' . ucfirst($weibo['type']) . '\\Insert' . ucfirst($weibo['type']) . 'Addon', 'fetch' . ucfirst($weibo['type']), $weibo);
         }
         $weibo = array('id' => intval($weibo['id']), 'content' => strval($weibo['content']), 'create_time' => intval($weibo['create_time']), 'type' => $weibo['type'], 'data' => unserialize($weibo['data']), 'weibo_data' => $weibo_data, 'comment_count' => intval($weibo['comment_count']), 'repost_count' => intval($weibo['repost_count']), 'can_delete' => 0, 'is_top' => $weibo['is_top'], 'uid' => $weibo['uid'], 'fetchContent' => $fetchContent, 'from' => $weibo['from']);
         S('weibo_' . $id, $weibo, 60 * 60);
     }
     $weibo['fetchContent'] = parse_at_users($weibo['fetchContent']);
     $weibo['user'] = query_user(array('uid', 'nickname', 'avatar64', 'space_url', 'rank_link', 'title'), $weibo['uid']);
     $weibo['can_delete'] = $this->canDeleteWeibo($weibo);
     // 判断转发的原微博是否已经删除
     if ($weibo['type'] == 'repost') {
         $source_weibo = $this->getWeiboDetail($weibo['weibo_data']['sourceId']);
         if (!$source_weibo['uid']) {
             if (!$check_empty) {
                 S('weibo_' . $id, null);
                 $weibo = $this->getWeiboDetail($id);
             }
         }
     }
     return $weibo;
 }
Exemplo n.º 2
0
function parse_comment_content($content)
{
    //就目前而言,评论内容和微博的格式是一样的。
    return parse_weibo_content($content);
}
Exemplo n.º 3
0
 private function getWeiboStructure($id)
 {
     $weibo = $this->weiboModel->find($id);
     $canDelete = $this->canDeleteWeibo($id);
     $weibo_data = unserialize($weibo['data']);
     if ($weibo['type'] === 'feed' || $weibo['type'] == '') {
         $fetchContent = "<p class='word-wrap'>" . parse_weibo_content($weibo['content']) . "</p>";
     } elseif ($weibo['type'] === 'repost') {
         $result = Hook::exec('Repost', 'fetchRepost', $weibo);
         $fetchContent = $result;
     } else {
         $result = Hook::exec('Insert' . ucfirst($weibo['type']), 'fetch' . ucfirst($weibo['type']), $weibo);
         $fetchContent = $result;
     }
     return array('id' => intval($weibo['id']), 'content' => strval($weibo['content']), 'create_time' => intval($weibo['create_time']), 'type' => $weibo['type'], 'data' => unserialize($weibo['data']), 'weibo_data' => $weibo_data, 'comment_count' => intval($weibo['comment_count']), 'repost_count' => intval($weibo['repost_count']), 'can_delete' => boolval($canDelete), 'user' => $this->getUserStructure($weibo['uid']), 'is_top' => $weibo['is_top'], 'uid' => $weibo['uid'], 'fetchContent' => $fetchContent);
 }
Exemplo n.º 4
0
 private function getWeiboStructure($id)
 {
     $weibo = S('weibo_' . $id);
     if (empty($weibo)) {
         $weibo = $this->weiboModel->find($id);
         $canDelete = $this->canDeleteWeibo($id);
         $weibo_data = unserialize($weibo['data']);
         $class_exists = true;
         $type = array('repost', 'feed');
         if (!in_array($weibo['type'], $type)) {
             $class_exists = class_exists('Addons\\Insert' . ucfirst($weibo['type']) . '\\Insert' . ucfirst($weibo['type']) . 'Addon');
         }
         if ($weibo['type'] === 'feed' || $weibo['type'] == '' || !$class_exists) {
             $fetchContent = "<p class='word-wrap'>" . parse_weibo_content($weibo['content']) . "</p>";
         } elseif ($weibo['type'] === 'repost') {
             $result = Hook::exec('Repost', 'fetchRepost', $weibo);
             $fetchContent = $result;
         } else {
             $result = Hook::exec('Insert' . ucfirst($weibo['type']), 'fetch' . ucfirst($weibo['type']), $weibo);
             $fetchContent = $result;
         }
         $weibo = array('id' => intval($weibo['id']), 'content' => strval($weibo['content']), 'create_time' => intval($weibo['create_time']), 'type' => $weibo['type'], 'data' => unserialize($weibo['data']), 'weibo_data' => $weibo_data, 'comment_count' => intval($weibo['comment_count']), 'repost_count' => intval($weibo['repost_count']), 'can_delete' => boolval($canDelete), 'user' => $this->getUserStructure($weibo['uid']), 'is_top' => $weibo['is_top'], 'uid' => $weibo['uid'], 'fetchContent' => $fetchContent, 'from' => $weibo['from']);
         S('weibo_' . $id, $weibo);
     }
     return $weibo;
 }
                            </ul>
                        </div>
                        </span>

                                <?php 
            }
            ?>
                            </p>
                            <div class="weibo_content_p">
                                <?php 
            echo $weibo["fetchContent"];
            ?>
                            </div>

                            <!--                <p class="word-wrap"><?php 
            echo parse_weibo_content($weibo["content"]);
            ?>
</p>
                                            <?php 
            if ($weibo['type'] == 'image') {
                ?>
<div class="popup-gallery"  style="width: 550px;">
                                            <?php 
                if (is_array($weibo['weibo_data']['image'])) {
                    $i = 0;
                    $__LIST__ = $weibo['weibo_data']['image'];
                    if (count($__LIST__) == 0) {
                        echo "";
                    } else {
                        foreach ($__LIST__ as $key => $vo) {
                            $mod = $i % 2;