在 data_format() 和 data_message_replace_url() 函數中
兩個位置添加一下 hook 方便用戶自定義
data_format() 中的
// 使用云储存
if (1 == $conf['attach_on'] && 1 == $val['attach_on']) {
$val['message'] = str_replace('="upload/', '="' . file_path($val['attach_on']), $val['message']);
} elseif (2 == $conf['attach_on'] && 2 == $val['attach_on']) {
// 使用图床
list($attachlist, $imagelist, $filelist) = well_attach_find_by_tid($val['tid']);
foreach ($imagelist as $key => $attach) {
$url = $conf['upload_url'] . 'website_attach/' . $attach['filename'];
// 替换成图床
// hook 新建鈎子
...
data_message_replace_url() 中的
if (1 == $conf['attach_on']) {
// 使用云储存
$message = str_replace('="' . $conf['cloud_url'] . 'upload/', '="upload/', $message);
} elseif (2 == $conf['attach_on']) {
// 使用图床
list($attachlist, $imagelist, $filelist) = well_attach_find_by_tid($tid);
foreach ($imagelist as $key => $attach) {
$url = $conf['upload_url'] . 'website_attach/' . $attach['filename'];
// 替换回相对链接
// hook 新建鈎子
...
========
冰大已更新:https://github.com/wellcms/wellcms