diff options
| author | 阔落 <45323514+BigCoke233@users.noreply.github.com> | 2019-03-31 11:51:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-31 11:51:06 +0800 |
| commit | 2c02629159585cceb8404e044b0163084f7a2be5 (patch) | |
| tree | 2aaea21d8a1ddc93ecfd23f6c2aecfb88df66c23 /includes | |
| parent | fa517835b688184455c6942ecac466b8e17f9ad7 (diff) | |
修复不正确的解析
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/post-content.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/includes/post-content.php b/includes/post-content.php index b60b52e..5aa7653 100644 --- a/includes/post-content.php +++ b/includes/post-content.php @@ -1,9 +1,8 @@ <?php
- //解析灯箱、图片描述、表格、代码框
- $content = preg_replace('/<img(.*?)src="(.*?)" alt="(.*?)" title="(.*?)"(.*?)>/s','<a data-fancybox="gallery" href="${2}"><img${1}src="${2}"${5}></a><span class="post-img-alt">${4}</span>',$this->content);
- $content = preg_replace('/<table(.*?)>/s','<table class="table table-striped table-hover">',$this->content);
+ $content = preg_replace('/<table(.*?)>/s','<table class="table table-striped table-hover">',$this->content);
$content = preg_replace('/<pre><code>/s','<pre><code class="language-html">',$this->content);
-
+ $content = preg_replace('/<img(.*?)src="(.*?)"(.*?)>/s','<a data-fancybox="gallery" href="${2}"><img${1}src="${2}"${3}></a>',$this->content);
+
//短代码(无参数)
$reg = '/\[scode\](.*?)\[\/scode\]/s';
$rp = '<div class="tip">${1}</div>';
@@ -45,5 +44,6 @@ $rp = '<div class="post-stext">${1}</div>';
$content = preg_replace($reg,$rp,$content);
+
echo $content
?>
\ No newline at end of file |
