content;
if (preg_match('/\{hide\}.{0,}\{\/hide\}/sSU', $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\}(.{0,})\{\/hide\}/sSU', '$1', $content);
} else {
$content = preg_replace('/\{hide\}(.{0,})\{\/hide\}/sSU', '此处内容作者设置了 回复 可见', $content);
}
}
/* 过滤网易云音乐歌单 */
if (preg_match('/\{music-list\s{0,}id="\d{0,}"\s{0,}\/\}/SU', $content)) {
$content = preg_replace(
'/\{music-list\s{0,}id="(\d{0,})"\s{0,}\/\}/SU',
'',
$content
);
}
/* 过滤网易云音乐单首歌 */
if (preg_match('/\{music\s{0,}id="\d{0,}"\s{0,}\/\}/SU', $content)) {
$content = preg_replace(
'/\{music\s{0,}id="(\d{0,})"\s{0,}\/\}/SU',
'',
$content
);
}
/* 过滤dplayer播放器 */
if (preg_match('/\{dplayer\s{0,}src=".{0,}"\s{0,}\/\}/sSU', $content)) {
$player = Helper::options()->JCustomPlayer ? Helper::options()->JCustomPlayer : '/usr/themes/Joe/library/player.php?url=';
$content = preg_replace(
'/\{dplayer\s{0,}src="(.{0,})"\s{0,}\/\}/sSU',
'',
$content
);
}
/* 过滤bilibili播放器 */
if (preg_match('/\{bilibili\s{0,}bvid="\w{0,}"\s{0,}\/\}/sSU', $content)) {
$content = preg_replace(
'/\{bilibili\s{0,}bvid="(\w{0,})"\s{0,}\/\}/sSU',
'',
$content
);
}
/* 过滤完成任务勾选 */
if (preg_match('/\{x\}/SU', $content)) {
$content = preg_replace(
'/\{x\}/SU',
'',
$content
);
}
/* 过滤未完成任务勾选 */
if (preg_match('/\{\s{1}\}/SU', $content)) {
$content = preg_replace(
'/\{\s{1}\}/SU',
'',
$content
);
}
/* 过滤默认卡片 */
if (preg_match('/\{card-default\s{0,}width=".{0,}"\s{0,}label=".{0,}"\s{0,}\}.{0,}\{\/card-default\}/sSU', $content)) {
$content = preg_replace(
'/\{card-default\s{0,}width="(.{0,})"\s{0,}label="(.{0,})"\s{0,}\}(.{0,})\{\/card-default\}/sSU',
'
$2
$3
',
$content
);
}
/* 过滤消息提示 */
if (preg_match('/\{message\s{0,}type="success|info|warning|error"\s{0,}\}.{0,}\{\/message\}/sSU', $content)) {
$content = preg_replace(
'/\{message\s{0,}type="(success|info|warning|error)"\s{0,}\}(.{0,})\{\/message\}/sSU',
'
$2
',
$content
);
}
/* 过滤居中标题 */
if (preg_match('/\{mtitle\}.{0,}\{\/mtitle\}/sSU', $content)) {
$content = preg_replace(
'/\{mtitle\}(.{0,})\{\/mtitle\}/sSU',
'
$1
',
$content
);
}
/* 过滤note button */
if (preg_match('/\{anote\s{0,}icon=".{0,}"\s{0,}href=".{0,}"\s{0,}type="secondary|success|warning|error|info"\s{0,}}.{0,}\{\/anote\}/sSU', $content)) {
$content = preg_replace(
'/\{anote\s{0,}icon="(.{0,})"\s{0,}href="(.{0,})"\s{0,}type="(secondary|success|warning|error|info)"\s{0,}}(.{0,})\{\/anote\}/sSU',
'
$4
',
$content
);
}
/* 过滤note button */
if (preg_match('/\{abtn\s{0,}icon=".{0,}"\s{0,}color=".{0,}"\s{0,}href=".{0,}"\s{0,}radius=".{0,}"\s{0,}\}.{0,}\{\/abtn\}/sSU', $content)) {
$content = preg_replace(
'/\{abtn\s{0,}icon="(.{0,})"\s{0,}color="(.{0,})"\s{0,}href="(.{0,})"\s{0,}radius="(.{0,})"\s{0,}\}(.{0,})\{\/abtn\}/sSU',
'
$5
',
$content
);
}
echo $content;
}