移植begin的外链跳转到Dux主题
本帖最后由 初缘Cvps小站 于 2019-3-9 14:53 编辑最近用某N1折腾了一个博客。然后用的是Dux非常开心的主题。
然后自己用Begin的to.php?ulr=这个跳转不错,还加密了。
然后就移植一下吧。好像还有点小bug? 反正也看不懂多少代码。。。欢迎各位大佬指出并提供解决方案!这里非常感激!
总结就是:将to.php代码复制到dux主题去,然后在主题中的functions.php调用就行了。更多的?度娘都有,参考改改吧,我也不会改,就这样用吧。
附上移植方法:
1.直接将begin主题目录中的to.php内容复制到dux新建的to.php内存中。
附:to.php内容
[*]
[*]
[*]
[*]
[*]
[*]">
[*]
[*]加载中
[*]
[*]body{overflow:hidden;background:#f1f1f1}.container{display:flex;justify-content:center;align-items:center;height:100vh;overflow:hidden;animation-delay:1s}.item-1{width:20px;height:20px;background:#f583a1;border-radius:50%;background-color:#eed968;margin:7px;display:flex;justify-content:center;align-items:center}@keyframes scale{0%{transform:scale(1)}50%,75%{transform:scale(2.5)}78%,100%{opacity:0}}.item-1:before{content:'';width:20px;height:20px;border-radius:50%;background-color:#eed968;opacity:.7;animation:scale 2s infinite cubic-bezier(0,0,0.49,1.02);animation-delay:200ms;transition:.5s all ease;transform:scale(1)}.item-2{width:20px;height:20px;background:#f583a1;border-radius:50%;background-color:#eece68;margin:7px;display:flex;justify-content:center;align-items:center}@keyframes scale{0%{transform:scale(1)}50%,75%{transform:scale(2.5)}78%,100%{opacity:0}}.item-2:before{content:'';width:20px;height:20px;border-radius:50%;background-color:#eece68;opacity:.7;animation:scale 2s infinite cubic-bezier(0,0,0.49,1.02);animation-delay:400ms;transition:.5s all ease;transform:scale(1)}.item-3{width:20px;height:20px;background:#f583a1;border-radius:50%;background-color:#eec368;margin:7px;display:flex;justify-content:center;align-items:center}@keyframes scale{0%{transform:scale(1)}50%,75%{transform:scale(2.5)}78%,100%{opacity:0}}.item-3:before{content:'';width:20px;height:20px;border-radius:50%;background-color:#eec368;opacity:.7;animation:scale 2s infinite cubic-bezier(0,0,0.49,1.02);animation-delay:600ms;transition:.5s all ease;transform:scale(1)}.item-4{width:20px;height:20px;background:#f583a1;border-radius:50%;background-color:#eead68;margin:7px;display:flex;justify-content:center;align-items:center}@keyframes scale{0%{transform:scale(1)}50%,75%{transform:scale(2.5)}78%,100%{opacity:0}}.item-4:before{content:'';width:20px;height:20px;border-radius:50%;background-color:#eead68;opacity:.7;animation:scale 2s infinite cubic-bezier(0,0,0.49,1.02);animation-delay:800ms;transition:.5s all ease;transform:scale(1)}.item-5{width:20px;height:20px;background:#f583a1;border-radius:50%;background-color:#ee8c68;margin:7px;display:flex;justify-content:center;align-items:center}@keyframes scale{0%{transform:scale(1)}50%,75%{transform:scale(2.5)}78%,100%{opacity:0}}.item-5:before{content:'';width:20px;height:20px;border-radius:50%;background-color:#ee8c68;opacity:.7;animation:scale 2s infinite cubic-bezier(0,0,0.49,1.02);animation-delay:1000ms;transition:.5s all ease;transform:scale(1)}
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]
[*]复制代码
2.调用。
发现我那个正版的begin调用代码全在inc/inc.php中了。所以直接找到引用代码,复制的dux主题中的functions.php这个去。
附:调用代码!
[*]// 外链跳转
[*]add_filter('the_content','wl_the_content_to',999);
[*]function wl_the_content_to($content){
[*] preg_match_all('/href="(http.*?)"/',$content,$matches);
[*] if($matches){
[*] foreach($matches as $val){
[*] if( 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="external nofollow" target="_blank" href="" .get_template_directory_uri(). "/to.php?url=" .base64_encode($val). """,$content);
[*] }
[*] }
[*] return $content;
[*]}
[*]// 评论者链接跳转
[*]add_filter('get_comment_author_link', 'comment_author_link_to');
[*]function comment_author_link_to() {
[*] $encodeurl = get_comment_author_url( $comment_ID );
[*] $url = get_template_directory_uri().'/to.php?url=' . base64_encode($encodeurl);
[*] $author = get_comment_author( $comment_ID );
[*] if ( empty( $encodeurl ) || 'http://' == $encodeurl )
[*] return $author;
[*] else
[*] return "$author";
[*]}
[*]
[*]// 网址跳转
[*]function sites_nofollow($url) {
[*] $url = str_replace($url, get_template_directory_uri()."/to.php?url=".$url,$url);
[*] return $url;
[*]}复制代码
如果不喜欢to的跳转,自己就改个go的跳转,,然后张戈大佬博客也有这方面的文章参考!
以上就是我移植的笨方法了。不知道有木有Bug什么鬼。欢迎各位大佬指出并提供解决方案!!感谢,感激!
最后丢个演示站:http://strongma.com
原本N1的,现在是闲置旧主机,vm虚拟化centos系统搭建的网站。
穿透就是ZeroTier.......用法,坛子搜下N1,里面有说明的。不会再留言或私信吧。 我直接用shortlink
titter.gif
hxuf 发表于 2019-3-9 14:51
我直接用shortlink
这是插件吗?代码版本也不错的。嘿嘿。。。
初缘Cvps小站 发表于 2019-3-9 14:54
这是插件吗?代码版本也不错的。嘿嘿。。。
是的 插件好使的很。就是链接好长。 自己魔改了下Go跳转,用的还行
aixuan99 发表于 2019-3-9 15:01
自己魔改了下Go跳转,用的还行
移植,直接抄袭,懒得魔改折腾了。 问一下用N1做博客的大佬,家宽80和443端口都被封了的情况下怎么用域名访问?是用反代还是其他方法? "
ZeroTier进行虚拟网卡,N1和vps都进行安装zertier,将N1和vps加入同一个网络ip段。然后你在vps的ssh中,进行ping 192.168.192.192(N1)的zertier中的内网地址,就通了。通了之后,vps直接进行反向代理,地址就是内网地址了。
这样能懂吗?
初缘Cvps小站 发表于 2019-3-9 18:19
ZeroTier进行虚拟网卡,N1和vps都进行安装zertier,将N1和vps加入同一个网络ip段。然后你在vps的ssh中, ...
谢谢大佬分享,虽然我现在不懂,但是会好好琢磨的
页:
[1]