2021-01-29 15:38:41 +00:00
|
|
|
<?php
|
|
|
|
|
2021-02-06 10:33:20 +00:00
|
|
|
function _parseContent($post, $login)
|
2021-01-29 15:38:41 +00:00
|
|
|
{
|
2021-02-06 10:33:20 +00:00
|
|
|
$content = $post->content;
|
2021-02-18 13:28:07 +00:00
|
|
|
$content = _parseReply($content);
|
2021-03-26 07:27:06 +00:00
|
|
|
|
|
|
|
if (strpos($content, '{x}') !== false || strpos($content, '{ }') !== false) {
|
|
|
|
$content = strtr($content, array(
|
|
|
|
"{x}" => '<input type="checkbox" class="joe_detail__article-checkbox" checked disabled></input>',
|
|
|
|
"{ }" => '<input type="checkbox" class="joe_detail__article-checkbox" disabled></input>'
|
|
|
|
));
|
|
|
|
}
|
|
|
|
if (strpos($content, '{music') !== false) {
|
2021-03-30 10:00:49 +00:00
|
|
|
$content = preg_replace('/{music-list([^}]*)\/}/SU', '<joe-mlist $1></joe-mlist>', $content);
|
|
|
|
$content = preg_replace('/{music([^}]*)\/}/SU', '<joe-music $1></joe-music>', $content);
|
2021-03-30 08:45:25 +00:00
|
|
|
}
|
2021-04-21 14:48:18 +00:00
|
|
|
if (strpos($content, '{mp3') !== false) {
|
|
|
|
$content = preg_replace('/{mp3([^}]*)\/}/SU', '<joe-mp3 $1></joe-mp3>', $content);
|
|
|
|
}
|
2021-03-30 08:45:25 +00:00
|
|
|
if (strpos($content, '{bilibili') !== false) {
|
2021-03-30 10:00:49 +00:00
|
|
|
$content = preg_replace('/{bilibili([^}]*)\/}/SU', '<joe-bilibili $1></joe-bilibili>', $content);
|
2021-03-26 07:27:06 +00:00
|
|
|
}
|
2021-03-30 09:57:47 +00:00
|
|
|
if (strpos($content, '{dplayer') !== false) {
|
|
|
|
$player = Helper::options()->JCustomPlayer ? Helper::options()->JCustomPlayer : Helper::options()->themeUrl . '/library/player.php?url=';
|
|
|
|
$content = preg_replace('/{dplayer([^}]*)\/}/SU', '<joe-dplayer player="' . $player . '" $1></joe-dplayer>', $content);
|
|
|
|
}
|
2021-04-02 05:09:15 +00:00
|
|
|
if (strpos($content, '{mtitle') !== false) {
|
|
|
|
$content = preg_replace('/{mtitle([^}]*)\/}/SU', '<joe-mtitle $1></joe-mtitle>', $content);
|
|
|
|
}
|
2021-04-16 09:09:40 +00:00
|
|
|
if (strpos($content, '{abtn') !== false) {
|
|
|
|
$content = preg_replace('/{abtn([^}]*)\/}/SU', '<joe-abtn $1></joe-abtn>', $content);
|
|
|
|
}
|
2021-04-16 10:00:42 +00:00
|
|
|
if (strpos($content, '{anote') !== false) {
|
|
|
|
$content = preg_replace('/{anote([^}]*)\/}/SU', '<joe-anote $1></joe-anote>', $content);
|
|
|
|
}
|
2021-04-17 04:19:43 +00:00
|
|
|
if (strpos($content, '{dotted') !== false) {
|
|
|
|
$content = preg_replace('/{dotted([^}]*)\/}/SU', '<joe-dotted $1></joe-dotted>', $content);
|
|
|
|
}
|
2021-04-21 07:09:39 +00:00
|
|
|
if (strpos($content, '{message') !== false) {
|
|
|
|
$content = preg_replace('/{message([^}]*)\/}/SU', '<joe-message $1></joe-message>', $content);
|
|
|
|
}
|
|
|
|
if (strpos($content, '{progress') !== false) {
|
|
|
|
$content = preg_replace('/{progress([^}]*)\/}/SU', '<joe-progress $1></joe-progress>', $content);
|
|
|
|
}
|
2021-04-19 01:55:55 +00:00
|
|
|
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 {
|
2021-04-20 10:07:20 +00:00
|
|
|
$content = preg_replace('/{hide[^}]*}([\s\S]*?){\/hide}/', '<joe-hide></joe-hide>', $content);
|
2021-04-19 01:55:55 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-19 07:18:29 +00:00
|
|
|
if (strpos($content, '{card-default') !== false) {
|
2021-04-20 10:07:20 +00:00
|
|
|
$content = preg_replace('/{card-default([^}]*)}([\s\S]*?){\/card-default}/', '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>', $content);
|
2021-04-19 07:18:29 +00:00
|
|
|
}
|
2021-04-21 08:07:59 +00:00
|
|
|
if (strpos($content, '{callout') !== false) {
|
|
|
|
$content = preg_replace('/{callout([^}]*)}([\s\S]*?){\/callout}/', '<section style="margin-bottom: 15px"><joe-callout $1><span class="_temp" style="display: none">$2</span></joe-callout></section>', $content);
|
|
|
|
}
|
2021-04-22 07:36:33 +00:00
|
|
|
if (strpos($content, '{tabs') !== false) {
|
|
|
|
$content = preg_replace('/{tabs}([\s\S]*?){\/tabs}/', '<section style="margin-bottom: 15px"><joe-tabs><span class="_temp" style="display: none">$1</span></joe-tabs></section>', $content);
|
|
|
|
}
|
2021-04-22 08:30:13 +00:00
|
|
|
if (strpos($content, '{card-list') !== false) {
|
|
|
|
$content = preg_replace('/{card-list}([\s\S]*?){\/card-list}/', '<section style="margin-bottom: 15px"><joe-card-list><span class="_temp" style="display: none">$1</span></joe-card-list></section>', $content);
|
|
|
|
}
|
2021-03-26 07:27:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-07 09:32:06 +00:00
|
|
|
/* 过滤复制粘贴功能 */
|
2021-03-05 07:49:33 +00:00
|
|
|
if (strpos($content, '{copy') !== false) {
|
|
|
|
$content = preg_replace('/{copy(.*)}/SU', '<joe-copy $1>', $content);
|
|
|
|
$content = preg_replace('/{\/copy}/SU', '</joe-copy>', $content);
|
2021-02-07 09:32:06 +00:00
|
|
|
}
|
2021-02-06 10:33:20 +00:00
|
|
|
echo $content;
|
2021-01-29 15:38:41 +00:00
|
|
|
}
|