From b90f32d4b0bb30adc801081043acabfc50c6dfa6 Mon Sep 17 00:00:00 2001 From: haoouba <2323333339@qq.com> Date: Fri, 29 Jan 2021 23:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/joe.normalize.css | 2 +- assets/css/joe.normalize.scss | 6 ++++++ core/parse.php | 11 ++++++++--- core/short.php | 23 +++++++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 core/short.php diff --git a/assets/css/joe.normalize.css b/assets/css/joe.normalize.css index c4f089c..db3262f 100644 --- a/assets/css/joe.normalize.css +++ b/assets/css/joe.normalize.css @@ -1 +1 @@ -*{margin:0;padding:0;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{border-radius:4px;background:var(--seat)}::-webkit-scrollbar-track{background:transparent}body{font-size:14px;font-family:'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif}body::before{content:'';position:fixed;top:0;left:0;right:0;bottom:0;z-index:-520;pointer-events:none}input[type='text']{-webkit-appearance:none;border-radius:0;font-size:13px;font-weight:500}textarea{resize:none;-webkit-appearance:none}li{list-style:none}a{text-decoration:none}h1,h2,h3,h4,h5,h6{font-weight:500}img{border:0;vertical-align:middle}img[src=''],img:not([src]){border:0;opacity:0}svg,canvas{vertical-align:middle}button{cursor:pointer;-webkit-appearance:none;font-size:13px}table{border-collapse:collapse;border-spacing:0}.joe_main{min-width:0;flex:1;padding:15px 0}.joe_container{display:flex;width:100%;margin:0 auto;padding:0 15px}@media (min-width: 576px){.joe_container{max-width:540px}}@media (min-width: 768px){.joe_container{max-width:720px}}@media (min-width: 992px){.joe_container{max-width:960px}}@media (min-width: 1200px){.joe_container{max-width:1140px}}@media (min-width: 1400px){.joe_container{max-width:1320px}} +*{margin:0;padding:0;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{border-radius:4px;background:var(--seat)}::-webkit-scrollbar-track{background:transparent}body{font-size:14px;font-family:'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif}body::before{content:'';position:fixed;top:0;left:0;right:0;bottom:0;z-index:-520;pointer-events:none}input[type='text']{-webkit-appearance:none;border-radius:0;font-size:13px;font-weight:500}iframe{display:block;border:none;margin:0 auto}textarea{resize:none;-webkit-appearance:none}li{list-style:none}a{text-decoration:none}h1,h2,h3,h4,h5,h6{font-weight:500}img{border:0;vertical-align:middle}img[src=''],img:not([src]){border:0;opacity:0}svg,canvas{vertical-align:middle}button{cursor:pointer;-webkit-appearance:none;font-size:13px}table{border-collapse:collapse;border-spacing:0}.joe_main{min-width:0;flex:1;padding:15px 0}.joe_container{display:flex;width:100%;margin:0 auto;padding:0 15px}@media (min-width: 576px){.joe_container{max-width:540px}}@media (min-width: 768px){.joe_container{max-width:720px}}@media (min-width: 992px){.joe_container{max-width:960px}}@media (min-width: 1200px){.joe_container{max-width:1140px}}@media (min-width: 1400px){.joe_container{max-width:1320px}} diff --git a/assets/css/joe.normalize.scss b/assets/css/joe.normalize.scss index fc2ad84..e3a89fe 100644 --- a/assets/css/joe.normalize.scss +++ b/assets/css/joe.normalize.scss @@ -44,6 +44,12 @@ input[type='text'] { font-weight: 500; } +iframe { + display: block; + border: none; + margin: 0 auto; +} + textarea { resize: none; -webkit-appearance: none; diff --git a/core/parse.php b/core/parse.php index 881c2ef..2cfeaa9 100644 --- a/core/parse.php +++ b/core/parse.php @@ -1,22 +1,27 @@ content; - if (preg_match('/\[hide\].*\[\/hide\]/', $content)) { + if (preg_match('/\[hide\].{0,}\[\/hide\]/s', $content)) { $db = Typecho_Db::get(); $hasComment = $db->fetchAll($db->select()->from('table.comments')->where('cid = ?', $post->cid)->where('mail = ?', $post->remember('mail', true))->limit(1)); if ($hasComment || $login) { - $content = preg_replace('/\[hide\](.*?)\[\/hide\]/sm', '$1', $content); + $content = preg_replace('/\[hide\](.{0,})\[\/hide\]/s', '$1', $content); } else { - $content = preg_replace('/\[hide\](.*?)\[\/hide\]/sm', '此处内容作者设置了 回复 可见', $content); + $content = preg_replace('/\[hide\](.{0,})\[\/hide\]/s', '此处内容作者设置了 回复 可见', $content); } } + $content = _parseShortCode($content); echo $content; } + /* 过滤评论回复 */ function _parseCommentReply($text) { diff --git a/core/short.php b/core/short.php new file mode 100644 index 0000000..5c6f26e --- /dev/null +++ b/core/short.php @@ -0,0 +1,23 @@ +', + $content + ); + } + /* 过滤网易云音乐单首歌 */ + if (preg_match('/\[music\s{0,}id="\d{0,}"\s{0,}\/]/', $content)) { + $content = preg_replace( + '/\[music\s{0,}id="(\d{0,})"\s{0,}\/]/', + '', + $content + ); + } + + return $content; +}