|
@@ -40,13 +40,17 @@ class Article
|
|
|
$data['content'] = str_replace('"="', '', $data['content']);
|
|
|
}
|
|
|
|
|
|
+ $content = $data['content'];
|
|
|
+ $replace = array();
|
|
|
if (strstr($data['content'], 'embed')) {
|
|
|
//print_r($data['content']);die;
|
|
|
# 音频
|
|
|
- preg_match_all('/<embed src="(.*?)"(.*?)\/>/i', $data['content'], $matches);
|
|
|
- if (isset($matches[1])) {
|
|
|
- foreach ($matches[1] as $k => $v) {
|
|
|
+ preg_match_all('/<p(.*?)>([\s]+)<embed src="(.*?)"(.*?)\/>([\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);
|
|
|
|
|
|
+ $replace[] = array('type' => 5, 'content' => $v);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -54,11 +58,11 @@ class Article
|
|
|
if (strstr($data['content'], 'data-id')) {
|
|
|
# 视频
|
|
|
preg_match_all('/<p(.*?)>([\s]+)<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>([\s]+)<\/p>/', $data['content'], $matches);
|
|
|
- $replace = array();
|
|
|
- $content = $data['content'];
|
|
|
+
|
|
|
+
|
|
|
if (isset($matches[4][0]) && isset($matches[5][0])) {
|
|
|
foreach ($matches[4] as $k => $v) {
|
|
|
- $content = str_replace($matches[0][$k], '{replace}'.$k.'{replace}', $content);
|
|
|
+ $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;
|
|
@@ -71,7 +75,7 @@ class Article
|
|
|
if (isset($info['content'])) {
|
|
|
unset($info['content']);
|
|
|
}
|
|
|
- $replace[$k] = array('id' => $v, 'type' => $type, 'content' => $info);
|
|
|
+ $replace[] = array('id' => $v, 'type' => $type, 'content' => $info);
|
|
|
}
|
|
|
}
|
|
|
|