用户中心 credits/settings 渲染器整包拆分:编排器 + 子块
This commit is contained in:
1 parent
f43519b1df
commit
81d5647205
11 files changed
+442
-348
No files matched your search
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* User center credits: sign-in captcha + recent calendar.
|
||||
*
|
||||
* Expects extracted $context vars.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$credits_enabled = !empty($credits_enabled);
|
||||
if (!$credits_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (function_exists('aksrt_is_captcha_enabled_for') && aksrt_is_captcha_enabled_for('signin')) :
|
||||
?>
|
||||
<div class="aksrt-signin-captcha" data-signin-captcha style="margin-bottom:16px;">
|
||||
<?php aksrt_render_captcha('signin'); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$signin_dates = [];
|
||||
if (class_exists('AKSRT_Signin')) {
|
||||
$signin_log = AKSRT_Signin::get_instance()->get_recent_signins($user_id, 30);
|
||||
$signin_dates = array_filter(array_map(static function ($entry) {
|
||||
return $entry['signin_date'] ?? '';
|
||||
}, $signin_log));
|
||||
}
|
||||
|
||||
if (empty($signin_dates)) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="uc-signin-calendar" style="margin-bottom:16px;">
|
||||
<h4 class="uc-signin-calendar__title">
|
||||
<i class="fas fa-calendar-alt" aria-hidden="true"></i>
|
||||
<?php esc_html_e('最近 30 天签到', 'aksrt'); ?>
|
||||
</h4>
|
||||
<div data-aksrt-signin-calendar='<?php echo esc_attr(wp_json_encode(array_values($signin_dates))); ?>'></div>
|
||||
</div>
|
||||
Reference in new issue
Block a user