refactor: rename the theme brand and every identifier from AKSRT to Jio

Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.

Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
  cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
  window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)

Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
  so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
  (dropped 3 stale entries, added the 17 missing ones)

Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
  get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
  when it is empty

Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.

Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-01 20:05:04 +08:00
1 parent 5b16bc6e15
commit 35bb96e82f
997 files changed
+28216 -28188

No files matched your search

+65 -65
View File
@@ -1,12 +1,12 @@
/**
* Frontend reporting for articles, comments and users.
* @package AKSRT
* @package Jio
*/
(function () {
'use strict';
var config = window.aksrtData || {};
var API_ROOT = String(config.apiUrl || '/index.php?rest_route=/aksrt/v1').replace(/\/$/, '');
var config = window.jioData || {};
var API_ROOT = String(config.apiUrl || '/index.php?rest_route=/jio/v1').replace(/\/$/, '');
var NONCE = config.restNonce || '';
var MAX_IMAGES = 3;
var sequence = 0;
@@ -30,44 +30,44 @@
function buildReportModalHtml(data, categories) {
var target = TARGETS[data.target_type];
var report = config.report || {};
var id = 'aksrt-report-' + (++sequence);
var id = 'jio-report-' + (++sequence);
var name = data.target_name || target.label + ' #' + data.target_id;
var html = '<form id="' + id + '" class="aksrt-report-form" novalidate>';
html += '<div class="aksrt-report-body mini-scrollbar">';
html += '<div class="aksrt-report-target"><span class="aksrt-report-target__label">关联对象:</span>';
html += '<strong class="aksrt-report-target__name" title="' + escapeHtml(name) + '">' + escapeHtml(name) + '</strong></div>';
html += '<fieldset class="aksrt-report-reasons" aria-describedby="' + id + '-reason-error">';
html += '<legend>举报原因<span class="aksrt-report-hint">必选一项</span></legend>';
html += '<div class="aksrt-report-reasons__options">';
var html = '<form id="' + id + '" class="jio-report-form" novalidate>';
html += '<div class="jio-report-body mini-scrollbar">';
html += '<div class="jio-report-target"><span class="jio-report-target__label">关联对象:</span>';
html += '<strong class="jio-report-target__name" title="' + escapeHtml(name) + '">' + escapeHtml(name) + '</strong></div>';
html += '<fieldset class="jio-report-reasons" aria-describedby="' + id + '-reason-error">';
html += '<legend>举报原因<span class="jio-report-hint">必选一项</span></legend>';
html += '<div class="jio-report-reasons__options">';
categories.forEach(function (cat, index) {
html += '<label class="aksrt-report-reason"><input type="radio" name="report_reason" required value="' + index + '">';
html += '<label class="jio-report-reason"><input type="radio" name="report_reason" required value="' + index + '">';
html += '<span>' + escapeHtml(cat.name) + '</span></label>';
});
html += '<label class="aksrt-report-reason"><input type="radio" name="report_reason" required value="other"><span>其他原因</span></label>';
html += '</div><div class="aksrt-report-other" hidden>';
html += '<label class="aksrt-report-label" for="' + id + '-other">请说明举报原因</label>';
html += '<label class="jio-report-reason"><input type="radio" name="report_reason" required value="other"><span>其他原因</span></label>';
html += '</div><div class="jio-report-other" hidden>';
html += '<label class="jio-report-label" for="' + id + '-other">请说明举报原因</label>';
html += '<textarea id="' + id + '-other" name="reason_other" rows="2" maxlength="200" placeholder="请简要说明你认为存在的问题" aria-describedby="' + id + '-reason-error"></textarea>';
html += '</div><p class="aksrt-report-error" id="' + id + '-reason-error" data-aksrt-report-reason-error role="alert" hidden></p></fieldset>';
html += '<div class="aksrt-report-field"><div class="aksrt-report-label-row">';
html += '<label class="aksrt-report-label" for="' + id + '-desc">补充说明<span class="aksrt-report-hint">选填</span></label>';
html += '<span class="aksrt-report-count" data-aksrt-report-count aria-hidden="true">0 / 2000</span></div>';
html += '</div><p class="jio-report-error" id="' + id + '-reason-error" data-jio-report-reason-error role="alert" hidden></p></fieldset>';
html += '<div class="jio-report-field"><div class="jio-report-label-row">';
html += '<label class="jio-report-label" for="' + id + '-desc">补充说明<span class="jio-report-hint">选填</span></label>';
html += '<span class="jio-report-count" data-jio-report-count aria-hidden="true">0 / 2000</span></div>';
html += '<textarea id="' + id + '-desc" name="report_desc" rows="3" maxlength="2000" placeholder="例如:问题出现在什么位置,具体有哪些违规内容"></textarea></div>';
if (report.imgEnabled) {
html += '<section class="aksrt-report-field" aria-label="图片举证">';
html += '<div class="aksrt-report-label-row"><span class="aksrt-report-label">图片举证<span class="aksrt-report-hint">选填</span></span>';
html += '<span class="aksrt-report-count" data-aksrt-report-image-count aria-live="polite">0 / ' + MAX_IMAGES + '</span></div>';
html += '<div class="aksrt-report-images"><div class="aksrt-report-images__list" data-aksrt-report-images></div>';
html += '<button type="button" class="aksrt-report-add" data-aksrt-report-add><i class="fas fa-plus" aria-hidden="true"></i><span>添加图片</span></button></div>';
html += '<p class="aksrt-report-hint">支持 JPG、PNG、GIF,最多 ' + MAX_IMAGES + ' 张</p>';
html += '<input type="file" accept="image/gif,image/jpeg,image/png" multiple data-aksrt-report-file hidden></section>';
html += '<section class="jio-report-field" aria-label="图片举证">';
html += '<div class="jio-report-label-row"><span class="jio-report-label">图片举证<span class="jio-report-hint">选填</span></span>';
html += '<span class="jio-report-count" data-jio-report-image-count aria-live="polite">0 / ' + MAX_IMAGES + '</span></div>';
html += '<div class="jio-report-images"><div class="jio-report-images__list" data-jio-report-images></div>';
html += '<button type="button" class="jio-report-add" data-jio-report-add><i class="fas fa-plus" aria-hidden="true"></i><span>添加图片</span></button></div>';
html += '<p class="jio-report-hint">支持 JPG、PNG、GIF,最多 ' + MAX_IMAGES + ' 张</p>';
html += '<input type="file" accept="image/gif,image/jpeg,image/png" multiple data-jio-report-file hidden></section>';
}
// The settings reader sanitizes this administrator-authored notice with wp_kses_post.
if (report.desc) html += '<div class="aksrt-report-notice">' + report.desc + '</div>';
html += '</div><footer class="aksrt-report-footer">';
html += '<p class="aksrt-report-error" data-aksrt-report-error role="alert" hidden></p>';
html += '<p class="aksrt-report-status" data-aksrt-report-status role="status"></p>';
html += '<div class="aksrt-report-actions"><button type="button" class="aksrt-report-cancel" data-aksrt-modal-close>取消</button>';
html += '<button type="submit" class="aksrt-report-submit" data-aksrt-report-submit>提交举报</button></div>';
if (report.desc) html += '<div class="jio-report-notice">' + report.desc + '</div>';
html += '</div><footer class="jio-report-footer">';
html += '<p class="jio-report-error" data-jio-report-error role="alert" hidden></p>';
html += '<p class="jio-report-status" data-jio-report-status role="status"></p>';
html += '<div class="jio-report-actions"><button type="button" class="jio-report-cancel" data-jio-modal-close>取消</button>';
html += '<button type="submit" class="jio-report-submit" data-jio-report-submit>提交举报</button></div>';
html += '</footer></form>';
return html;
}
@@ -78,22 +78,22 @@
}
function bindReportModal(shell, data, categories) {
var form = shell.querySelector('.aksrt-report-form');
var submit = form.querySelector('[data-aksrt-report-submit]');
var reasonError = form.querySelector('[data-aksrt-report-reason-error]');
var error = form.querySelector('[data-aksrt-report-error]');
var status = form.querySelector('[data-aksrt-report-status]');
var otherBox = form.querySelector('.aksrt-report-other');
var form = shell.querySelector('.jio-report-form');
var submit = form.querySelector('[data-jio-report-submit]');
var reasonError = form.querySelector('[data-jio-report-reason-error]');
var error = form.querySelector('[data-jio-report-error]');
var status = form.querySelector('[data-jio-report-status]');
var otherBox = form.querySelector('.jio-report-other');
var otherInput = form.querySelector('[name="reason_other"]');
var descInput = form.querySelector('[name="report_desc"]');
var fileInput = form.querySelector('[data-aksrt-report-file]');
var fileInput = form.querySelector('[data-jio-report-file]');
var images = [];
var submitAttempts = 0;
var submitting = false;
var closed = false;
function isActive() {
return !closed && window.AksrtModalRuntime.getActive() === shell;
return !closed && window.JioModalRuntime.getActive() === shell;
}
function syncState() {
@@ -102,10 +102,10 @@
submit.textContent = uploading ? '图片上传中…' : '提交举报';
form.setAttribute('aria-busy', String(submitting || uploading));
status.textContent = uploading ? '图片正在上传,完成后即可提交' : '';
var add = form.querySelector('[data-aksrt-report-add]');
var add = form.querySelector('[data-jio-report-add]');
if (add) {
add.disabled = submitting || images.length >= MAX_IMAGES;
form.querySelector('[data-aksrt-report-image-count]').textContent = images.length + ' / ' + MAX_IMAGES;
form.querySelector('[data-jio-report-image-count]').textContent = images.length + ' / ' + MAX_IMAGES;
}
}
@@ -118,12 +118,12 @@
function renderImage(image) {
var html = image.url ? '<img src="' + escapeHtml(image.url) + '" alt="举证图片">' : '';
html += '<div class="aksrt-report-image__state">';
html += '<div class="jio-report-image__state">';
if (image.status === 'uploading') html += '<span role="status">上传中…</span>';
if (image.status === 'error') {
html += '<span>上传失败</span><button type="button" data-aksrt-report-retry>重试</button>';
html += '<span>上传失败</span><button type="button" data-jio-report-retry>重试</button>';
}
html += '</div><button type="button" class="aksrt-report-image__remove" data-aksrt-report-remove aria-label="删除举证图片"' + (submitting ? ' disabled' : '') + '>&times;</button>';
html += '</div><button type="button" class="jio-report-image__remove" data-jio-report-remove aria-label="删除举证图片"' + (submitting ? ' disabled' : '') + '>&times;</button>';
image.node.innerHTML = html;
image.node.setAttribute('data-upload-state', image.status);
}
@@ -181,16 +181,16 @@
return;
}
var image = { file: file, status: 'uploading', url: '', attachmentId: 0, node: document.createElement('div') };
image.node.className = 'aksrt-report-image';
image.node.className = 'jio-report-image';
images.push(image);
form.querySelector('[data-aksrt-report-images]').appendChild(image.node);
form.querySelector('[data-jio-report-images]').appendChild(image.node);
uploadImage(image);
});
fileInput.value = '';
});
form.addEventListener('input', function (event) {
if (event.target === descInput) form.querySelector('[data-aksrt-report-count]').textContent = descInput.value.length + ' / 2000';
if (event.target === descInput) form.querySelector('[data-jio-report-count]').textContent = descInput.value.length + ' / 2000';
if (event.target === otherInput) {
otherInput.removeAttribute('aria-invalid');
showError(reasonError, '');
@@ -198,19 +198,19 @@
});
form.addEventListener('click', function (event) {
var add = event.target.closest('[data-aksrt-report-add]');
var add = event.target.closest('[data-jio-report-add]');
if (add && !add.disabled && !submitting) fileInput.click();
var imageNode = event.target.closest('.aksrt-report-image');
var imageNode = event.target.closest('.jio-report-image');
if (!imageNode || submitting) return;
var image = images.find(function (entry) { return entry.node === imageNode; });
if (!image) return;
if (event.target.closest('[data-aksrt-report-remove]')) {
if (event.target.closest('[data-jio-report-remove]')) {
images.splice(images.indexOf(image), 1);
image.node.remove();
deletePending(image);
showError(error, '');
syncState();
} else if (event.target.closest('[data-aksrt-report-retry]') && image.status === 'error') {
} else if (event.target.closest('[data-jio-report-retry]') && image.status === 'error') {
showError(error, '');
uploadImage(image);
}
@@ -249,7 +249,7 @@
syncState();
var toastId = form.id + '-submit-' + (++submitAttempts);
notyf('正在提交举报…', 'load', '', toastId);
form.querySelectorAll('input, textarea, [data-aksrt-report-remove], [data-aksrt-report-retry]').forEach(function (element) { element.disabled = true; });
form.querySelectorAll('input, textarea, [data-jio-report-remove], [data-jio-report-retry]').forEach(function (element) { element.disabled = true; });
window.fetch(API_ROOT + '/report/submit', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-WP-Nonce': NONCE },
@@ -261,8 +261,8 @@
form.setAttribute('aria-busy', 'false');
submit.textContent = '举报已提交';
status.textContent = result.message || '举报已提交,我们会尽快处理';
form.querySelector('[data-aksrt-modal-close]').textContent = '关闭';
if (isActive()) window.AksrtModalRuntime.close('submit');
form.querySelector('[data-jio-modal-close]').textContent = '关闭';
if (isActive()) window.JioModalRuntime.close('submit');
notyf(result.message || '举报已提交,我们会尽快处理', 'success', 5, toastId);
}).catch(function (failure) {
notyf(failure.message || '网络错误,请重试', 'danger', 5, toastId);
@@ -271,7 +271,7 @@
images.forEach(deletePending);
return;
}
form.querySelectorAll('input, textarea, [data-aksrt-report-remove], [data-aksrt-report-retry]').forEach(function (element) { element.disabled = false; });
form.querySelectorAll('input, textarea, [data-jio-report-remove], [data-jio-report-retry]').forEach(function (element) { element.disabled = false; });
otherInput.disabled = otherBox.hidden;
syncState();
});
@@ -280,17 +280,17 @@
function onClose(event) {
if (!event.detail || event.detail.shell !== shell) return;
closed = true;
document.removeEventListener('aksrt:modal:close', onClose);
document.removeEventListener('jio:modal:close', onClose);
// While submitting, the response decides whether pending evidence is still needed.
if (!submitting) images.forEach(deletePending);
}
document.addEventListener('aksrt:modal:close', onClose);
document.addEventListener('jio:modal:close', onClose);
otherInput.disabled = true;
syncState();
}
function openReportModal(data, opener) {
var runtime = window.AksrtModalRuntime;
var runtime = window.JioModalRuntime;
if (!runtime || typeof runtime.open !== 'function') {
notyf('举报组件加载失败,请刷新页面后重试', 'danger');
return;
@@ -298,23 +298,23 @@
var categories = getReportCategories();
var shell = runtime.open({
html: buildReportModalHtml(data, categories), title: TARGETS[data.target_type].title,
className: 'aksrt-report-modal', kind: 'report', mobileBottom: true, focusReturn: opener,
className: 'jio-report-modal', kind: 'report', mobileBottom: true, focusReturn: opener,
});
bindReportModal(shell, data, categories);
}
function initReportButtons() {
if (document.documentElement.dataset.aksrtReportInitialized === '1') return;
document.documentElement.dataset.aksrtReportInitialized = '1';
if (document.documentElement.dataset.jioReportInitialized === '1') return;
document.documentElement.dataset.jioReportInitialized = '1';
document.addEventListener('click', function (event) {
var button = event.target.closest('[data-aksrt-report]');
var button = event.target.closest('[data-jio-report]');
if (!button) return;
event.preventDefault();
var data;
try { data = JSON.parse(button.getAttribute('data-aksrt-report')); } catch (error) { return; }
try { data = JSON.parse(button.getAttribute('data-jio-report')); } catch (error) { return; }
if (data && TARGETS[data.target_type] && Number(data.target_id) > 0) openReportModal(data, button);
});
}
jQuery(document).off('auto_fun.aksrt-report').on('auto_fun.aksrt-report', initReportButtons);
jQuery(document).off('auto_fun.jio-report').on('auto_fun.jio-report', initReportButtons);
})();