' . $content;
}
$result = preg_replace_callback(
$pattern,
function($m) {
debug_log("Match found: " . print_r($m, true));
$href = htmlspecialchars($m[1], ENT_QUOTES, 'UTF-8');
$wpname = htmlspecialchars($m[2], ENT_QUOTES, 'UTF-8');
$pass = htmlspecialchars($m[3], ENT_QUOTES, 'UTF-8');
$disk_names = [
'baidu' => '百度网盘',
'aliyun' => '阿里云盘',
'thunder' => '迅雷云盘',
'quark' => '夸克网盘',
'uc' => 'UC网盘',
'lanzou' => '蓝奏云'
];
$disk_name = isset($disk_names[$wpname]) ? $disk_names[$wpname] : $wpname;
$html = '
';
$html .= '
';
$html .= '

';
$html .= '
'.$disk_name.'';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
$html .= '
';
debug_log("Generated HTML: " . $html);
return $html;
},
$content
);
// 如果有网盘短代码,添加闭合标签
if (preg_match($pattern, $content)) {
$result .= '
';
}
if ($result === $content) {
debug_log("No changes were made to content");
} else {
debug_log("Content was modified");
}
return $result;
}
// 处理主贴
if (isset($first['message_fmt'])) {
debug_log('Processing main post...');
$temp = fxz_netdisk_parse($first['message_fmt']);
if ($temp !== $first['message_fmt']) {
$first['message_fmt'] = $temp;
$first['message'] = $temp;
debug_log('Main post was modified');
}
}
// 处理回复
if (isset($posts) && is_array($posts)) {
debug_log('Processing replies...');
foreach ($posts as &$post) {
if (isset($post['message_fmt'])) {
$temp = fxz_netdisk_parse($post['message_fmt']);
if ($temp !== $post['message_fmt']) {
$post['message_fmt'] = $temp;
$post['message'] = $temp;
debug_log('Reply was modified');
}
}
}
}
debug_log('Processing complete.');
?>