[已解決] 給 data.func.php 中的函數内添加新鈎子

qcfgpp2022-09-01  535

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
转载请注明原文地址:https://www.wellcms.net/read-383.html
00
最新回复(1)
  • 钩子回头添加,这个地方留了默认使用,意思就是留给用户充足的空间。

    两处代码一样没有问题,B2云储存目前增删正常。开始写的时候是不一样的,后来有问题,写成一样的了,换在其他地方解决了,所以这个地方就这样了。不影响功能。
    回复00