This commit is contained in:
haoouba 2021-01-29 23:38:41 +08:00
parent e1a2bf3fed
commit b90f32d4b0
4 changed files with 38 additions and 4 deletions

View File

@ -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}}

View File

@ -44,6 +44,12 @@ input[type='text'] {
font-weight: 500;
}
iframe {
display: block;
border: none;
margin: 0 auto;
}
textarea {
resize: none;
-webkit-appearance: none;

View File

@ -1,22 +1,27 @@
<?php
/* 过滤短代码 */
require_once('short.php');
/* 过滤文章内容 */
function _parseContent($post, $login)
{
/* 优先判断文章内是否有回复可见的内容 */
$content = $post->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', '<span class="joe_detail__article-hide block">此处内容作者设置了 <i>回复</i> 可见</span>', $content);
$content = preg_replace('/\[hide\](.{0,})\[\/hide\]/s', '<span class="joe_detail__article-hide block">此处内容作者设置了 <i>回复</i> 可见</span>', $content);
}
}
$content = _parseShortCode($content);
echo $content;
}
/* 过滤评论回复 */
function _parseCommentReply($text)
{

23
core/short.php Normal file
View File

@ -0,0 +1,23 @@
<?php
function _parseShortCode($content)
{
/* 过滤网易云音乐歌单 */
if (preg_match('/\[music-list\s{0,}id="\d{0,}"\s{0,}\/]/', $content)) {
$content = preg_replace(
'/\[music-list\s{0,}id="(\d{0,})"\s{0,}\/]/',
'<iframe width="330" height="450" src="//music.163.com/outchain/player?type=0&id=$1&auto=0&height=430"></iframe>',
$content
);
}
/* 过滤网易云音乐单首歌 */
if (preg_match('/\[music\s{0,}id="\d{0,}"\s{0,}\/]/', $content)) {
$content = preg_replace(
'/\[music\s{0,}id="(\d{0,})"\s{0,}\/]/',
'<iframe width="330" height="86" src="//music.163.com/outchain/player?type=2&id=$1&auto=0&height=66"></iframe>',
$content
);
}
return $content;
}