前言
我发现有些人盗文章也不盗好点,什么好坏都盗用了,就说这个检测,大部分人盗用的都是没有效果的或者是直接无法使用的!!!!
所以,我花了一晚上的时间重新修复了一下页面+调用函数+Api,现在重新发出来给大家使用!
目前已实现的功能
前端用户界面
- 友情链接提交表单 – 用户可以提交网站名称、地址、头像、描述、邮箱
- 友情链接展示页面 – 美观的卡片式展示所有通过审核的友情链接
- 实时表单验证 – 提交时即时验证邮箱格式、URL格式等
管理员界面
- 友情链接检测列表 – 显示所有友情链接的检测时间、网站名称、状态
- 邮箱状态显示 – 显示”已填写”或”未填写”(保护隐私,不显示具体邮箱)
- 一键操作按钮 – 审核通过/拒绝、检测、显示/隐藏、删除
- 状态颜色区分 – 正常(绿色)、待审核(橙色)、异常(红色)
- 实时状态更新 – 所有操作无需刷新页面即可看到结果
检测和通知功能
- 自动网站检测 – 检测网站可访问性和头像图片
- 智能上下线 – 检测正常自动上线,异常自动下线
- 邮件通知系统 – 审核通过和检测异常时自动发送邮件
核心可视化流程
- 用户提交 → 表单验证 → 等待审核状态
- 管理员审核 → 一键通过/拒绝 → 实时状态更新 → 自动邮件通知
- 定期检测 → 一键检测 → 状态颜色更新 → 异常邮件通知
- 友情链接展示 → 自动显示所有通过审核的链接
这是一个完整的友情链接管理系统,具有美观的界面和完善的自动化功能!🎉
首先是links.php
将文件放到/www/wwwroot/你的网站目录.cn/wp-content/themes/zibll/pages/links.php里面!!!!!!
子比主题的根目录指的是:wp-content/themes/zibll/其中/zibll/就是子比主题的根目录!
<?php
/**
* Template name: 子比美化版友情链接
* Description: sidebar page
*/
// 获取链接列表
function zib_page_links() {
$type = 'card';
$post_ID = get_queried_object_id();
$args_orderby = get_post_meta($post_ID, 'page_links_orderby', true);
$args_order = get_post_meta($post_ID, 'page_links_order', true);
$args_limit = get_post_meta($post_ID, 'page_links_limit', true);
$args_category = get_post_meta($post_ID, 'page_links_category', true);
global $wpdb;
$links_table = $wpdb->prefix . 'links';
$orderby = $args_orderby ?: 'link_name';
$order = $args_order ?: 'ASC';
$limit_sql = ($args_limit && $args_limit != -1) ? "LIMIT " . intval($args_limit) : "";
$category_sql = $args_category ? "AND link_category = " . intval($args_category) : "";
$sql = "SELECT * FROM {$links_table} WHERE link_visible = 'Y' {$category_sql} ORDER BY {$orderby} {$order} {$limit_sql}";
$links = $wpdb->get_results($sql);
$html = '';
if ($links) {
if (function_exists('zib_links_box')) {
$html .= zib_links_box($links, $type, false);
} else {
// 自定义友情链接显示
$html .= '<style>
.links-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 15px;
padding: 20px 0;
}
.link-card {
background: #fff;
border: 1px solid #e1e5e9;
border-radius: 8px;
padding: 15px;
text-align: center;
transition: all 0.3s ease;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
position: relative;
overflow: hidden;
}
.link-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
border-color: #d1d5db;
}
.link-card a {
text-decoration: none;
color: inherit;
display: block;
width: 100%;
height: 100%;
}
.link-card img {
width: 50px;
height: 50px;
border-radius: 50%;
margin-bottom: 10px;
object-fit: cover;
transition: transform 0.3s ease;
}
.link-card:hover img {
transform: scale(1.1);
}
.link-card .link-name {
font-weight: 600;
color: #333;
margin-bottom: 5px;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.link-card .link-desc {
font-size: 12px;
color: #666;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
height: 2.8em;
}
@media (max-width: 768px) {
.links-container {
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 10px;
padding: 15px 0;
}
.link-card {
padding: 12px;
}
}
</style>';
$html .= '<div class="links-container">';
foreach ($links as $link) {
$link_image = $link->link_image ? $link->link_image : 'https://via.placeholder.com/50x50?text=' . substr($link->link_name, 0, 1);
$html .= '<div class="link-card">
<a href="' . htmlspecialchars($link->link_url) . '" target="_blank">
<img src="' . htmlspecialchars($link_image) . '" alt="' . htmlspecialchars($link->link_name) . '">
<div class="link-name">' . htmlspecialchars($link->link_name) . '</div>
<div class="link-desc">' . htmlspecialchars($link->link_description) . '</div>
</a>
</div>';
}
$html .= '</div>';
}
} else {
$html = '<div class="text-center ajax-item" style="padding: 60px 20px;">
<img style="width: 200px; opacity: 0.7; margin-bottom: 20px;" src="https://cos.vs98k.cn/uploads/2024/07/03/null.svg" alt="暂无友链">
<p style="font-size: 16px; color: #999; margin: 0;">暂无友情链接</p>
<p style="font-size: 14px; color: #ccc; margin: 10px 0 0 0;">请联系管理员添加友情链接</p>
</div>';
}
return $html;
}
// 友情链接提交表单
function zib_submit_links_card($args = array()) {
// 设置默认值
$title = isset($args['title']) && !empty($args['title']) ? $args['title'] : '友情链接申请';
$subtitle = isset($args['subtitle']) && !empty($args['subtitle']) ? $args['subtitle'] : '请填写您的网站信息';
$dec = isset($args['dec']) && !empty($args['dec']) ? $args['dec'] : '申请友情链接,请先添加本站链接';
$html = '<div class="zib-widget">
<div class="box-body">
<div class="title-theme">' . htmlspecialchars($title) . '<small class="ml10">' . htmlspecialchars($subtitle) . '</small></div>
<div class="muted-2-color em09 mb20">' . htmlspecialchars($dec) . '</div>
<form class="link-submit-form" id="linkSubmitForm">
<div class="form-group">
<label>网站名称 <span class="text-danger">*</span></label>
<input type="text" name="link_name" class="form-control" placeholder="请输入网站名称" required>
</div>
<div class="form-group">
<label>网站链接 <span class="text-danger">*</span></label>
<input type="url" name="link_url" class="form-control" placeholder="https://example.com" required>
</div>
<div class="form-group">
<label>网站头像</label>
<input type="url" name="link_image" class="form-control" placeholder="https://example.com/avatar.png">
</div>
<div class="form-group">
<label>网站介绍</label>
<textarea name="link_description" class="form-control" rows="3" placeholder="请简要介绍您的网站"></textarea>
</div>
<div class="form-group">
<label>联系邮箱 <span class="text-danger">*</span></label>
<input type="email" name="link_email" class="form-control" placeholder="your@email.com" required>
</div>
<button type="submit" class="but jb-blue" id="submitBtn">提交申请</button>
</form>
</div>
</div>
<script>
jQuery(document).ready(function($) {
$("#linkSubmitForm").on("submit", function(e) {
e.preventDefault();
// 前端验证
var linkName = $("input[name=link_name]").val().trim();
var linkUrl = $("input[name=link_url]").val().trim();
var linkEmail = $("input[name=link_email]").val().trim();
if (!linkName) {
alert("请填写网站名称");
return false;
}
if (!linkUrl) {
alert("请填写网站地址");
return false;
}
if (!linkEmail) {
alert("请填写联系邮箱");
return false;
}
// 验证邮箱格式
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(linkEmail)) {
alert("请填写正确的邮箱格式");
return false;
}
// 验证URL格式
var urlRegex = /^https?:\/\/.+/;
if (!urlRegex.test(linkUrl)) {
alert("请填写正确的网站地址(需要包含http://或https://)");
return false;
}
var submitBtn = $("#submitBtn");
var originalText = submitBtn.text();
submitBtn.prop("disabled", true).text("提交中...");
$.ajax({
type: "POST",
url: "' . admin_url('admin-ajax.php') . '",
data: {
action: "submit_friend_link",
link_name: $("input[name=link_name]").val(),
link_url: $("input[name=link_url]").val(),
link_image: $("input[name=link_image]").val(),
link_description: $("textarea[name=link_description]").val(),
link_email: $("input[name=link_email]").val(),
nonce: "' . wp_create_nonce('submit_friend_link_nonce') . '"
},
dataType: "json",
success: function(response) {
if (response.success) {
alert("友情链接申请提交成功!管理员审核后将会显示。");
$("#linkSubmitForm")[0].reset();
} else {
alert("提交失败:" + (response.data || "未知错误"));
}
},
error: function() {
alert("网络错误,请稍后重试");
},
complete: function() {
submitBtn.prop("disabled", false).text(originalText);
}
});
});
});
</script>';
return $html;
}
get_header();
$post_id = get_queried_object_id();
$header_style = zib_get_page_header_style();
$page_links_content_s = zib_get_post_meta($post_id, 'page_links_content_s', true);
$page_links_content_position = zib_get_post_meta($post_id, 'page_links_content_position', true);
$page_links_submit_s = zib_get_post_meta($post_id, 'page_links_submit_s', true);
?>
<style>
.admin-btn{background: #8486f8;padding: 2px 10px;color: #fff;border-radius: 4px;}
.admin-guanli{visibility:hidden;position: absolute;min-width: 80px;background-color: var(--main-bg-color);padding: 10px 5px;z-index: 99;border-radius: var(--main-radius);box-shadow: 0 0 10px rgba(0,0,0,.1);right: -40px;margin-top: -40px;}
.xy_hide:hover>.admin-guanli{visibility:unset;}
.xy_hide:hover>.admin-btn{color: #fff;background: #6d6fd8;}
.f12{font-size:12px;}
.xypro_describe {position: relative;border: 1px dashed #dcdfe6;line-height: 26px;}
.xypro_describe_title {position: absolute;top: 0;left: 8px;-webkit-transform: translateY(-50%);transform: translateY(-50%);background: #fff;padding: 0 5px;color: #303133;font-weight: 500;max-width: 200px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
.xypro_describe_content{color: #606266;padding: 18px 15px 30px;}
.yq{width: 100%;max-width: 100%;table-layout: fixed;color: #909399;margin-bottom: 18px;border-top: 1px solid #ebeef5;border-left: 1px solid #ebeef5;}
.yq thead th {font-weight: 500;background: #ebeef5;text-align: center;padding: 8px;border-bottom: 1px solid #ebeef5;border-right: 1px solid #ebeef5;}
.yq_link td {text-align: center;padding: 8px;border-bottom: 1px solid #ebeef5;border-right: 1px solid #ebeef5;text-overflow: ellipsis;
white-space: nowrap;overflow: hidden;}
.xy_li {text-align: center;font-size: 16px;line-height: 30px;}
.xy_li::marker {content: "#" counter(list-item) " ";color: var(--theme-color);}
.xy-mask {background-color: rgba(0,0,0,.5);}
.xy_height_hide{height: 300px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;}
.xy_height_hide_p{background: linear-gradient(180deg,hsla(0,0%,100%,0),#fff);width: 100%;z-index: 1;position: absolute;bottom: 0;margin: 0;height: 100px;}
.xy_height_hide_p2{text-align: center;bottom: 0;z-index: 2;position: absolute;left: 0;right: 0;cursor: pointer !important;}
.xy-more-btn{width: 20px;height: 20px;background-color: var(--main-bg-color);border: 1px solid rgb(237, 237, 237);border-radius: 50%;line-height: 18px;}
code{font-family: "lovely";}
.xy_callout ol li::marker {content: "#" counter(list-item) " ";color: var(--theme-color);}
.xy_callout {padding: 20px;border: 1px solid #e4e4e4;border-left-width: 5px;border-radius: 6px;line-height: 30px;font-weight: 600;border-left-color: var(--theme-color);}
.xy_content>h5{margin: 0;font-weight:600;font-size: 24px;line-height: 32px;padding:20px 0;text-align: center;}
.xy_checkbox:checked{background:var(--theme-color);-webkit-appearance: none;position: relative;border-radius: 2px;width: 15px;height: 15px;vertical-align: -2px;}
.xy_content h5:before {content: '「';color: var(--theme-color);font-weight: 600;margin-left: 5px;}
.xy_content h5:after {content: '」';color: var(--theme-color);font-weight: 600;margin-right: 5px;}
/**.xy_checkbox:checked:after {content:'';width: 6px;height: 10px;position: absolute;top: 1px;left: 5px;border: 2px solid #fff;border-top: 0;border-left: 0;-webkit-transform: rotate(45deg);transform: rotate(45deg);}**/
.wp-posts-content li{margin-bottom: 0;}
.xy-width{padding:0 30px 30px;}
.wp-posts-content ol>li>span{color: var(--theme-color);}
@media screen and (max-width:500px){.xy-width{padding:10px;}.wp-posts-content ol:not(.blocks-gallery-grid){margin:0;}.xy_hide{display:none;}.title-h-center{display:none;}.xy-mask {background-color: rgb(0 0 0 / 5%);}}
@media screen and (min-width:500px){.xy-width-190{width: 190px;}.xy-width-100{width: 100px;}}
</style>
<script>
//$.getJSON("https://api.qjqq.cn/api/Yi?c=f&encode=json",function(data){ $("#yulu").text(data.hitokoto);});$(function(){$("#yulu").click(function() {$(this).select();})})
</script>
<main class="container">
<div class="content-wrap">
<div class="content-layout">
<div class="page-cover theme-box radius8 main-shadow">
<img class="fit-cover no-scale lazyloaded" src="https://api.mduge.com/img/apimn2.php" data-src="cos.vs98k.cn/uploads/2022/11/14/v2-4df3abc448cb4907a20ad8e35fd55f8e_r.jpg">
<div class="absolute xy-mask"></div>
<div class="list-inline box-body abs-center text-center">
<div class="title-h-center">
<span class="xy_content">
<h5><font size="6" color="red"> 注</font>意提醒 </h5>
<div class="xy_li">开启外链重定向会判定失败</div>
<div class="xy_li">网站打开时间过长会请求失败</div>
<div class="xy_li">首页未有本站链接会判定失败</div>
<div class="xy_li">如有疑问可找站长或进群</div>
</span>
</div>
</div>
</div>
<!-- php echo zib_get_page_header(); ?-->
<?php while (have_posts()) : the_post(); ?>
<!--友情链接字样?php echo zib_get_page_header(); ?-->
<?php
if ($page_links_content_position == 'top') {
echo '<div class="zib-widget">' . zib_page_links() . '</div>';
}?>
<?php echo Links(); ?>
<?php
if ($page_links_content_position != 'top') {
echo '<div class="zib-widget">' . zib_page_links() . '</div>';
}
echo'<div class="box-body notop">
<div class="title-theme">友链申请说明<small class="ml10">请注意查看</small></div>
</div>
<div class="zib-widget xy-width">
<span class="xy_content" style="display: block;">
<h5>申请前 <font size="6" color="red">必</font> 阅读</h5>
<section class="xy_callout wp-posts-content"
style="font-weight:400;padding:0 20px 10px;margin-bottom:15px;border-left-color: #1890ff;">
<h3>申请条件</h3>
<ol>
<li>先确认申请的博客内容符合以下类别,即使未列出的亦可继续申请。<br>
<i class="fa fa-check" aria-hidden="true"></i>
某领域技术性博客<br>
<i class="fa fa-check" aria-hidden="true"></i>
资源下载类博客<br>
<i class="fa fa-check" aria-hidden="true"></i>
论坛,社区或聚合媒体类网站<br>
<i class="fa fa-times" aria-hidden="true"></i>
纯视频站,纯图片站<br>
<i class="fa fa-times" aria-hidden="true"></i>
赌博、发卡、支付类网站<br>
<i class="fa fa-times" aria-hidden="true"></i>
原创少于1篇的博客<br>
<i class="fa fa-times" aria-hidden="true"></i>
没有独立博客服务器的博客(例如搭设在WordPress,blogger,typecho等)
</li>
<li>博客需每月至少有一篇更新博客,或者有经常更新的日常笔记,并且已存在至少<code>20篇</code>博文。</li>
<li>站点需要全站https,也不接受带ip或端口的链接,并且国内无墙。</li>
<li>在小站有效留言至少一条,至少我得熟悉你吧,这样才好申请友链。</li>
<li>博客有RSS2.0地址或atom地址(一般的博客程序都自带,请不要关闭,如果是自制程序没有可忽略)。</li>
<li style="color:red">权重大于3,以上条件皆可无视。</li>
</ol>
<h3>申请过程</h3>
<ol>
<li>申请前请先将本站友链加好。</li>
<li>申请信息真认真写好,请勿乱写。</li>
<li>申请时请写清<code>网站名称</code> <code>网站头像</code> <code>网站介绍</code> <code>网站链接</code></li>
</ol>
<h3>申请后续</h3>
<ol>
<li>如果不符合要求会无视掉申请,<font color="red">一天内都会通过。</font>
</li>
<li>网站修改友链信息请申请页面留言即可,无格式要求。</li>
<li>排名一般来说是有先后顺序的,但是还是要说,排名不分先后。</li>
<li>若发现站点无法访问,将会在一个月后删除。</li>
<li>网站正常访问但是无故下掉链接的,会拉入黑名单,不再接受友链申请。</li>
<li>本站使用
接口检测模式,
设有重定向、访问过慢的网站无法正常识别。</li>
</ol>
</section>
';
if ($page_links_content_s) {
echo '<div class="zib-widget"><article class="article wp-posts-content">';
the_content();
echo '</article>';
wp_link_pages(
array(
'before' => '<p class="text-center post-nav-links radius8 padding-6">',
'after' => '</p>',
)
);
echo '</div>';
}
if ($page_links_submit_s) {
$submit_args = array(
'title' => zib_get_post_meta($post_id, 'page_links_submit_title', true),
'subtitle' => zib_get_post_meta($post_id, 'page_links_submit_subtitle', true),
'dec' => zib_get_post_meta($post_id, 'page_links_submit_dec', true),
);
echo zib_submit_links_card($submit_args);
}
?>
<?php ?>
<?php endwhile; ?>
<?php comments_template('/template/comments.php', true); ?>
</div>
</div>
<?php get_sidebar(); ?>
</main>
<?php
get_footer();
?>
二
在你的子比主题跟目录下创建一个名为:func.php的文件!文件!文件!创建文件!然后将下面的内容填入这个文件里面去!
里面的$url的链接自己替换成你自己的网站链接!!!
我写那么辛苦,要一个评论不过分吧?
三
在你的子比主题根目录下创建一个名为:urlapi.php 的文件!,然后将下面的内容填到文件里面!!!
暂无评论内容