content;
/* 过滤表情 */
$content = _parseReply($content);
/* 过滤默认卡片 */
if (strpos($content, '{/card-default}') !== false) {
$content = preg_replace_callback(
'/\{card-default\s*width="(.*)"\s*label="(.*)"\s*\}(.*)\{\/card-default\}/sSU',
function ($matches) {
return '
' . $matches[2] . '
' . $matches[3] . '
';
},
$content
);
}
/* 过滤消息提示 */
if (strpos($content, '{/message}') !== false) {
$content = preg_replace_callback(
'/\{message\s*type="(success|info|warning|error)"\s*\}(.*)\{\/message\}/sSU',
function ($matches) {
return '
' . $matches[2] . '
';
},
$content
);
}
/* 过滤note button */
if (strpos($content, '{/anote}') !== false) {
$content = preg_replace_callback(
'/\{anote\s*icon="(.*)"\s*href="(.*)"\s*type="(secondary|success|warning|error|info)"\s*}(.*)\{\/anote\}/sSU',
function ($matches) {
return '
' . $matches[4] . '
';
},
$content
);
}
/* 过滤普通button */
if (strpos($content, '{/abtn}') !== false) {
$content = preg_replace_callback(
'/\{abtn\s*icon="(.*)"\s*color="(.*)"\s*href="(.*)"\s*radius="(.*)"\s*\}(.*)\{\/abtn\}/sSU',
function ($matches) {
return '
' . $matches[5] . '
';
},
$content
);
}
/* 过滤回复可见 */
if (strpos($content, '{/hide}') !== false) {
$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 = strtr($content, array("{hide}" => "", "{/hide}" => ""));
} else {
$content = preg_replace_callback(
'/\{hide\}.*\{\/hide\}/sSU',
function () {
return '此处内容作者设置了 回复 可见';
},
$content
);
}
}
/* 过滤网易云音乐 */
if (strpos($content, '{music') !== false) {
$content = preg_replace_callback(
'/\{music-list\s*id="(\w*)"\s*\/\}/SU',
function ($matches) {
return '';
},
$content
);
$content = preg_replace_callback(
'/\{music\s*id="(\w*)"\s*\/\}/SU',
function ($matches) {
return '';
},
$content
);
}
/* 过滤dplayer播放器 */
if (strpos($content, '{dplayer') !== false) {
$content = preg_replace_callback(
'/\{dplayer\s*src="(.*)"\s*\/\}/sSU',
function ($matches) {
$player = Helper::options()->JCustomPlayer ? Helper::options()->JCustomPlayer : '/usr/themes/Joe/library/player.php?url=';
return '';
},
$content
);
}
/* 过滤bilibili播放器 */
if (strpos($content, '{bilibili') !== false) {
$content = preg_replace_callback(
'/\{bilibili\s*bvid="(\w*)"\s*\/\}/sSU',
function ($matches) {
return '';
},
$content
);
}
/* 过滤完成任务勾选 */
if (strpos($content, '{x}') !== false || strpos($content, '{ }') !== false) {
$content = strtr($content, array(
"{x}" => '',
"{ }" => ''
));
}
/* 过滤复制粘贴功能 */
if (strpos($content, '{/copy}') !== false) {
$content = preg_replace_callback(
'/\{copy\s*text="(.*)"\s*\}(.*)\{\/copy\}/sSU',
function ($matches) {
return '' . $matches[2] . '';
},
$content
);
}
/* 过滤居中标题 */
if (strpos($content, '{/mtitle}') !== false) {
$content = strtr($content, array(
"{mtitle}" => '',
"{/mtitle}" => ''
));
}
echo $content;
}