- enable the native Links manager and drop the custom friend-link option/REST path - add per-page link settings for the friends template - render link categories from get_bookmarks() with search and page-content options - add a validated public link submission endpoint with logo upload, captcha, rate limiting and duplicate checks - create pending links for review and notify administrators by email and in-app message - add native Links admin pending count, columns and edit notes - cover the new submission and cleanup contracts Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
71 lines
2.5 KiB
PHP
71 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: 友情链接
|
|
* Template Post Type: page
|
|
*
|
|
* @package Jio
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
|
|
$post_id = (int) get_queried_object_id();
|
|
$settings = function_exists('jio_get_page_links_settings') ? jio_get_page_links_settings($post_id) : [];
|
|
$links_html = function_exists('jio_page_links_html') ? jio_page_links_html($post_id) : '';
|
|
$search_html = function_exists('jio_link_get_search_cover') ? jio_link_get_search_cover($post_id) : '';
|
|
|
|
if (function_exists('jio_archive_open_shell')) {
|
|
jio_archive_open_shell([
|
|
'main_class' => 'site-main container page-content-default',
|
|
'has_sidebar' => false,
|
|
'page_kind' => 'friends',
|
|
]);
|
|
}
|
|
?>
|
|
<div class="content-main content-main--page content-main--friends">
|
|
<?php
|
|
get_template_part('templates/parts/page-header', null, [
|
|
'title' => esc_html__('友情链接', 'jio'),
|
|
'desc' => __('与这些优秀的站点交换友链', 'jio'),
|
|
]);
|
|
echo $search_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- helper returns escaped markup.
|
|
|
|
if (!empty($settings['content_s']) && ($settings['content_position'] ?? 'top') === 'top') {
|
|
echo '<div class="zib-widget mb20"><article class="article content-main__body">';
|
|
the_content();
|
|
echo '</article></div>';
|
|
}
|
|
|
|
echo $links_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- helper returns escaped markup.
|
|
|
|
if (!empty($settings['content_s']) && ($settings['content_position'] ?? 'top') !== 'top') {
|
|
echo '<div class="zib-widget mb20"><article class="article content-main__body">';
|
|
the_content();
|
|
echo '</article></div>';
|
|
}
|
|
|
|
if (!empty($settings['submit_s']) && !empty($settings['submit_title'])) {
|
|
printf(
|
|
'<p class="text-center" style="margin-top:24px;"><a class="padding-h10 hollow but c-theme btn-block" href="#submit-links-modal" data-toggle="modal">%s</a></p>',
|
|
esc_html((string) $settings['submit_title'])
|
|
);
|
|
}
|
|
?>
|
|
</div>
|
|
<?php
|
|
if (!empty($settings['submit_s'])) {
|
|
echo jio_submit_links_modal([ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- helper returns escaped markup.
|
|
'title' => (string) ($settings['submit_title'] ?? ''),
|
|
'dec' => (string) ($settings['submit_dec'] ?? ''),
|
|
'sign' => !empty($settings['submit_sign_s']),
|
|
'cats' => (array) ($settings['submit_cats'] ?? []),
|
|
], $post_id);
|
|
}
|
|
|
|
if (function_exists('jio_archive_close_shell')) {
|
|
jio_archive_close_shell(['has_sidebar' => false]);
|
|
}
|
|
|
|
get_footer();
|