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

+48 -48
View File
@@ -8,9 +8,9 @@ const vm = require('node:vm');
const scriptPath = path.resolve(__dirname, '../../assets/js/admin-tickets.js');
const strings = { saving: 'Saving', saveFailed: 'Save failed', uncertain: 'Unknown result', required: 'Required', tooLong: 'Too long', discard: 'Discard?' };
const REST = 'https://site.test/wp-json/aksrt/v1/admin/tickets';
const REST = 'https://site.test/wp-json/jio/v1/admin/tickets';
function makeRuntime({ href = 'https://site.test/wp-admin/users.php?page=aksrt_tickets&id=41', page = 'detail', storage = {} } = {}) {
function makeRuntime({ href = 'https://site.test/wp-admin/users.php?page=jio_tickets&id=41', page = 'detail', storage = {} } = {}) {
const ids = new Map();
const document = { activeElement: null };
@@ -134,69 +134,69 @@ function makeRuntime({ href = 'https://site.test/wp-admin/users.php?page=aksrt_t
};
function makeDialog(id) {
const dialog = el('dialog', { id, class: 'aksrt-ticket-dialog' }, root);
const dialog = el('dialog', { id, class: 'jio-ticket-dialog' }, root);
dialog.open = false;
dialog.showModal = () => { dialog.open = true; };
dialog.close = () => { if (!dialog.open) return; dialog.open = false; dialog.fire('close'); };
return dialog;
}
const root = new Element('div', { class: 'aksrt-tickets-admin' });
const feedback = el('div', { 'data-aksrt-ticket-feedback': '', hidden: '' }, root);
const root = new Element('div', { class: 'jio-tickets-admin' });
const feedback = el('div', { 'data-jio-ticket-feedback': '', hidden: '' }, root);
el('p', {}, feedback);
el('button', { type: 'button', 'data-aksrt-ticket-reload': '', hidden: '' }, feedback);
el('button', { type: 'button', 'data-jio-ticket-reload': '', hidden: '' }, feedback);
const nodes = { root, feedback };
if (page === 'detail') {
const detail = el('div', { 'data-aksrt-ticket-detail': '41' }, root);
nodes.latest = el('button', { type: 'button', 'data-aksrt-ticket-latest': '', hidden: '' }, detail);
nodes.conversation = el('div', { class: 'aksrt-ticket-conversation__scroll' }, detail);
const reply = nodes.reply = el('form', { action: `${REST}/41/reply`, 'data-aksrt-ticket-form': 'reply' }, detail);
nodes.replyText = el('textarea', { id: 'aksrt-ticket-reply-41', name: 'content', required: '', maxlength: '24', 'data-aksrt-ticket-editor': '' }, reply);
nodes.replyCount = el('span', { 'data-aksrt-ticket-counter': 'aksrt-ticket-reply-41' }, reply);
nodes.prereply = select(reply, { 'data-aksrt-ticket-prereply': 'aksrt-ticket-reply-41' }, [[''], ['short'], ['01234567890123456789012345']]);
const detail = el('div', { 'data-jio-ticket-detail': '41' }, root);
nodes.latest = el('button', { type: 'button', 'data-jio-ticket-latest': '', hidden: '' }, detail);
nodes.conversation = el('div', { class: 'jio-ticket-conversation__scroll' }, detail);
const reply = nodes.reply = el('form', { action: `${REST}/41/reply`, 'data-jio-ticket-form': 'reply' }, detail);
nodes.replyText = el('textarea', { id: 'jio-ticket-reply-41', name: 'content', required: '', maxlength: '24', 'data-jio-ticket-editor': '' }, reply);
nodes.replyCount = el('span', { 'data-jio-ticket-counter': 'jio-ticket-reply-41' }, reply);
nodes.prereply = select(reply, { 'data-jio-ticket-prereply': 'jio-ticket-reply-41' }, [[''], ['short'], ['01234567890123456789012345']]);
el('button', { type: 'submit' }, reply);
const section = el('section', {}, detail);
nodes.assign = el('button', { type: 'button', 'data-aksrt-ticket-assign': '' }, section);
const status = nodes.status = el('form', { action: `${REST}/41/status`, 'data-aksrt-ticket-form': 'status' }, section);
nodes.statusSelect = select(status, { name: 'status', 'data-aksrt-ticket-status': '' }, [['pending', { 'data-closed': '0' }], ['handling', { 'data-closed': '0' }], ['closed', { 'data-closed': '1' }]], 'pending');
nodes.assign = el('button', { type: 'button', 'data-jio-ticket-assign': '' }, section);
const status = nodes.status = el('form', { action: `${REST}/41/status`, 'data-jio-ticket-form': 'status' }, section);
nodes.statusSelect = select(status, { name: 'status', 'data-jio-ticket-status': '' }, [['pending', { 'data-closed': '0' }], ['handling', { 'data-closed': '0' }], ['closed', { 'data-closed': '1' }]], 'pending');
select(status, { name: 'ticket_type_id', required: '' }, [['3'], ['6']], '3');
nodes.admin = select(status, { name: 'admin_id' }, [['0'], ['7'], ['44']], '7');
nodes.warning = el('div', { 'data-aksrt-ticket-close-warning': '', hidden: '' }, status);
nodes.confirm = el('input', { type: 'checkbox', 'data-aksrt-ticket-close-confirm': '' }, nodes.warning);
nodes.warning = el('div', { 'data-jio-ticket-close-warning': '', hidden: '' }, status);
nodes.confirm = el('input', { type: 'checkbox', 'data-jio-ticket-close-confirm': '' }, nodes.warning);
nodes.statusSubmit = el('button', { type: 'submit' }, status);
nodes.noteOpener = el('button', { type: 'button', 'data-aksrt-dialog-open': 'aksrt-ticket-note-dialog' }, detail);
const noteDialog = nodes.noteDialog = makeDialog('aksrt-ticket-note-dialog');
const note = nodes.note = el('form', { action: `${REST}/41/notes`, 'data-aksrt-ticket-form': 'note' }, noteDialog);
nodes.noteClose = el('button', { type: 'button', 'data-aksrt-dialog-close': '' }, note);
nodes.noteFeedback = el('div', { 'data-aksrt-ticket-feedback': '', hidden: '' }, note);
nodes.noteOpener = el('button', { type: 'button', 'data-jio-dialog-open': 'jio-ticket-note-dialog' }, detail);
const noteDialog = nodes.noteDialog = makeDialog('jio-ticket-note-dialog');
const note = nodes.note = el('form', { action: `${REST}/41/notes`, 'data-jio-ticket-form': 'note' }, noteDialog);
nodes.noteClose = el('button', { type: 'button', 'data-jio-dialog-close': '' }, note);
nodes.noteFeedback = el('div', { 'data-jio-ticket-feedback': '', hidden: '' }, note);
el('p', {}, nodes.noteFeedback);
el('button', { type: 'button', 'data-aksrt-ticket-reload': '', hidden: '' }, nodes.noteFeedback);
nodes.noteText = el('textarea', { id: 'aksrt-ticket-note-41', name: 'content', required: '', autofocus: '', maxlength: '24', 'data-aksrt-ticket-editor': '' }, note);
el('button', { type: 'button', 'data-jio-ticket-reload': '', hidden: '' }, nodes.noteFeedback);
nodes.noteText = el('textarea', { id: 'jio-ticket-note-41', name: 'content', required: '', autofocus: '', maxlength: '24', 'data-jio-ticket-editor': '' }, note);
el('button', { type: 'submit' }, note);
note.reset = () => { nodes.noteText.value = ''; };
nodes.replyText.attrs['data-aksrt-ticket-send-shortcut'] = '';
nodes.replyText.attrs['data-jio-ticket-send-shortcut'] = '';
reply.requestSubmit = () => reply.fire('submit') && root.fire('submit', { target: reply });
} else {
nodes.opener = el('button', { type: 'button', 'data-aksrt-dialog-open': 'aksrt-ticket-create-dialog' }, root);
const dialog = nodes.dialog = makeDialog('aksrt-ticket-create-dialog');
const create = nodes.create = el('form', { action: REST, 'data-aksrt-ticket-form': 'create' }, dialog);
nodes.closeButton = el('button', { type: 'button', 'data-aksrt-dialog-close': '' }, create);
nodes.opener = el('button', { type: 'button', 'data-jio-dialog-open': 'jio-ticket-create-dialog' }, root);
const dialog = nodes.dialog = makeDialog('jio-ticket-create-dialog');
const create = nodes.create = el('form', { action: REST, 'data-jio-ticket-form': 'create' }, dialog);
nodes.closeButton = el('button', { type: 'button', 'data-jio-dialog-close': '' }, create);
el('input', { type: 'number', name: 'user_id', required: '' }, create);
select(create, { name: 'ticket_type_id', required: '' }, [[''], ['3']], '');
el('input', { type: 'text', name: 'title', required: '' }, create);
el('textarea', { id: 'aksrt-ticket-create-content', name: 'content', required: '', maxlength: '500', 'data-aksrt-ticket-editor': '' }, create);
el('textarea', { id: 'jio-ticket-create-content', name: 'content', required: '', maxlength: '500', 'data-jio-ticket-editor': '' }, create);
el('button', { type: 'submit' }, create);
create.reset = () => create.querySelectorAll('input, select, textarea').forEach((control) => { control.value = ''; });
}
document.querySelector = (selector) => (selector === '.aksrt-tickets-admin' ? root : null);
document.querySelector = (selector) => (selector === '.jio-tickets-admin' ? root : null);
document.getElementById = (id) => ids.get(id) || null;
const store = new Map(Object.entries(storage));
const window = new Element('window');
Object.assign(window, {
AKSRTAdminTickets: { restNonce: 'rest-nonce', currentUser: 44, strings },
JioAdminTickets: { restNonce: 'rest-nonce', currentUser: 44, strings },
location: { href, assigned: null, reloads: 0, assign(url) { this.assigned = url; }, reload() { this.reloads += 1; } },
history: { state: null, replaceState(_state, _title, url) { window.location.href = url; } },
sessionStorage: { getItem: (key) => store.get(key) ?? null, setItem: (key, value) => store.set(key, String(value)), removeItem: (key) => store.delete(key) },
@@ -218,7 +218,7 @@ const submit = (rt, form) => rt.root.fire('submit', { target: form });
const unload = (rt) => rt.window.fire('beforeunload', { returnValue: undefined });
test('a successful reply posts JSON to REST, then reloads the workspace with a result code and stashes other drafts', async () => {
const rt = makeRuntime({ href: 'https://site.test/wp-admin/users.php?page=aksrt_tickets&id=41&status=pending&paged=3' });
const rt = makeRuntime({ href: 'https://site.test/wp-admin/users.php?page=jio_tickets&id=41&status=pending&paged=3' });
type(rt, rt.noteText, 'pending note');
type(rt, rt.replyText, 'hello');
const event = submit(rt, rt.reply);
@@ -237,27 +237,27 @@ test('a successful reply posts JSON to REST, then reloads the workspace with a r
await tick();
const next = new URL(rt.window.location.assigned);
assert.equal(next.searchParams.get('id'), '41');
assert.equal(next.searchParams.get('aksrt_ticket_msg'), 'reply');
assert.equal(next.searchParams.get('jio_ticket_msg'), 'reply');
assert.equal(next.searchParams.get('status'), 'pending');
assert.equal(next.searchParams.get('paged'), '3');
assert.deepEqual(JSON.parse(rt.store.get('aksrt-ticket-drafts-41')), { note: { content: 'pending note' } });
assert.deepEqual(JSON.parse(rt.store.get('jio-ticket-drafts-41')), { note: { content: 'pending note' } });
assert.equal(unload(rt).defaultPrevented, false, 'navigation after save is not blocked');
});
test('after the reload, stashed drafts are restored once and the result code is stripped from the URL', () => {
const rt = makeRuntime({
href: 'https://site.test/wp-admin/users.php?page=aksrt_tickets&id=41&aksrt_ticket_msg=reply',
storage: { 'aksrt-ticket-drafts-41': JSON.stringify({ note: { content: 'keep me' } }) },
href: 'https://site.test/wp-admin/users.php?page=jio_tickets&id=41&jio_ticket_msg=reply',
storage: { 'jio-ticket-drafts-41': JSON.stringify({ note: { content: 'keep me' } }) },
});
assert.equal(rt.noteText.value, 'keep me');
assert.equal(rt.store.has('aksrt-ticket-drafts-41'), false);
assert.equal(new URL(rt.window.location.href).searchParams.has('aksrt_ticket_msg'), false);
assert.equal(rt.store.has('jio-ticket-drafts-41'), false);
assert.equal(new URL(rt.window.location.href).searchParams.has('jio_ticket_msg'), false);
assert.equal(new URL(rt.window.location.href).searchParams.get('id'), '41');
assert.equal(unload(rt).defaultPrevented, true, 'a restored draft still counts as unsaved');
});
test('create dialog opens from the header button, guards dirty close, resets and returns focus', () => {
const rt = makeRuntime({ page: 'create', href: 'https://site.test/wp-admin/users.php?page=aksrt_tickets' });
const rt = makeRuntime({ page: 'create', href: 'https://site.test/wp-admin/users.php?page=jio_tickets' });
rt.opener.isConnected = true;
rt.root.fire('click', { target: rt.opener });
assert.equal(rt.dialog.open, true);
@@ -286,7 +286,7 @@ test('create dialog opens from the header button, guards dirty close, resets and
});
test('create posts to the collection route and opens the new ticket workspace with the list context kept', async () => {
const rt = makeRuntime({ page: 'create', href: 'https://site.test/wp-admin/users.php?page=aksrt_tickets&status=pending&paged=2' });
const rt = makeRuntime({ page: 'create', href: 'https://site.test/wp-admin/users.php?page=jio_tickets&status=pending&paged=2' });
rt.root.fire('click', { target: rt.opener });
const form = rt.create;
form.querySelector('[name="user_id"]').value = '12';
@@ -301,7 +301,7 @@ test('create posts to the collection route and opens the new ticket workspace wi
const next = new URL(rt.window.location.assigned);
assert.equal(next.searchParams.has('view'), false);
assert.equal(next.searchParams.get('id'), '77');
assert.equal(next.searchParams.get('aksrt_ticket_msg'), 'created');
assert.equal(next.searchParams.get('jio_ticket_msg'), 'created');
assert.equal(next.searchParams.get('status'), 'pending');
assert.equal(next.searchParams.get('paged'), '2');
});
@@ -318,12 +318,12 @@ test('a confirmed validation error keeps the form editable and shows the server
const rt = makeRuntime();
type(rt, rt.replyText, 'hello');
submit(rt, rt.reply);
rt.fetchCalls[0].resolve(reply({ code: 'aksrt_ticket_reply_content', message: 'Bad content', data: { status: 400 } }, 400));
rt.fetchCalls[0].resolve(reply({ code: 'jio_ticket_reply_content', message: 'Bad content', data: { status: 400 } }, 400));
await tick();
assert.equal(rt.window.location.assigned, null);
assert.equal(rt.feedback.hidden, false);
assert.equal(rt.feedback.querySelector('p').textContent, 'Bad content');
assert.equal(rt.feedback.querySelector('[data-aksrt-ticket-reload]').hidden, true);
assert.equal(rt.feedback.querySelector('[data-jio-ticket-reload]').hidden, true);
assert.equal(rt.replyText.disabled, false);
assert.equal(rt.replyText.value, 'hello');
submit(rt, rt.reply);
@@ -332,8 +332,8 @@ test('a confirmed validation error keeps the form editable and shows the server
for (const [label, settle] of [
['an unknown network result', (call) => call.reject(new TypeError('network'))],
['a 409 state conflict', (call) => call.resolve(reply({ code: 'aksrt_ticket_closed', message: 'Closed', data: { status: 409 } }, 409))],
['a 404 missing ticket', (call) => call.resolve(reply({ code: 'aksrt_ticket_missing', message: 'Missing', data: { status: 404 } }, 404))],
['a 409 state conflict', (call) => call.resolve(reply({ code: 'jio_ticket_closed', message: 'Closed', data: { status: 409 } }, 409))],
['a 404 missing ticket', (call) => call.resolve(reply({ code: 'jio_ticket_missing', message: 'Missing', data: { status: 404 } }, 404))],
]) {
test(`${label} locks every write form and only offers a page reload`, async () => {
const rt = makeRuntime();
@@ -341,7 +341,7 @@ for (const [label, settle] of [
submit(rt, rt.reply);
settle(rt.fetchCalls[0]);
await tick();
const reload = rt.feedback.querySelector('[data-aksrt-ticket-reload]');
const reload = rt.feedback.querySelector('[data-jio-ticket-reload]');
assert.equal(reload.hidden, false);
for (const control of [rt.replyText, rt.noteText, rt.statusSelect, rt.statusSubmit, rt.assign]) assert.equal(control.disabled, true);
submit(rt, rt.note);