带病投保、无健康告知保险汇总

文章外链转内链并转入跳转页面,需要两段代码:

Function代码

// 文章外链转内链并转入跳转页面,by minirizhi.com
add_filter('the_content','goto_url',999);
function goto_url($content){
    preg_match_all('/<a(.*?)href="(.*?)"(.*?)>/',$content,$matches);
    if($matches){
        foreach($matches[2] as $val){
            if(strpos($val,'://')!==false && strpos($val,home_url())===false && !preg_match('/\.(jpg|jepg|png|ico|bmp|gif|tiff)/i',$val) && !preg_match('/(ed2k|thunder|Flashget|flashget|qqdl):\/\//i',$val)){
                $content=str_replace("href=\"$val\"", "rel=\"nofollow\" target=\"_blank\" href=\"" . get_bloginfo('home'). "/goto?url=" .base64_encode($val). "\"",$content);
            }
        }
    }
    return $content;
}
// 下载外链跳转,by minirizhi.com
function links_nofollow($url) {
    if(strpos($url,'://')!==false && strpos($url,'echo.net')===false && !preg_match('/(ed2k|thunder|Flashget|flashget|qqdl):\/\//i',$url)) {
    $url = str_replace($url, home_url()."/goto?url=".base64_encode($url),$url);
         }
    return $url;
}

页面模版代码

<?php
    /*
    Template Name: 外链跳转
    Template Athor: minirizhi.com
    */
?>
<?php
$home = "https://minirizhi.com";    //修改成自己的网址
$name = "minirizhi";    //修改成自己的网站名
function be_referer($home,$name) {
    echo '<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="UTF-8" /><meta http-equiv=Content-Type content="text/html;charset=utf-8">
<title>无效地址</title></head>
    <body>
    <div style="text-align:center;background:#eee;padding:50px 0;margin:0 auto">
    <p style="font-size:30px">抱歉,此URL不允许直接复制打开!!!</p>
    <p style="font-size:30px">—— 来自<a href="'.$home.'/">'.$name.'</a></p>
    </div>
    </body>
    </html>';
    exit();
}
// 判断:若不为跳转链接,则不执行跳转,显示以上信息
if(empty($_SERVER['HTTP_REFERER']) || strpos(strtoupper($_SERVER['HTTP_REFERER']),strtoupper($home)) === false){
    be_referer($home,$name);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="HandheldFriendly" content="true">
<meta http-equiv="Cache-Control" content="no-transform"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<title>温馨提示:您即将离开 - <?php echo $name;?></title>
<style>
@media (max-width: 700px){body {font:12px!important}h2{font-size:18px!important;padding-bottom:10px!important;}.remind_title{font-size:16px!important;}a {font-size:14px!important;}.remind_detail {font-size:14px!important;}#wrapper {width:100%!important;}.c-container {padding: 0px!important;}}
body {font:15px  Arial, Lucida Grande, Tahoma, sans-serif;background: #fff;}
h2{font-size:22px;color:#eb5424;text-align:center;padding-bottom: 20px;border-bottom: 5px solid #dfdfdf;}
a {font-size:16px;color:#555;text-decoration: none;}
span {color:#CC0000;}
#wrapper {width:700px;margin:0 auto;}
#content {background:#fff;margin:10px 0 20px 0;}
.c-container {padding: 20px;}
.remind_icon {float: left;margin-right: 10px;display: inline;width: 32px;height: 32px;background: url('/content/themes/kavico/assets/img/prompt.png') no-repeat scroll 0% 0% transparent;background-position:-64px 0px;}
.remind_content {overflow: hidden;}
.remind_title {color:#D68300;margin-bottom: 10px;padding-top: 3px;font-weight: bold;font-size: 20px;font-family: "Microsoft YaHei","lucida Grande",Verdana;}
.remind_detail {line-height:1.5;font-size:15px;color: #535353;}
.safety-url {margin-bottom:15px;padding-bottom: 15px;border-bottom: 1px solid #DFDFDF;word-wrap: break-word;word-break: break-all;}
.c-footer {padding: 10px 15px;background: none repeat scroll 0% 0% #F1F1F1;border-top: 1px solid #BBB;overflow: hidden;text-align:center;}
a.btn_blue {border: 1px solid #0D659B;color: #FFF !important;background:linear-gradient(105deg,#238aca,#0074bc);display: inline-block;padding: 6px 25px;margin: 0px;font-size: 14px;font-weight: bold;text-align: center;border-radius: 3px;}
.c-footer-a2 {margin: 8px 0px 0px 15px;}
</style>
</head>
<body>
<div id="wrapper">
    <h2><a href="https://minirizhi.com" title="minirizhi">minirizhi</h2>/*修改成您的*/
    <div id="content">
    <div class="c-container">
        <span class="remind_icon"></span>
        <div class="remind_content">
            <div class="remind_title">您将要访问:</div>
            <div class="remind_detail">
                <div class="safety-url">
                    <span ><a href="<?php $url=$_GET['url']; echo base64_decode($url);?>" rel="nofollow" ><?php $url=$_GET['url']; echo base64_decode($url);?></a></span><br/>             
                </div>
                <p>该网页不属于余味记,我们无法确认该网页是否安全,它可能包含未知的安全隐患,请注意保护好个人信息! </p>
            </div>
        </div>
    </div>
    <div class="c-footer">
        <a href="<?php $url=$_GET['url']; echo base64_decode($url);?>" rel="nofollow" class="c-footer-a1 btn_blue">继续访问</a>
        <a href="https://minirizhi.com" class="c-footer-a2">返回 minirizhi</a>/*修改成您的*/
                
    </div>
    </div>
</div>
</body>
</html>

新建goto.php文件,填入页面模版代码,丢入模版文件夹。然后控制后台新建跳转链接页面,内容为空,slug名为goto,选择页面模版,发布即可。

文章目录
扫码了解详情