48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Home Module · Friend Links
|
|
*
|
|
* config: { title? }
|
|
*/
|
|
defined('ABSPATH') || exit;
|
|
|
|
$cfg = get_query_var('aksrt_module_config', []);
|
|
if (!is_array($cfg)) $cfg = [];
|
|
|
|
$title = (string) ($cfg['title'] ?? '');
|
|
|
|
$friend_links = aksrt_get_friend_links();
|
|
if (!is_array($friend_links) || empty($friend_links)) return;
|
|
if (empty($friend_links)) return;
|
|
?>
|
|
|
|
<section class="home-module home-module--friends container" aria-label="<?php echo esc_attr($title ?: __('友情链接', 'aksrt')); ?>">
|
|
<header class="home-module__header">
|
|
<h2 class="home-module__title"><?php echo esc_html($title ?: __('友情链接', 'aksrt')); ?></h2>
|
|
</header>
|
|
|
|
<ul class="home-module__friends-list">
|
|
<?php foreach ($friend_links as $link) :
|
|
$url = $link['url'] ?? '';
|
|
$name = $link['name'] ?? '';
|
|
$description = $link['description'] ?? '';
|
|
$logo = $link['logo'] ?? '';
|
|
if (!$url || !$name) continue;
|
|
?>
|
|
<li>
|
|
<a href="<?php echo esc_url($url); ?>" target="_blank" rel="noopener noreferrer external" class="home-module__friend-card">
|
|
<?php if ($logo) : ?>
|
|
<img<?php echo aksrt_get_lazy_attr('lazy_other', (string) $logo, 'home-module__friend-avatar'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="">
|
|
<?php endif; ?>
|
|
<div class="home-module__friend-meta">
|
|
<strong><?php echo esc_html($name); ?></strong>
|
|
<?php if ($description) : ?>
|
|
<span><?php echo esc_html($description); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</section>
|