|
@@ -35,7 +35,7 @@ class Article
|
|
|
# embed已废弃
|
|
|
if (strstr($data['content'], 'embed')) {
|
|
|
# 音频
|
|
|
- preg_match_all('/<embed src="(.*?)"(.*?)\/>/i', $data['content'], $matches);
|
|
|
+ preg_match_all('/<embed src="(.*?)"(.*?)\/>/i', $content, $matches);
|
|
|
if (isset($matches[1])) {
|
|
|
foreach ($matches[1] as $k => $v) {
|
|
|
$content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
|
|
@@ -49,12 +49,29 @@ class Article
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (strstr($data['content'], 'data-applet')) {
|
|
|
+ # 小程序
|
|
|
+ preg_match_all('/<img(.*?)data-applet="(.*?)" \/>/', $content, $matches);
|
|
|
+
|
|
|
+ if (isset($matches[2])) {
|
|
|
+ foreach ($matches[2] as $k => $v) {
|
|
|
+ $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
|
|
|
+ $temp = explode('||', $v);
|
|
|
+ $pic = $temp[0];
|
|
|
+ $appid = $temp[1];
|
|
|
+ $path = $temp[2];
|
|
|
+
|
|
|
+ $replace[] = array('type' => 7, 'pic_cover' => $pic, 'appid' => $appid, 'path' => $path);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (strstr($data['content'], 'data-file')) {
|
|
|
# 音频
|
|
|
- preg_match_all('/<img src="(.*?)" style="(.*?)" data-file="(.*?)" \/>/', $data['content'], $matches);
|
|
|
+ preg_match_all('/<img src="(.*?)" style="(.*?)" data-file="(.*?)" \/>/', $content, $matches);
|
|
|
|
|
|
if (!isset($matches[1][0])) {
|
|
|
- preg_match_all('/<img style="(.*?)" src="(.*?)" data-file="(.*?)" \/>/', $data['content'], $matches);
|
|
|
+ preg_match_all('/<img style="(.*?)" src="(.*?)" data-file="(.*?)" \/>/', $content, $matches);
|
|
|
$temp = array();
|
|
|
if (isset($matches[2][0])) {
|
|
|
$temp = $matches;
|
|
@@ -71,7 +88,12 @@ class Article
|
|
|
$file = $matches[3][$k];
|
|
|
$temp = explode('||', $file);
|
|
|
$file = $temp[0];
|
|
|
- $name = $temp[1];
|
|
|
+ if (isset($temp[1])) {
|
|
|
+ $name = $temp[1];
|
|
|
+ } else {
|
|
|
+ $name = '';
|
|
|
+ }
|
|
|
+
|
|
|
$cover = $v;
|
|
|
|
|
|
if (strstr($v, '.mp4') || strstr($v, '.mov') || strstr($v, '.m3u8')) {
|
|
@@ -86,11 +108,11 @@ class Article
|
|
|
|
|
|
if (strstr($data['content'], 'data-id')) {
|
|
|
# 视频+直播
|
|
|
- preg_match_all('/<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>/', $data['content'], $matches);
|
|
|
+ preg_match_all('/<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>/', $content, $matches);
|
|
|
|
|
|
|
|
|
if (!isset($matches[2][0])) {
|
|
|
- preg_match_all('/<img(.*?)data-key="(.*?)" data-id="(.*?)" \/>/', $data['content'], $matches);
|
|
|
+ preg_match_all('/<img(.*?)data-key="(.*?)" data-id="(.*?)" \/>/', $content, $matches);
|
|
|
$temp = array();
|
|
|
if (isset($matches[2][0]) && isset($matches[3][0])) {
|
|
|
$temp = $matches;
|