getOne($data); } if (!$data) { Dever::alert('错误的文章信息'); } $data = $this->getContent($data); return $data; } public function getContent($data) { //embed $data['content_array'] = array(); $data['content'] = Dever::filter($data['content']); $content = $data['content']; $replace = array(); if (strstr($data['content'], 'embed')) { # 音频 preg_match_all('/
([\s]+)([\s]+)<\/p>/i', $data['content'], $matches); if (isset($matches[3])) { foreach ($matches[3] as $k => $v) { $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content); if (strstr($v, '.mp4')) { $replace[] = array('type' => 6, 'content' => $v); } else { $replace[] = array('type' => 5, 'content' => $v); } } } } if (strstr($data['content'], 'data-id')) { # 视频 preg_match_all('/
([\s]+)([\s]+)<\/p>/', $data['content'], $matches);
            
            
            if (!isset($matches[4][0])) {
                preg_match_all('/
([\s]+)([\s]+)<\/p>/', $data['content'], $matches);
                $temp = array();
                if (isset($matches[4][0]) && isset($matches[5][0])) {
                    $temp = $matches;
                    $matches[4] = $temp[5];
                    $matches[5] = $temp[4];
                    unset($temp);
                }
            }
            
            if (isset($matches[4][0]) && isset($matches[5][0])) {
                foreach ($matches[4] as $k => $v) {
                    $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
                    if ($matches[5][$k] == 'video/lib/core.vod') {
                        $method = 'video/lib/vod';
                        $type = 2;
                    } else {
                        $type = 3;
                        $method = 'video/lib/live';
                    }
                    $info = Dever::load($method)->get($v);
                    if (isset($info['content'])) {
                        unset($info['content']);
                    }
                    $replace[] = array('id' => $v, 'type' => $type, 'content' => $info);
                }
            }
            //$data['content'] = preg_replace('/