dever 6 năm trước cách đây
mục cha
commit
4731dde46a
2 tập tin đã thay đổi với 13 bổ sung12 xóa
  1. 12 12
      content/lib/Article.php
  2. 1 0
      main/src/Journal.php

+ 12 - 12
content/lib/Article.php

@@ -33,9 +33,9 @@ class Article
         $replace = array();
         if (strstr($data['content'], 'embed')) {
             # 音频
-            preg_match_all('/<p(.*?)>([\s]+)<embed src="(.*?)"(.*?)\/>([\s]+)<\/p>/i', $data['content'], $matches);
-            if (isset($matches[3])) {
-                foreach ($matches[3] as $k => $v) {
+            preg_match_all('/<embed src="(.*?)"(.*?)\/>/i', $data['content'], $matches);
+            if (isset($matches[1])) {
+                foreach ($matches[1] as $k => $v) {
                     $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
 
                     if (strstr($v, '.mp4')) {
@@ -49,24 +49,24 @@ class Article
 
         if (strstr($data['content'], 'data-id')) {
             # 视频
-            preg_match_all('/<p(.*?)>([\s]+)<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>([\s]+)<\/p>/', $data['content'], $matches);
+            preg_match_all('/<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>/', $data['content'], $matches);
             
             
-            if (!isset($matches[4][0])) {
-                preg_match_all('/<p(.*?)>([\s]+)<img(.*?)data-key="(.*?)" data-id="(.*?)" \/>([\s]+)<\/p>/', $data['content'], $matches);
+            if (!isset($matches[2][0])) {
+                preg_match_all('/<img(.*?)data-key="(.*?)" data-id="(.*?)" \/>([\s]+)/', $data['content'], $matches);
                 $temp = array();
-                if (isset($matches[4][0]) && isset($matches[5][0])) {
+                if (isset($matches[2][0]) && isset($matches[3][0])) {
                     $temp = $matches;
-                    $matches[4] = $temp[5];
-                    $matches[5] = $temp[4];
+                    $matches[2] = $temp[3];
+                    $matches[3] = $temp[2];
                     unset($temp);
                 }
             }
             
-            if (isset($matches[4][0]) && isset($matches[5][0])) {
-                foreach ($matches[4] as $k => $v) {
+            if (isset($matches[2][0]) && isset($matches[3][0])) {
+                foreach ($matches[2] as $k => $v) {
                     $content = str_replace($matches[0][$k], '{replace}'.count($replace).'{replace}', $content);
-                    if ($matches[5][$k] == 'video/lib/core.vod') {
+                    if ($matches[3][$k] == 'video/lib/core.vod') {
                         $method = 'video/lib/vod';
                         $type = 2;
                     } else {

+ 1 - 0
main/src/Journal.php

@@ -323,6 +323,7 @@ class Journal extends Core
         }
         # 验证是否可以阅读
         $id = $this->check();
+        $this->data['info'] = $this->info($this->data['info'], false);
 
         $subscribe = Dever::load('act/lib/subscribe')->get($id, $this->data['uid'], 4);