cp_link_open外链跳转插件适配CorePress主题的[图标超链接]

找到cp_link_open插件目录的cp-link-open.php文件,添加以下方法

function contenta($content)
{
    preg_match_all('|\[icon-url.*?href="(.*?)".*?](.*?)\[/icon-url\]|', $content, $domain_arr, PREG_SET_ORDER);
    $url_whiteList_arr = preg_split('/[;\r\n]+/s', $this->plugin_set['whiteList']);
    foreach ($domain_arr as $item) {
        $isreplace = true;
        foreach ($url_whiteList_arr as $url_item) {
            $re = stripos($item[1], $url_item);
            if ($re != false) {
                $isreplace = false;
                break;
            }
        }
        if ($isreplace == true) {
            $html = $this->str_replace_once($item[1], $this->plugins_url . '/link.php?a=' . base64_encode($item[1]), $item[0]);
            $content = str_replace($item[0], $html, $content);
        }
    }
    return $content;
}

在第40行下方插入add_filter('the_content', array($this, 'contenta'));

图片[1] - cp_link_open外链跳转插件适配CorePress主题的[图标超链接] - 技术SOLO

© 版权声明
THE END
喜欢就支持一下吧
点赞0打赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容