Merge pull request 'Worktree zibll align p1p2' (#179) from worktree-zibll-align-p1p2 into main
Reviewed-on: CYL/wordpress-theme-aksrt#179
This commit is contained in:
@@ -25,7 +25,14 @@ export const badgeSchema = {
|
|||||||
title: '徽章字典',
|
title: '徽章字典',
|
||||||
icon: 'fas fa-bookmark',
|
icon: 'fas fa-bookmark',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'user_badge_dictionary', label: '徽章列表', type: 'textarea', default: 'founder|创始成员|warning\nstaff|站务团队|info', help: '每行一个徽章:slug|显示文案|色调(neutral/info/success/warning/brand)', dependsOn: { key: 'user_badge_enabled', value: true } },
|
{
|
||||||
|
key: 'user_badge_dictionary',
|
||||||
|
label: '徽章列表',
|
||||||
|
type: 'textarea',
|
||||||
|
default: 'founder|创始成员|warning\nstaff|站务团队|info',
|
||||||
|
help: '每行一个徽章:slug|显示文案|色调(neutral/info/success/warning/brand)|图标URL(可选)。有 icon_url 时前台显示勋章图;用户 meta aksrt_wear_badge 指定当前佩戴一枚。',
|
||||||
|
dependsOn: { key: 'user_badge_enabled', value: true },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
.comment-form__inner {
|
.comment-form__inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
gap: 10px;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,11 +169,74 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-form__guest {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-form__guest-toggle {
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--muted-color, #8b9198);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-form__guest-toggle:hover,
|
||||||
|
.comment-form__guest-toggle[aria-expanded="true"] {
|
||||||
|
color: var(--focus-color, #f04494);
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-form__guest-fields {
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
align-items: center;
|
||||||
|
max-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
transition: max-height 0.2s ease, opacity 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-form__guest-fields.is-open,
|
||||||
|
.comment-form__guest-fields:not([hidden]) {
|
||||||
|
max-height: 48px;
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-form__guest-field {
|
.comment-form__guest-field {
|
||||||
width: 120px;
|
width: 110px;
|
||||||
height: 32px;
|
height: 30px;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comt-box .comt-textarea,
|
||||||
|
.comt-box #comment {
|
||||||
|
min-height: 72px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.5;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comt-ctrl {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-form__submit {
|
||||||
|
height: 30px;
|
||||||
|
padding: 0 12px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,6 +751,23 @@ body.dark-theme .comment-login-prompt__inner {
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
padding: 0 6px;
|
padding: 0 6px;
|
||||||
}
|
}
|
||||||
|
.medal-icon.img-icon,
|
||||||
|
.aksrt-identity-medal {
|
||||||
|
display: inline-block;
|
||||||
|
width: 1.35em;
|
||||||
|
height: 1.35em;
|
||||||
|
object-fit: contain;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
.aksrt-identity-medal--comment {
|
||||||
|
width: 1.15em;
|
||||||
|
height: 1.15em;
|
||||||
|
}
|
||||||
|
.aksrt-identity-medal.is-wear {
|
||||||
|
outline: 1px solid rgba(245, 158, 11, 0.45);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
.aksrt-comment__badge--hot {
|
.aksrt-comment__badge--hot {
|
||||||
color: #ea580c;
|
color: #ea580c;
|
||||||
background: rgba(234, 88, 12, 0.1);
|
background: rgba(234, 88, 12, 0.1);
|
||||||
|
|||||||
@@ -335,6 +335,59 @@ html.dark .share-item {
|
|||||||
.theme-dark .share-item[data-platform="copy"]:hover { background: rgba(255,255,255,0.06); color: #ccc; }
|
.theme-dark .share-item[data-platform="copy"]:hover { background: rgba(255,255,255,0.06); color: #ccc; }
|
||||||
.theme-dark .share-item[data-platform="poster"]:hover { background: rgba(245,158,11,0.12); color: #f59e0b; }
|
.theme-dark .share-item[data-platform="poster"]:hover { background: rgba(245,158,11,0.12); color: #f59e0b; }
|
||||||
|
|
||||||
|
/* Narrow screens: bottom sheet so dropdown never clips off-screen */
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
.share-dropdown {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: auto;
|
||||||
|
transform: none;
|
||||||
|
width: 100%;
|
||||||
|
max-width: none;
|
||||||
|
z-index: 1200;
|
||||||
|
padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px));
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.share-dropdown[aria-hidden="false"] {
|
||||||
|
animation: shareSheetIn 0.22s ease-out forwards;
|
||||||
|
}
|
||||||
|
@keyframes shareSheetIn {
|
||||||
|
from { opacity: 0; transform: translateY(16px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
.share-dropdown__grid {
|
||||||
|
justify-content: space-around;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
margin: 0 10px;
|
||||||
|
padding: 14px 12px 16px;
|
||||||
|
border-radius: 14px 14px 10px 10px;
|
||||||
|
box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.16);
|
||||||
|
}
|
||||||
|
.share-item {
|
||||||
|
min-width: 64px;
|
||||||
|
flex: 1 1 28%;
|
||||||
|
max-width: 33%;
|
||||||
|
}
|
||||||
|
#share-qrcode-box {
|
||||||
|
position: static;
|
||||||
|
margin: 10px auto 0;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
body.aksrt-share-sheet-open {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
body.aksrt-share-sheet-open::before {
|
||||||
|
content: '';
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.35);
|
||||||
|
z-index: 1190;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.theme-dark .post-drop-meta__menu,
|
.theme-dark .post-drop-meta__menu,
|
||||||
html.dark .post-drop-meta__menu {
|
html.dark .post-drop-meta__menu {
|
||||||
background: var(--surface-1, #323335);
|
background: var(--surface-1, #323335);
|
||||||
|
|||||||
@@ -285,6 +285,14 @@
|
|||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
.article-avatar .medal-icon.img-icon,
|
||||||
|
.article-avatar .aksrt-identity-medal {
|
||||||
|
width: 1.4em;
|
||||||
|
height: 1.4em;
|
||||||
|
object-fit: contain;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
.article-avatar .display-name {
|
.article-avatar .display-name {
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -965,4 +965,24 @@ body.uc-modal-open {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.uc-points-tasks__meta {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
.uc-points-tasks__action {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--muted-color, #8b9198);
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
.uc-points-tasks__action:hover {
|
||||||
|
color: var(--focus-color, #f04494);
|
||||||
|
}
|
||||||
.focus-color { color: var(--focus-color, #f59e0b); }
|
.focus-color { color: var(--focus-color, #f59e0b); }
|
||||||
|
|||||||
@@ -675,6 +675,41 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.AksrtFrontend.register("aksrt-comment-system", function () { initCommentSystem(); });
|
|
||||||
|
function initGuestFields() {
|
||||||
|
var root = document.getElementById("comments") || document;
|
||||||
|
root.querySelectorAll("[data-aksrt-guest-toggle]").forEach(function (btn) {
|
||||||
|
if (btn.dataset.aksrtGuestBound === "1") return;
|
||||||
|
btn.dataset.aksrtGuestBound = "1";
|
||||||
|
var wrap = btn.closest(".comment-form__guest");
|
||||||
|
var fields = wrap ? wrap.querySelector("[data-aksrt-guest-fields]") : null;
|
||||||
|
if (!fields) return;
|
||||||
|
btn.addEventListener("click", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var open = btn.getAttribute("aria-expanded") === "true";
|
||||||
|
btn.setAttribute("aria-expanded", open ? "false" : "true");
|
||||||
|
if (open) {
|
||||||
|
fields.setAttribute("hidden", "");
|
||||||
|
fields.classList.remove("is-open");
|
||||||
|
} else {
|
||||||
|
fields.removeAttribute("hidden");
|
||||||
|
fields.classList.add("is-open");
|
||||||
|
var first = fields.querySelector("input");
|
||||||
|
if (first) first.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Auto-open if browser restored values or validation fails later.
|
||||||
|
var form = btn.closest("form");
|
||||||
|
if (form) {
|
||||||
|
form.addEventListener("invalid", function () {
|
||||||
|
fields.removeAttribute("hidden");
|
||||||
|
fields.classList.add("is-open");
|
||||||
|
btn.setAttribute("aria-expanded", "true");
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.AksrtFrontend.register("aksrt-comment-system", function () { initCommentSystem(); initGuestFields(); });
|
||||||
window.AksrtFrontend.register("aksrt-comment-order", function (root) { initCommentOrder(root); });
|
window.AksrtFrontend.register("aksrt-comment-order", function (root) { initCommentOrder(root); });
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -180,6 +180,28 @@
|
|||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Task-list "去签到" → scroll + click the real asset-card sign-in button.
|
||||||
|
function initSigninGoto() {
|
||||||
|
document.querySelectorAll('[data-aksrt-signin-goto]').forEach(function (el) {
|
||||||
|
el.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var root = document.querySelector('[data-aksrt-signin]');
|
||||||
|
var btn = root ? root.querySelector('[data-signin-btn]') : null;
|
||||||
|
if (!btn) return;
|
||||||
|
try {
|
||||||
|
if (root && typeof root.scrollIntoView === 'function') {
|
||||||
|
root.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
if (!btn.disabled) {
|
||||||
|
btn.click();
|
||||||
|
} else {
|
||||||
|
btn.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// ===== 邀请 =====
|
// ===== 邀请 =====
|
||||||
function initInvite() {
|
function initInvite() {
|
||||||
var root = document.querySelector('[data-aksrt-invite]');
|
var root = document.querySelector('[data-aksrt-invite]');
|
||||||
@@ -944,6 +966,7 @@
|
|||||||
|
|
||||||
function bootAssets() {
|
function bootAssets() {
|
||||||
initSignin();
|
initSignin();
|
||||||
|
initSigninGoto();
|
||||||
initInvite();
|
initInvite();
|
||||||
initVipShop();
|
initVipShop();
|
||||||
initVipPointsExchange();
|
initVipPointsExchange();
|
||||||
|
|||||||
+14
-2
@@ -68,16 +68,28 @@
|
|||||||
function updateFollowButton(btn, isFollowing, count) {
|
function updateFollowButton(btn, isFollowing, count) {
|
||||||
var icon = btn.querySelector('i');
|
var icon = btn.querySelector('i');
|
||||||
var text = btn.querySelector('span');
|
var text = btn.querySelector('span');
|
||||||
|
function setLabel(label) {
|
||||||
|
if (text) {
|
||||||
|
text.textContent = label;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Fallback when markup has bare text nodes next to the icon.
|
||||||
|
var nodes = Array.prototype.slice.call(btn.childNodes);
|
||||||
|
var textNode = nodes.filter(function (n) { return n.nodeType === 3 && n.textContent.trim() !== ''; })[0];
|
||||||
|
if (textNode) {
|
||||||
|
textNode.textContent = ' ' + label + ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isFollowing) {
|
if (isFollowing) {
|
||||||
btn.classList.add('is-following');
|
btn.classList.add('is-following');
|
||||||
if (icon) icon.className = 'fas fa-heart';
|
if (icon) icon.className = 'fas fa-heart';
|
||||||
if (text) text.textContent = '已关注';
|
setLabel('已关注');
|
||||||
btn.title = '点击取消关注';
|
btn.title = '点击取消关注';
|
||||||
} else {
|
} else {
|
||||||
btn.classList.remove('is-following');
|
btn.classList.remove('is-following');
|
||||||
if (icon) icon.className = 'far fa-heart';
|
if (icon) icon.className = 'far fa-heart';
|
||||||
if (text) text.textContent = '关注';
|
setLabel('关注');
|
||||||
btn.title = '关注该用户';
|
btn.title = '关注该用户';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,8 @@
|
|||||||
|
|
||||||
function closeDropdown() {
|
function closeDropdown() {
|
||||||
dropdown.setAttribute('aria-hidden', 'true');
|
dropdown.setAttribute('aria-hidden', 'true');
|
||||||
trigger.setAttribute('aria-expanded', 'false');
|
triggers.forEach(function (t) { t.setAttribute('aria-expanded', 'false'); });
|
||||||
|
document.body.classList.remove('aksrt-share-sheet-open');
|
||||||
if (window.AksrtShare && typeof window.AksrtShare.hideQrFallback === 'function') {
|
if (window.AksrtShare && typeof window.AksrtShare.hideQrFallback === 'function') {
|
||||||
window.AksrtShare.hideQrFallback(qrBox);
|
window.AksrtShare.hideQrFallback(qrBox);
|
||||||
} else if (qrBox) {
|
} else if (qrBox) {
|
||||||
@@ -152,7 +153,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
dropdown.setAttribute('aria-hidden', 'false');
|
dropdown.setAttribute('aria-hidden', 'false');
|
||||||
trigger.setAttribute('aria-expanded', 'true');
|
triggers.forEach(function (t) { t.setAttribute('aria-expanded', 'true'); });
|
||||||
|
if (window.matchMedia && window.matchMedia('(max-width: 767px)').matches) {
|
||||||
|
document.body.classList.add('aksrt-share-sheet-open');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger.addEventListener('click', function (event) {
|
trigger.addEventListener('click', function (event) {
|
||||||
|
|||||||
@@ -648,7 +648,13 @@ class AKSRT_Admin_Schema_Users {
|
|||||||
['key' => 'user_badge_limit', 'label' => '最多显示数量', 'type' => 'number', 'default' => 3, 'min' => 1, 'max' => 8],
|
['key' => 'user_badge_limit', 'label' => '最多显示数量', 'type' => 'number', 'default' => 3, 'min' => 1, 'max' => 8],
|
||||||
]],
|
]],
|
||||||
['key' => 'dictionary', 'title' => '徽章字典', 'fields' => [
|
['key' => 'dictionary', 'title' => '徽章字典', 'fields' => [
|
||||||
['key' => 'user_badge_dictionary', 'label' => '徽章列表', 'type' => 'textarea', 'default' => "founder|创始成员|warning\nstaff|站务团队|info"],
|
[
|
||||||
|
'key' => 'user_badge_dictionary',
|
||||||
|
'label' => '徽章列表',
|
||||||
|
'type' => 'textarea',
|
||||||
|
'default' => "founder|创始成员|warning\nstaff|站务团队|info",
|
||||||
|
'help' => '每行:slug|显示文案|色调(neutral/info/success/warning/brand)|图标URL(可选)。配置 icon_url 后前台显示勋章图;用户 meta aksrt_wear_badge 指定当前佩戴。',
|
||||||
|
],
|
||||||
]],
|
]],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -172,6 +172,9 @@ class AKSRT_Balance_Service {
|
|||||||
if (empty($cfg['enabled']) || empty($cfg['transfer']['enabled'])) {
|
if (empty($cfg['enabled']) || empty($cfg['transfer']['enabled'])) {
|
||||||
return new WP_Error('aksrt_transfer_closed', __('余额转账未开启', 'aksrt'), ['status' => 403]);
|
return new WP_Error('aksrt_transfer_closed', __('余额转账未开启', 'aksrt'), ['status' => 403]);
|
||||||
}
|
}
|
||||||
|
if (class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('balance_transfer', $from_id)) {
|
||||||
|
return new WP_Error('aksrt_transfer_forbidden', __('当前账号无权转账余额', 'aksrt'), ['status' => 403]);
|
||||||
|
}
|
||||||
$amount = round((float) $amount_raw, 2);
|
$amount = round((float) $amount_raw, 2);
|
||||||
if ($amount <= 0) {
|
if ($amount <= 0) {
|
||||||
return new WP_Error('aksrt_transfer_amount', __('请输入有效金额', 'aksrt'), ['status' => 400]);
|
return new WP_Error('aksrt_transfer_amount', __('请输入有效金额', 'aksrt'), ['status' => 400]);
|
||||||
@@ -220,6 +223,9 @@ class AKSRT_Balance_Service {
|
|||||||
if (!class_exists('AKSRT_Settings') || !AKSRT_Settings::credits_enabled() || !$points_transfer_on) {
|
if (!class_exists('AKSRT_Settings') || !AKSRT_Settings::credits_enabled() || !$points_transfer_on) {
|
||||||
return new WP_Error('aksrt_transfer_closed', __('积分转账未开启', 'aksrt'), ['status' => 403]);
|
return new WP_Error('aksrt_transfer_closed', __('积分转账未开启', 'aksrt'), ['status' => 403]);
|
||||||
}
|
}
|
||||||
|
if (class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('points_transfer', $from_id)) {
|
||||||
|
return new WP_Error('aksrt_transfer_forbidden', __('当前账号无权转账积分', 'aksrt'), ['status' => 403]);
|
||||||
|
}
|
||||||
$amount = (int) $amount_raw;
|
$amount = (int) $amount_raw;
|
||||||
if ($amount <= 0) {
|
if ($amount <= 0) {
|
||||||
return new WP_Error('aksrt_transfer_amount', __('请输入有效积分', 'aksrt'), ['status' => 400]);
|
return new WP_Error('aksrt_transfer_amount', __('请输入有效积分', 'aksrt'), ['status' => 400]);
|
||||||
@@ -724,6 +730,9 @@ class AKSRT_Balance_Service {
|
|||||||
$params = $request->get_params();
|
$params = $request->get_params();
|
||||||
}
|
}
|
||||||
$user_id = get_current_user_id();
|
$user_id = get_current_user_id();
|
||||||
|
if (class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('balance_withdraw', $user_id)) {
|
||||||
|
return new WP_Error('aksrt_withdraw_forbidden', __('当前账号无权提现', 'aksrt'), ['status' => 403]);
|
||||||
|
}
|
||||||
$amount = round((float) ($params['amount'] ?? 0), 2);
|
$amount = round((float) ($params['amount'] ?? 0), 2);
|
||||||
$method = sanitize_key((string) ($params['method'] ?? 'alipay'));
|
$method = sanitize_key((string) ($params['method'] ?? 'alipay'));
|
||||||
$account = sanitize_textarea_field((string) ($params['account_info'] ?? $params['account'] ?? ''));
|
$account = sanitize_textarea_field((string) ($params['account_info'] ?? $params['account'] ?? ''));
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class AKSRT_User_Home {
|
|||||||
/**
|
/**
|
||||||
* 获取公开展示的身份信号(认证 / 等级 / 徽章)。
|
* 获取公开展示的身份信号(认证 / 等级 / 徽章)。
|
||||||
*
|
*
|
||||||
* @return array<int,array{label:string,icon:string,tone:string}>
|
* @return array<int,array{label:string,icon:string,tone:string,icon_url?:string,type?:string,slug?:string,wear?:bool}>
|
||||||
*/
|
*/
|
||||||
public function get_profile_signals(int $user_id): array {
|
public function get_profile_signals(int $user_id): array {
|
||||||
if ($user_id <= 0 || !class_exists('AKSRT_Settings')) {
|
if ($user_id <= 0 || !class_exists('AKSRT_Settings')) {
|
||||||
@@ -142,6 +142,7 @@ class AKSRT_User_Home {
|
|||||||
|
|
||||||
if (!empty($settings['verify']['enabled']) && !empty($settings['verify']['public_display']) && $this->is_user_verified($user_id, $settings['verify'])) {
|
if (!empty($settings['verify']['enabled']) && !empty($settings['verify']['public_display']) && $this->is_user_verified($user_id, $settings['verify'])) {
|
||||||
$signals[] = [
|
$signals[] = [
|
||||||
|
'type' => 'verify',
|
||||||
'label' => (string) $settings['verify']['badge_text'],
|
'label' => (string) $settings['verify']['badge_text'],
|
||||||
'icon' => 'check-circle',
|
'icon' => 'check-circle',
|
||||||
'tone' => 'success',
|
'tone' => 'success',
|
||||||
@@ -152,6 +153,7 @@ class AKSRT_User_Home {
|
|||||||
$level = $this->get_user_level($user_id, $settings['level']);
|
$level = $this->get_user_level($user_id, $settings['level']);
|
||||||
if ($level > 0) {
|
if ($level > 0) {
|
||||||
$signals[] = [
|
$signals[] = [
|
||||||
|
'type' => 'level',
|
||||||
'label' => (string) $settings['level']['label_prefix'] . $level,
|
'label' => (string) $settings['level']['label_prefix'] . $level,
|
||||||
'icon' => 'layer-group',
|
'icon' => 'layer-group',
|
||||||
'tone' => 'info',
|
'tone' => 'info',
|
||||||
@@ -171,21 +173,36 @@ class AKSRT_User_Home {
|
|||||||
if (!is_array($assigned)) {
|
if (!is_array($assigned)) {
|
||||||
$assigned = preg_split('/[\s,]+/', (string) $assigned, -1, PREG_SPLIT_NO_EMPTY);
|
$assigned = preg_split('/[\s,]+/', (string) $assigned, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
}
|
}
|
||||||
|
$assigned = array_values(array_filter(array_map(static function ($slug) {
|
||||||
|
return sanitize_key((string) $slug);
|
||||||
|
}, (array) $assigned)));
|
||||||
|
|
||||||
|
// Prefer worn badge first (Zibll wear-medal).
|
||||||
|
$wear = sanitize_key((string) get_user_meta($user_id, 'aksrt_wear_badge', true));
|
||||||
|
if ($wear !== '' && in_array($wear, $assigned, true) && isset($badge_map[$wear])) {
|
||||||
|
$assigned = array_values(array_unique(array_merge([$wear], $assigned)));
|
||||||
|
}
|
||||||
|
|
||||||
$limit = max(1, (int) ($settings['badge']['limit'] ?? 3));
|
$limit = max(1, (int) ($settings['badge']['limit'] ?? 3));
|
||||||
foreach ((array) $assigned as $slug) {
|
$badge_count = 0;
|
||||||
$slug = sanitize_key((string) $slug);
|
foreach ($assigned as $slug) {
|
||||||
if ($slug === '' || !isset($badge_map[$slug])) {
|
if ($slug === '' || !isset($badge_map[$slug])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$icon_url = (string) ($badge_map[$slug]['icon_url'] ?? '');
|
||||||
$signals[] = [
|
$signals[] = [
|
||||||
'label' => (string) $badge_map[$slug]['label'],
|
'type' => 'badge',
|
||||||
'icon' => 'award',
|
'slug' => $slug,
|
||||||
'tone' => (string) ($badge_map[$slug]['tone'] ?? 'neutral'),
|
'label' => (string) $badge_map[$slug]['label'],
|
||||||
|
'icon' => 'award',
|
||||||
|
'tone' => (string) ($badge_map[$slug]['tone'] ?? 'neutral'),
|
||||||
|
'icon_url' => $icon_url,
|
||||||
|
'wear' => ($wear !== '' && $slug === $wear),
|
||||||
];
|
];
|
||||||
|
$badge_count++;
|
||||||
|
|
||||||
if (count($signals) >= $limit + 2) {
|
if ($badge_count >= $limit) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class AKSRT_Settings_Capabilities {
|
|||||||
'user_report' => ['label' => __('举报其它用户', 'aksrt'), 'default' => ['logged' => true]],
|
'user_report' => ['label' => __('举报其它用户', 'aksrt'), 'default' => ['logged' => true]],
|
||||||
'balance_transfer' => ['label' => __('余额转账给其他用户', 'aksrt'), 'exclude_roles' => ['all']],
|
'balance_transfer' => ['label' => __('余额转账给其他用户', 'aksrt'), 'exclude_roles' => ['all']],
|
||||||
'points_transfer' => ['label' => __('积分转账给其他用户', 'aksrt'), 'exclude_roles' => ['all']],
|
'points_transfer' => ['label' => __('积分转账给其他用户', 'aksrt'), 'exclude_roles' => ['all']],
|
||||||
|
'balance_withdraw' => ['label' => __('余额提现', 'aksrt'), 'exclude_roles' => ['all']],
|
||||||
'set_user_ban' => ['label' => __('设置用户封禁状态', 'aksrt'), 'roles' => ['cat_moderator'], 'default' => ['cat_moderator' => true]],
|
'set_user_ban' => ['label' => __('设置用户封禁状态', 'aksrt'), 'roles' => ['cat_moderator'], 'default' => ['cat_moderator' => true]],
|
||||||
'medal_manually_set' => ['label' => __('为用户授予徽章', 'aksrt'), 'roles' => ['cat_moderator'], 'default' => ['cat_moderator' => true]],
|
'medal_manually_set' => ['label' => __('为用户授予徽章', 'aksrt'), 'roles' => ['cat_moderator'], 'default' => ['cat_moderator' => true]],
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class AKSRT_Settings_User_Runtime {
|
|||||||
* @return array{
|
* @return array{
|
||||||
* verify:array{enabled:bool,public_display:bool,badge_text:string,accept_email_verified:bool,require_manual_review:bool},
|
* verify:array{enabled:bool,public_display:bool,badge_text:string,accept_email_verified:bool,require_manual_review:bool},
|
||||||
* level:array{enabled:bool,public_display:bool,source:string,label_prefix:string,thresholds:array<int,int>},
|
* level:array{enabled:bool,public_display:bool,source:string,label_prefix:string,thresholds:array<int,int>},
|
||||||
* badge:array{enabled:bool,public_display:bool,limit:int,dictionary:array<int,array{slug:string,label:string,tone:string}>},
|
* badge:array{enabled:bool,public_display:bool,limit:int,dictionary:array<int,array{slug:string,label:string,tone:string,icon_url?:string}>},
|
||||||
* report:array{enabled:bool,public_entry:bool,public_notice:bool,ban_notice_text:string,categories:array<int,array{slug:string,label:string}>}
|
* report:array{enabled:bool,public_entry:bool,public_notice:bool,ban_notice_text:string,categories:array<int,array{slug:string,label:string}>}
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
@@ -238,7 +238,7 @@ class AKSRT_Settings_User_Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<int,array{slug:string,label:string,tone:string}>
|
* @return array<int,array{slug:string,label:string,tone:string,icon_url:string}>
|
||||||
*/
|
*/
|
||||||
public static function parse_badge_dictionary(string $raw): array {
|
public static function parse_badge_dictionary(string $raw): array {
|
||||||
$lines = preg_split('/[\r\n]+/', $raw, -1, PREG_SPLIT_NO_EMPTY);
|
$lines = preg_split('/[\r\n]+/', $raw, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
@@ -254,6 +254,7 @@ class AKSRT_Settings_User_Runtime {
|
|||||||
$slug = sanitize_key((string) $parts[0]);
|
$slug = sanitize_key((string) $parts[0]);
|
||||||
$label = sanitize_text_field((string) $parts[1]);
|
$label = sanitize_text_field((string) $parts[1]);
|
||||||
$tone = isset($parts[2]) ? sanitize_key((string) $parts[2]) : 'neutral';
|
$tone = isset($parts[2]) ? sanitize_key((string) $parts[2]) : 'neutral';
|
||||||
|
$icon_url = isset($parts[3]) ? esc_url_raw((string) $parts[3]) : '';
|
||||||
|
|
||||||
if ($slug === '' || $label === '') {
|
if ($slug === '' || $label === '') {
|
||||||
continue;
|
continue;
|
||||||
@@ -264,9 +265,10 @@ class AKSRT_Settings_User_Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'slug' => $slug,
|
'slug' => $slug,
|
||||||
'label' => $label,
|
'label' => $label,
|
||||||
'tone' => $tone,
|
'tone' => $tone,
|
||||||
|
'icon_url' => $icon_url,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ if (!function_exists('aksrt_comments_render_form')) :
|
|||||||
<span class="comt-tips-left comment-form__reply-text"></span>
|
<span class="comt-tips-left comment-form__reply-text"></span>
|
||||||
<span class="comt-tips-right"><a href="javascript:;" id="cancel-comment-reply-link" class="comment-form__cancel-reply"><i class="fas fa-times"></i> <?php esc_html_e('取消', 'aksrt'); ?></a></span>
|
<span class="comt-tips-right"><a href="javascript:;" id="cancel-comment-reply-link" class="comment-form__cancel-reply"><i class="fas fa-times"></i> <?php esc_html_e('取消', 'aksrt'); ?></a></span>
|
||||||
</div>
|
</div>
|
||||||
<textarea id="comment" name="comment" class="form-control grin" rows="3" placeholder="<?php echo esc_attr((string) $ctx['box_placeholder']); ?>" required></textarea>
|
<textarea id="comment" name="comment" class="form-control grin comt-textarea" rows="2" placeholder="<?php echo esc_attr((string) $ctx['box_placeholder']); ?>" required></textarea>
|
||||||
<div class="comt-ctrl">
|
<div class="comt-ctrl">
|
||||||
<div class="comment-toolbar" role="toolbar" aria-label="<?php esc_attr_e('评论工具栏', 'aksrt'); ?>">
|
<div class="comment-toolbar" role="toolbar" aria-label="<?php esc_attr_e('评论工具栏', 'aksrt'); ?>">
|
||||||
<button type="button" class="comment-toolbar__btn"<?php echo empty($toolbar['smilie']) ? ' hidden' : ''; ?> title="<?php esc_attr_e('表情', 'aksrt'); ?>" data-toolbar-action="emoji"><i class="far fa-smile"></i></button>
|
<button type="button" class="comment-toolbar__btn"<?php echo empty($toolbar['smilie']) ? ' hidden' : ''; ?> title="<?php esc_attr_e('表情', 'aksrt'); ?>" data-toolbar-action="emoji"><i class="far fa-smile"></i></button>
|
||||||
@@ -474,8 +474,15 @@ if (!function_exists('aksrt_comments_render_form')) :
|
|||||||
</div>
|
</div>
|
||||||
<div class="comment-form__submit-area">
|
<div class="comment-form__submit-area">
|
||||||
<?php if (!$is_logged_in) : ?>
|
<?php if (!$is_logged_in) : ?>
|
||||||
<input type="text" name="author" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('昵称', 'aksrt'); ?>" required>
|
<div class="comment-form__guest">
|
||||||
<input type="email" name="email" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('邮箱', 'aksrt'); ?>" required>
|
<button type="button" class="comment-form__guest-toggle muted-color em09" data-aksrt-guest-toggle aria-expanded="false">
|
||||||
|
<i class="fa fa-user-edit em09" aria-hidden="true"></i> <?php esc_html_e('填写昵称邮箱', 'aksrt'); ?>
|
||||||
|
</button>
|
||||||
|
<div class="comment-form__guest-fields" data-aksrt-guest-fields hidden>
|
||||||
|
<input type="text" name="author" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('昵称', 'aksrt'); ?>" required>
|
||||||
|
<input type="email" name="email" class="form-control form-control-sm comment-form__guest-field" placeholder="<?php esc_attr_e('邮箱', 'aksrt'); ?>" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<button type="submit" class="btn btn-primary btn-sm comment-form__submit" id="comment-submit">
|
<button type="submit" class="btn btn-primary btn-sm comment-form__submit" id="comment-submit">
|
||||||
<i class="fas fa-paper-plane" aria-hidden="true"></i>
|
<i class="fas fa-paper-plane" aria-hidden="true"></i>
|
||||||
@@ -571,10 +578,21 @@ if (!function_exists('aksrt_comments_render_empty')) :
|
|||||||
* @param array<string,mixed> $ctx Comments context.
|
* @param array<string,mixed> $ctx Comments context.
|
||||||
*/
|
*/
|
||||||
function aksrt_comments_render_empty(array $ctx): void {
|
function aksrt_comments_render_empty(array $ctx): void {
|
||||||
|
$closed = !comments_open();
|
||||||
$text = (string) ($ctx['empty_text'] ?? __('暂无评论内容', 'aksrt'));
|
$text = (string) ($ctx['empty_text'] ?? __('暂无评论内容', 'aksrt'));
|
||||||
|
if ($closed) {
|
||||||
|
$text = __('评论已关闭', 'aksrt');
|
||||||
|
} elseif (!empty($ctx['author_only'])) {
|
||||||
|
$text = __('暂无作者评论', 'aksrt');
|
||||||
|
}
|
||||||
|
$hint = $closed
|
||||||
|
? __('本文评论已关闭,仅可浏览历史留言', 'aksrt')
|
||||||
|
: (!empty($ctx['author_only'])
|
||||||
|
? __('切换到「查看全部」可浏览其他评论', 'aksrt')
|
||||||
|
: __('成为第一个评论者吧', 'aksrt'));
|
||||||
if (function_exists('aksrt_get_null')) {
|
if (function_exists('aksrt_get_null')) {
|
||||||
echo aksrt_get_null($text, 40, 'null.svg', 'comment comment-null comments-empty', 220); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
echo aksrt_get_null($text, 40, 'null.svg', 'comment comment-null comments-empty', 220); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
echo '<p class="comments-empty__hint muted-3-color em09 text-center" style="margin-top:-20px;">' . esc_html__('成为第一个评论者吧', 'aksrt') . '</p>';
|
echo '<p class="comments-empty__hint muted-3-color em09 text-center" style="margin-top:-20px;">' . esc_html($hint) . '</p>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -583,7 +601,7 @@ if (!function_exists('aksrt_comments_render_empty')) :
|
|||||||
<i class="far fa-comment-dots"></i>
|
<i class="far fa-comment-dots"></i>
|
||||||
</div>
|
</div>
|
||||||
<p class="comments-empty__text"><?php echo esc_html($text); ?></p>
|
<p class="comments-empty__text"><?php echo esc_html($text); ?></p>
|
||||||
<p class="comments-empty__hint"><?php esc_html_e('成为第一个评论者吧', 'aksrt'); ?></p>
|
<p class="comments-empty__hint"><?php echo esc_html($hint); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ defined('ABSPATH') || exit;
|
|||||||
|
|
||||||
if (!function_exists('aksrt_get_user_identity_signals')) {
|
if (!function_exists('aksrt_get_user_identity_signals')) {
|
||||||
/**
|
/**
|
||||||
* @return list<array{type:string,label:string,icon:string,tone:string,title?:string}>
|
* @return list<array{type?:string,label:string,icon:string,tone:string,title?:string,icon_url?:string,slug?:string,wear?:bool}>
|
||||||
*/
|
*/
|
||||||
function aksrt_get_user_identity_signals(int $user_id): array {
|
function aksrt_get_user_identity_signals(int $user_id): array {
|
||||||
if ($user_id <= 0) {
|
if ($user_id <= 0) {
|
||||||
@@ -27,6 +27,8 @@ if (!function_exists('aksrt_render_user_identity_chips')) {
|
|||||||
/**
|
/**
|
||||||
* Render compact identity chips (verify / level / badges).
|
* Render compact identity chips (verify / level / badges).
|
||||||
*
|
*
|
||||||
|
* Badge signals with icon_url render as Zibll-like medal images.
|
||||||
|
*
|
||||||
* @param int $user_id
|
* @param int $user_id
|
||||||
* @param string $context author|comment|card
|
* @param string $context author|comment|card
|
||||||
*/
|
*/
|
||||||
@@ -42,8 +44,9 @@ if (!function_exists('aksrt_render_user_identity_chips')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$signals = aksrt_get_user_identity_signals($user_id);
|
$signals = aksrt_get_user_identity_signals($user_id);
|
||||||
$limit = $context === 'comment' ? 3 : 6;
|
// Comments stay compact; author/card can show more.
|
||||||
$n = 0;
|
$limit = $context === 'comment' ? 3 : 6;
|
||||||
|
$n = 0;
|
||||||
foreach ($signals as $signal) {
|
foreach ($signals as $signal) {
|
||||||
if ($n >= $limit) {
|
if ($n >= $limit) {
|
||||||
break;
|
break;
|
||||||
@@ -52,14 +55,32 @@ if (!function_exists('aksrt_render_user_identity_chips')) {
|
|||||||
if ($label === '') {
|
if ($label === '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$tone = sanitize_html_class((string) ($signal['tone'] ?? 'info'));
|
$tone = sanitize_html_class((string) ($signal['tone'] ?? 'info'));
|
||||||
$icon = sanitize_html_class((string) ($signal['icon'] ?? 'check'));
|
$icon = sanitize_html_class((string) ($signal['icon'] ?? 'check'));
|
||||||
|
$icon_url = esc_url((string) ($signal['icon_url'] ?? ''));
|
||||||
|
$title = (string) ($signal['title'] ?? $label);
|
||||||
|
$is_wear = !empty($signal['wear']);
|
||||||
|
$type = sanitize_html_class((string) ($signal['type'] ?? ''));
|
||||||
|
|
||||||
|
// Image medal when dictionary provides icon_url.
|
||||||
|
if ($icon_url !== '') {
|
||||||
|
$classes = 'medal-icon img-icon ml3 aksrt-identity-medal aksrt-identity-medal--' . $context;
|
||||||
|
if ($is_wear) {
|
||||||
|
$classes .= ' is-wear';
|
||||||
|
}
|
||||||
|
if ($type !== '') {
|
||||||
|
$classes .= ' aksrt-identity-medal--' . $type;
|
||||||
|
}
|
||||||
|
$html .= '<img class="' . esc_attr($classes) . '" src="' . $icon_url . '" alt="' . esc_attr($label) . '" title="' . esc_attr($title) . '" loading="lazy" decoding="async" />';
|
||||||
|
$n++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Font Awesome: map short names to fa-* if needed.
|
// Font Awesome: map short names to fa-* if needed.
|
||||||
if ($icon !== '' && !str_contains($icon, 'fa-')) {
|
if ($icon !== '' && !str_contains($icon, 'fa-')) {
|
||||||
$icon = 'fa-' . $icon;
|
$icon = 'fa-' . $icon;
|
||||||
}
|
}
|
||||||
$title = (string) ($signal['title'] ?? $label);
|
$html .= '<span class="badg badg-sm ml3 aksrt-identity-chip aksrt-identity-chip--' . esc_attr($tone) . ' aksrt-identity-chip--' . esc_attr($context) . ($is_wear ? ' is-wear' : '') . '" title="' . esc_attr($title) . '">';
|
||||||
$html .= '<span class="badg badg-sm ml3 aksrt-identity-chip aksrt-identity-chip--' . esc_attr($tone) . ' aksrt-identity-chip--' . esc_attr($context) . '" title="' . esc_attr($title) . '">';
|
|
||||||
if ($icon !== '') {
|
if ($icon !== '') {
|
||||||
$html .= '<i class="fa ' . esc_attr($icon) . '" aria-hidden="true"></i> ';
|
$html .= '<i class="fa ' . esc_attr($icon) . '" aria-hidden="true"></i> ';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,63 +299,79 @@ if (!function_exists('aksrt_single_render_author_card')) :
|
|||||||
* @param array<string,mixed> $ctx Single context.
|
* @param array<string,mixed> $ctx Single context.
|
||||||
*/
|
*/
|
||||||
function aksrt_single_render_author_card(array $ctx): void {
|
function aksrt_single_render_author_card(array $ctx): void {
|
||||||
$author_id = (int) get_the_author_meta('ID');
|
$author_id = (int) get_the_author_meta('ID');
|
||||||
if ($author_id <= 0) {
|
if ($author_id <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$author_url = get_author_posts_url($author_id);
|
$author_url = get_author_posts_url($author_id);
|
||||||
$author_name = get_the_author();
|
$author_name = get_the_author();
|
||||||
$bio = trim((string) get_the_author_meta('description'));
|
$bio = trim((string) get_the_author_meta('description'));
|
||||||
$identity_chips = function_exists('aksrt_render_user_identity_chips')
|
$identity_chips = function_exists('aksrt_render_user_identity_chips')
|
||||||
? aksrt_render_user_identity_chips($author_id, 'card')
|
? aksrt_render_user_identity_chips($author_id, 'card')
|
||||||
: '';
|
: '';
|
||||||
$avatar = function_exists('aksrt_get_avatar_html')
|
$avatar = function_exists('aksrt_get_avatar_html')
|
||||||
? aksrt_get_avatar_html($author_id, 80, ['class' => 'avatar avatar-lg'])
|
? aksrt_get_avatar_html($author_id, 80, ['class' => 'avatar avatar-lg'])
|
||||||
: get_avatar($author_id, 80, '', esc_attr($author_name), ['class' => 'avatar avatar-lg']);
|
: get_avatar($author_id, 80, '', esc_attr($author_name), ['class' => 'avatar avatar-lg']);
|
||||||
$recent = get_posts([
|
$recent = get_posts([
|
||||||
'author' => $author_id,
|
'author' => $author_id,
|
||||||
'post_type' => 'post',
|
'post_type' => 'post',
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'posts_per_page' => 6,
|
'posts_per_page' => 6,
|
||||||
'orderby' => 'date',
|
'orderby' => 'date',
|
||||||
'order' => 'DESC',
|
'order' => 'DESC',
|
||||||
'no_found_rows' => true,
|
'no_found_rows' => true,
|
||||||
]);
|
]);
|
||||||
?>
|
$is_self = is_user_logged_in() && get_current_user_id() === $author_id;
|
||||||
<div class="user-card author zib-widget">
|
$login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url(get_permalink());
|
||||||
<div class="card-content mt10 relative">
|
?>
|
||||||
<div class="user-content">
|
<div class="user-card author zib-widget">
|
||||||
<div class="user-avatar"><?php echo $avatar; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
<div class="card-content mt10 relative">
|
||||||
<div class="user-info mt20 mb10">
|
<div class="user-content">
|
||||||
<div class="user-name flex jc">
|
<div class="user-avatar"><?php echo $avatar; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
||||||
<a class="display-name" href="<?php echo esc_url($author_url); ?>"><?php echo esc_html($author_name); ?></a>
|
<div class="user-info mt20 mb10">
|
||||||
<?php if ($identity_chips !== '') : ?>
|
<div class="user-name flex jc ac">
|
||||||
<?php echo $identity_chips; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
<a class="display-name" href="<?php echo esc_url($author_url); ?>"><?php echo esc_html($author_name); ?></a>
|
||||||
<?php endif; ?>
|
<?php if ($identity_chips !== '') : ?>
|
||||||
</div>
|
<?php echo $identity_chips; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
<?php if ($bio !== '') : ?>
|
|
||||||
<div class="user-desc mt10 muted-2-color em09"><?php echo esc_html($bio); ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="user-btns mt20">
|
|
||||||
<a class="but pw-1em mr6 jb-blue" href="<?php echo esc_url($author_url); ?>"><?php esc_html_e('个人主页', 'aksrt'); ?></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php if (!empty($recent)) : ?>
|
|
||||||
<div class="user-card-posts mt10">
|
|
||||||
<ul class="no-thumb">
|
|
||||||
<?php foreach ($recent as $rp) : ?>
|
|
||||||
<?php if ($rp instanceof WP_Post) : ?>
|
|
||||||
<li><a class="icon-circle" href="<?php echo esc_url(get_permalink($rp)); ?>"><?php echo esc_html(get_the_title($rp)); ?></a></li>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
</div>
|
||||||
</ul>
|
<?php if ($bio !== '') : ?>
|
||||||
|
<div class="user-desc mt10 muted-2-color em09"><?php echo esc_html($bio); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="user-btns mt20">
|
||||||
|
<?php if (!$is_self) : ?>
|
||||||
|
<?php if (is_user_logged_in()) : ?>
|
||||||
|
<button type="button" class="but pw-1em mr6 c-red follow" data-aksrt-follow="<?php echo (int) $author_id; ?>">
|
||||||
|
<i class="fa fa-heart em09" aria-hidden="true"></i> <span><?php esc_html_e('关注', 'aksrt'); ?></span>
|
||||||
|
</button>
|
||||||
|
<?php else : ?>
|
||||||
|
<a href="<?php echo esc_url($login_url); ?>" class="but pw-1em mr6 c-red follow">
|
||||||
|
<i class="fa fa-heart em09" aria-hidden="true"></i> <span><?php esc_html_e('关注', 'aksrt'); ?></span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<a class="but pw-1em mr6 jb-blue" href="<?php echo esc_url($author_url); ?>"><?php esc_html_e('个人主页', 'aksrt'); ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php if (!empty($recent)) : ?>
|
||||||
|
<div class="user-card-posts mt10">
|
||||||
|
<ul class="no-thumb">
|
||||||
|
<?php foreach ($recent as $rp) : ?>
|
||||||
|
<?php if ($rp instanceof WP_Post) : ?>
|
||||||
|
<li><a class="icon-circle" href="<?php echo esc_url(get_permalink($rp)); ?>"><?php echo esc_html(get_the_title($rp)); ?></a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<div class="user-card-posts mt10 muted-2-color em09 text-center"><?php esc_html_e('暂无更多文章', 'aksrt'); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php
|
||||||
<?php
|
}
|
||||||
}
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if (!function_exists('aksrt_single_render_prevnext')) :
|
if (!function_exists('aksrt_single_render_prevnext')) :
|
||||||
|
|||||||
@@ -1357,16 +1357,33 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) :
|
|||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ($share_on) :
|
if ($share_on) :
|
||||||
|
$share_title = get_the_title($post_id);
|
||||||
|
$share_url = get_permalink($post_id) ?: '';
|
||||||
|
$share_image = get_the_post_thumbnail_url($post_id, 'large') ?: '';
|
||||||
?>
|
?>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="tabbar-item single-action-tabbar action-share"
|
class="tabbar-item single-action-tabbar action-share"
|
||||||
data-type="share"
|
data-type="share"
|
||||||
|
data-share-title="<?php echo esc_attr((string) $share_title); ?>"
|
||||||
|
data-share-url="<?php echo esc_url((string) $share_url); ?>"
|
||||||
|
<?php if ($share_image !== '') : ?>data-share-image="<?php echo esc_url((string) $share_image); ?>"<?php endif; ?>
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-label="<?php esc_attr_e('分享', 'aksrt'); ?>">
|
aria-label="<?php esc_attr_e('分享', 'aksrt'); ?>">
|
||||||
<i class="fas fa-share-alt" aria-hidden="true"></i>
|
<i class="fas fa-share-alt" aria-hidden="true"></i>
|
||||||
<?php if ($show_text) : ?><span><?php esc_html_e('分享', 'aksrt'); ?></span><?php endif; ?>
|
<?php if ($show_text) : ?><span><?php esc_html_e('分享', 'aksrt'); ?></span><?php endif; ?>
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button"
|
||||||
|
class="tabbar-item single-action-tabbar action-poster"
|
||||||
|
data-type="poster"
|
||||||
|
data-share-platform="poster"
|
||||||
|
data-share-title="<?php echo esc_attr((string) $share_title); ?>"
|
||||||
|
data-share-url="<?php echo esc_url((string) $share_url); ?>"
|
||||||
|
<?php if ($share_image !== '') : ?>data-share-image="<?php echo esc_url((string) $share_image); ?>"<?php endif; ?>
|
||||||
|
aria-label="<?php esc_attr_e('海报', 'aksrt'); ?>">
|
||||||
|
<i class="fas fa-image" aria-hidden="true"></i>
|
||||||
|
<?php if ($show_text) : ?><span><?php esc_html_e('海报', 'aksrt'); ?></span><?php endif; ?>
|
||||||
|
</button>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ if (class_exists('AKSRT_Charge_Card')) {
|
|||||||
$card_pass_credits = is_array($opts['credits'] ?? null) ? $opts['credits'] : $card_pass_credits;
|
$card_pass_credits = is_array($opts['credits'] ?? null) ? $opts['credits'] : $card_pass_credits;
|
||||||
}
|
}
|
||||||
$all_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_all() : [];
|
$all_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_all() : [];
|
||||||
|
$points_uid = (int) ($user_id ?? get_current_user_id());
|
||||||
$points_transfer_on = !empty($all_settings['points_transfer_s']);
|
$points_transfer_on = !empty($all_settings['points_transfer_s']);
|
||||||
|
if ($points_transfer_on && class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('points_transfer', $points_uid)) {
|
||||||
|
$points_transfer_on = false;
|
||||||
|
}
|
||||||
$points_buy_on = class_exists('AKSRT_Balance_Service') && AKSRT_Balance_Service::get_instance()->points_buy_enabled();
|
$points_buy_on = class_exists('AKSRT_Balance_Service') && AKSRT_Balance_Service::get_instance()->points_buy_enabled();
|
||||||
$points_buy_view = $points_buy_on ? AKSRT_Balance_Service::get_instance()->get_points_buy_view((int) ($user_id ?? 0)) : [];
|
$points_buy_view = $points_buy_on ? AKSRT_Balance_Service::get_instance()->get_points_buy_view((int) ($user_id ?? 0)) : [];
|
||||||
$currency = (string) ($currency_name ?? __('积分', 'aksrt'));
|
$currency = (string) ($currency_name ?? __('积分', 'aksrt'));
|
||||||
|
|||||||
@@ -11,6 +11,94 @@ if (!class_exists('AKSRT_Points_Free') || !AKSRT_Points_Free::enabled()) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve a "go complete" action for a free-points task row.
|
||||||
|
*
|
||||||
|
* @return array{type:string,label:string,href?:string}
|
||||||
|
*/
|
||||||
|
$aksrt_points_task_action = static function (string $key): array {
|
||||||
|
$home = home_url('/');
|
||||||
|
$submit = '';
|
||||||
|
if (function_exists('aksrt_get_page_url_by_template')) {
|
||||||
|
$submit = (string) aksrt_get_page_url_by_template('templates/pages/page-submit.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
$forum_on = false;
|
||||||
|
$forum_home = '';
|
||||||
|
$forum_compose = '';
|
||||||
|
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_forum_settings')) {
|
||||||
|
$f = AKSRT_Settings::get_forum_settings();
|
||||||
|
$forum_on = !empty($f['enabled']);
|
||||||
|
}
|
||||||
|
if ($forum_on) {
|
||||||
|
if (function_exists('aksrt_get_forum_home_url')) {
|
||||||
|
$forum_home = (string) aksrt_get_forum_home_url();
|
||||||
|
}
|
||||||
|
if (function_exists('aksrt_get_forum_compose_url')) {
|
||||||
|
$forum_compose = (string) aksrt_get_forum_compose_url();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($key) {
|
||||||
|
case 'sign_in':
|
||||||
|
return [
|
||||||
|
'type' => 'signin',
|
||||||
|
'label' => __('去签到', 'aksrt'),
|
||||||
|
];
|
||||||
|
case 'post_new':
|
||||||
|
return [
|
||||||
|
'type' => 'link',
|
||||||
|
'label' => __('去完成', 'aksrt'),
|
||||||
|
'href' => $submit !== '' ? $submit : $home,
|
||||||
|
];
|
||||||
|
case 'comment_new':
|
||||||
|
return [
|
||||||
|
'type' => 'link',
|
||||||
|
'label' => __('去完成', 'aksrt'),
|
||||||
|
'href' => $home,
|
||||||
|
];
|
||||||
|
case 'login':
|
||||||
|
case 'post_like':
|
||||||
|
case 'post_favorite':
|
||||||
|
case 'followed':
|
||||||
|
case 'comment_like':
|
||||||
|
return [
|
||||||
|
'type' => 'link',
|
||||||
|
'label' => __('去看看', 'aksrt'),
|
||||||
|
'href' => $home,
|
||||||
|
];
|
||||||
|
case 'bbs_posts_new':
|
||||||
|
case 'bbs_reply':
|
||||||
|
if (!$forum_on) {
|
||||||
|
return ['type' => 'none', 'label' => ''];
|
||||||
|
}
|
||||||
|
$href = $forum_compose !== '' ? $forum_compose : $forum_home;
|
||||||
|
if ($href === '') {
|
||||||
|
return ['type' => 'none', 'label' => ''];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'type' => 'link',
|
||||||
|
'label' => __('去完成', 'aksrt'),
|
||||||
|
'href' => $href,
|
||||||
|
];
|
||||||
|
case 'bbs_essence':
|
||||||
|
case 'bbs_adopt':
|
||||||
|
case 'bbs_posts_hot':
|
||||||
|
case 'bbs_comment_hot':
|
||||||
|
case 'bbs_score_extra':
|
||||||
|
if (!$forum_on || $forum_home === '') {
|
||||||
|
return ['type' => 'none', 'label' => ''];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'type' => 'link',
|
||||||
|
'label' => __('去看看', 'aksrt'),
|
||||||
|
'href' => $forum_home,
|
||||||
|
];
|
||||||
|
default:
|
||||||
|
return ['type' => 'none', 'label' => ''];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$user_id = (int) ($user_id ?? get_current_user_id());
|
$user_id = (int) ($user_id ?? get_current_user_id());
|
||||||
$today = AKSRT_Points_Free::today_total($user_id);
|
$today = AKSRT_Points_Free::today_total($user_id);
|
||||||
$day_max = (int) AKSRT_Points_Free::settings()['day_max'];
|
$day_max = (int) AKSRT_Points_Free::settings()['day_max'];
|
||||||
@@ -76,15 +164,30 @@ $pane = isset($points_tasks_pane) ? sanitize_key((string) $points_tasks_pane)
|
|||||||
|
|
||||||
<?php if ($tasks) : ?>
|
<?php if ($tasks) : ?>
|
||||||
<?php foreach ($tasks as $task) : ?>
|
<?php foreach ($tasks as $task) : ?>
|
||||||
<div class="border-bottom padding-h10">
|
<?php
|
||||||
|
$task_key = sanitize_key((string) ($task['key'] ?? ''));
|
||||||
|
$action = $aksrt_points_task_action($task_key);
|
||||||
|
?>
|
||||||
|
<div class="border-bottom padding-h10 uc-points-tasks__row" data-task-key="<?php echo esc_attr($task_key); ?>">
|
||||||
<div class="flex jsb ac">
|
<div class="flex jsb ac">
|
||||||
<div class="flex1 mr20">
|
<div class="flex1 mr20">
|
||||||
<div class="font-bold mb6"><?php echo esc_html((string) $task['title']); ?></div>
|
<div class="font-bold mb6"><?php echo esc_html((string) $task['title']); ?></div>
|
||||||
<div class="muted-2-color em09"><?php echo esc_html((string) $task['desc']); ?></div>
|
<div class="muted-2-color em09"><?php echo esc_html((string) $task['desc']); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<span class="focus-color em14 shrink0">
|
<div class="uc-points-tasks__meta shrink0 text-right">
|
||||||
<i class="fas fa-coins mr6 em09" aria-hidden="true"></i>+ <?php echo esc_html((string) (int) $task['points']); ?>
|
<div class="focus-color em14">
|
||||||
</span>
|
<i class="fas fa-coins mr6 em09" aria-hidden="true"></i>+ <?php echo esc_html((string) (int) $task['points']); ?>
|
||||||
|
</div>
|
||||||
|
<?php if (($action['type'] ?? 'none') === 'signin') : ?>
|
||||||
|
<button type="button" class="uc-points-tasks__action muted-color em09 mt6" data-aksrt-signin-goto>
|
||||||
|
<?php echo esc_html((string) $action['label']); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<?php elseif (($action['type'] ?? 'none') === 'link' && !empty($action['href'])) : ?>
|
||||||
|
<a class="uc-points-tasks__action muted-color em09 mt6" href="<?php echo esc_url((string) $action['href']); ?>">
|
||||||
|
<?php echo esc_html((string) $action['label']); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
@@ -21,10 +21,17 @@ $wallet_fmt = class_exists('AKSRT_Balance')
|
|||||||
$recharge = class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_payment_recharge_settings')
|
$recharge = class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_payment_recharge_settings')
|
||||||
? AKSRT_Settings::get_payment_recharge_settings()
|
? AKSRT_Settings::get_payment_recharge_settings()
|
||||||
: [];
|
: [];
|
||||||
|
$uid = (int) ($user_id ?? get_current_user_id());
|
||||||
$transfer_on = !empty($recharge['transfer']['enabled']);
|
$transfer_on = !empty($recharge['transfer']['enabled']);
|
||||||
|
if ($transfer_on && class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('balance_transfer', $uid)) {
|
||||||
|
$transfer_on = false;
|
||||||
|
}
|
||||||
$exchange_on = !empty($recharge['exchange']['enabled']);
|
$exchange_on = !empty($recharge['exchange']['enabled']);
|
||||||
$all_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_all() : [];
|
$all_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_all() : [];
|
||||||
$withdraw_on = !empty($all_settings['pay_balance_withdraw_s']);
|
$withdraw_on = !empty($all_settings['pay_balance_withdraw_s']);
|
||||||
|
if ($withdraw_on && class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('balance_withdraw', $uid)) {
|
||||||
|
$withdraw_on = false;
|
||||||
|
}
|
||||||
$withdraw_min = max(1, (float) ($all_settings['pay_balance_withdraw_lowest_money'] ?? $all_settings['pay_rebate_withdraw_lowest_money'] ?? 50));
|
$withdraw_min = max(1, (float) ($all_settings['pay_balance_withdraw_lowest_money'] ?? $all_settings['pay_rebate_withdraw_lowest_money'] ?? 50));
|
||||||
$withdraw_pending_hold = 0.0;
|
$withdraw_pending_hold = 0.0;
|
||||||
$withdraw_history = [];
|
$withdraw_history = [];
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ $identity_chips = function_exists('aksrt_render_user_identity_chips')
|
|||||||
<?php if (!$is_self) : ?>
|
<?php if (!$is_self) : ?>
|
||||||
<?php if (is_user_logged_in()) : ?>
|
<?php if (is_user_logged_in()) : ?>
|
||||||
<button type="button" class="px12-sm ml10 follow but c-red" data-aksrt-follow="<?php echo (int) $author_id; ?>">
|
<button type="button" class="px12-sm ml10 follow but c-red" data-aksrt-follow="<?php echo (int) $author_id; ?>">
|
||||||
<i class="fa fa-heart em09" aria-hidden="true"></i> <?php esc_html_e('关注', 'aksrt'); ?>
|
<i class="fa fa-heart em09" aria-hidden="true"></i> <span><?php esc_html_e('关注', 'aksrt'); ?></span>
|
||||||
</button>
|
</button>
|
||||||
<?php if ($aksrt_pm_on && $aksrt_msg_url !== '') : ?>
|
<?php if ($aksrt_pm_on && $aksrt_msg_url !== '') : ?>
|
||||||
<a href="<?php echo esc_url(add_query_arg('msg_type', 'conversation', $aksrt_msg_url)); ?>" class="ml6 but c-blue px12-sm">
|
<a href="<?php echo esc_url(add_query_arg('msg_type', 'conversation', $aksrt_msg_url)); ?>" class="ml6 but c-blue px12-sm">
|
||||||
|
|||||||
Reference in New Issue
Block a user