王尘宇王尘宇

研究百度干SEO做推广变成一个被互联网搞的人

Typecho批评链接重定向的完成

Typecho批评链接重定向的完成


wordpress有这类批评链接跳转,在Typecho大牛的勤奋下。Typecho也有批评链接跳转代码了。
效果图:

起首翻开var/Widget/Abstract/Comments.php文件,寻觅

if ($this-&gt;url && $autoLink) {                echo '<a href="' , $this-&gt;url , '"' , ($noFollow ? ' rel="external nofollow"' : NULL) , '>' , $this->author , '</a>';            } else {                echo $this->author;            }

修改成

if ($this-&gt;url && $autoLink) {                if(strpos($this-&gt;url, $this->options->siteUrl)!==false) {                    echo '<a href="', $this-&gt;url, '"&gt;', $this->author, '</a>';                } else {                    echo '<a href="', $this-&gt;options-&gt;siteUrl, 'go.html?url=', urlencode($this->url), '"', ' rel="nofollow"', '>', $this->author, '</a>';                }            } else {                echo $this->author;            }

跳转页采纳的是html静态页+javescript体式格局跳转,你也能够改用php体式格局,我的跳转go.html代码以下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">    <html xmlns="http://www.w3.org/1999/xhtml">    <head profile="http://gmpg.org/xfn/11">     <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />     <title>Microhu's Blog - 一般跳转</title>     <style type="text/css">        #show{width:500px;margin:100px auto 0;font-size:18px;color:blue;}        #show span{color:red;font-weight:blod;}     </style>    </head>    <body>    <div id="show"></div>     <script type="text/javascript">     <!--        function getUrl(){            var theUrl=location.href.split('?url=');            if(theUrl.length==1)                return 'http://www.microhu.com';            return decodeURIComponent(theUrl[1]);        }        var showme=document.getElementById('show');        showme.innerHTML='正在为你跳转到:<span>'+getUrl()+'</span>';        location=getUrl();     //-->     </script>    </body>    </html>

要领来自:@羊窝 http://www.yangwo.net/170/


相关文章

评论列表

发表评论:
验证码

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。