zblog
当前位置:首页 > 帮助中心 > zblog > 正文内容

zblog

删除文章内的url链接

豫唐网络2022-11-21 10:37213

    清除url链接可以在入库的时候操作,也可以在前台或者api显示的时候操作。具体怎么显示根据具体情况来选择。

入库操作

1、使用Filter_Plugin_PostArticle_Core接口

Add_Filter_Plugin('Filter_Plugin_PostArticle_Core','ytecn_postarticle_core');

2、添加函数

function ytecn_postarticle_core(&$article) {
    $article->Content = preg_replace("/<a[^>]*>(.*?)<\/a>/is", "$1", $article->Content);
}

前台显示操作

1、使用Filter_Plugin_ViewPost_Template接口

Add_Filter_Plugin('Filter_Plugin_ViewPost_Template','ytecn_ViewPost_Template');

2、添加函数

function ytecn_ViewPost_Template(&$template){
    global $zbp;
    $article = $template->GetTags('article');
    $article->Content = preg_replace("/<a[^>]*>(.*?)<\/a>/is", "$1", $article->Content);
    $template->SetTags('article', $article);
}

api显示操作

1、使用Filter_Plugin_API_Get_Object_Array接口

Add_Filter_Plugin('Filter_Plugin_API_Get_Object_Array', 'tc_nourl_API_Get_Object_Array');

2、添加函数

function tc_nourl_API_Get_Object_Array(&$object, &$array)
{
    global $zbp, $mod, $act;
    switch (get_class($object)) {
        case 'Post':
            if ($act != "list") {
                $array['Content'] = preg_replace("/<a[^>]*>(.*?)<\/a>/is", "$1", $object->Content);
            }else{
                unset($array['Content']);
            }
            break;
        default:
            break;
    }
}


扫描二维码推送至手机访问。

版权声明:本文由汤阴县豫唐网络科技有限公司发布,如需转载请注明出处。

本文链接:https://www.ytecn.com/post/422.html

分享给朋友:

相关文章

phpQuery获取HTML图片

phpQuery获取HTML图片

phpQuery获取HTML图片/**  * 获取html文本里的img  * @param string $content ...

zblogphp文章页面编辑3号输出接口说明

zblogphp文章页面编辑3号输出接口说明

接口名称:Filter_Plugin_Edit_Response3接口描述:文章编辑页面3号输出接口,具体位置位于右侧底部。应用场景:可在文章(页面)编辑页增加自定义参数,如自定义表单字段等。调用方法...

zblogphp1.5.2开发者迁移指南

zblogphp1.5.2开发者迁移指南

自此版本开始,加强安全相关功能。登录相关此版本不再使用 password Cookie,用户密码不再直接暴露。增加token Cookie,并且强制置于 httpOnly 模式。因此:1. 不再允许前...

zblogphp程序报错后如何获得帮助

zblogphp程序报错后如何获得帮助

zblogphp程序报错后获取帮助分为免费和付费两种。免费帮助方法1开启调试模式(点击打开新链接),将截图发到群内。方法2提交工单或私信把网站信息发群主,等凑够一定数量后,群主开直播查错。付费帮助找群...

zblogphp调试登录助手

zblogphp调试登录助手

本着不接触用户账户密码的原则,请优先根据本插件提供信息。《调试登录助手》,地址:https://app.zblogcn.com/?id=18484本插件用于在不需要给出密码明文的前提下让他人登录站点后...

zblog插件怎么安装

zblog插件怎么安装

        zblog的插件分为应用中心插件和自定义插件两大类。应用中心插件又分为免费插件和付费插件。自定义插件分为...