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

+58 -58
View File
@@ -1,20 +1,20 @@
(function ($) {
'use strict';
const config = window.aksrtWidgetAdmin || {};
const core = window.AKSRTWidgetAdminCore;
const config = window.jioWidgetAdmin || {};
const core = window.JioWidgetAdminCore;
function initForm(root) {
const $root = $(root);
$root.find('.aksrt-widget-color').wpColorPicker();
$root.find('.aksrt-widget-repeater__rows').sortable({
$root.find('.jio-widget-color').wpColorPicker();
$root.find('.jio-widget-repeater__rows').sortable({
handle: '.dashicons-move',
axis: 'y',
update: renumberRepeaters,
});
$root.find('.aksrt-widget-terms__selected').sortable({
items: '.aksrt-widget-terms__chip',
update: () => $root.find('.aksrt-widget-terms').each((_i, el) => syncTerms(el)),
$root.find('.jio-widget-terms__selected').sortable({
items: '.jio-widget-terms__chip',
update: () => $root.find('.jio-widget-terms').each((_i, el) => syncTerms(el)),
});
$root.find('input[type="range"]').each(function () {
const output = this.parentElement.querySelector('output');
@@ -28,25 +28,25 @@
/* terms 字段:以“已选标签”为唯一真源,同步隐藏输入(选择顺序)与复选框。 */
function syncTerms(wrap) {
const $wrap = $(wrap);
const ids = $wrap.find('.aksrt-widget-terms__chip').map((_i, el) => String($(el).data('term-id'))).get();
$wrap.find('.aksrt-widget-terms__value').val(ids.join(',')).trigger('change');
$wrap.find('.aksrt-widget-terms__option input').each(function () {
const ids = $wrap.find('.jio-widget-terms__chip').map((_i, el) => String($(el).data('term-id'))).get();
$wrap.find('.jio-widget-terms__value').val(ids.join(',')).trigger('change');
$wrap.find('.jio-widget-terms__option input').each(function () {
this.checked = ids.indexOf(String(this.value)) !== -1;
});
}
function addTermChip(wrap, id, name) {
const $selected = $(wrap).find('.aksrt-widget-terms__selected');
if ($selected.find(`.aksrt-widget-terms__chip[data-term-id="${id}"]`).length) return;
const chip = $(`<span class="aksrt-widget-terms__chip" data-term-id="${id}"><span class="dashicons dashicons-move" aria-hidden="true"></span></span>`);
const $selected = $(wrap).find('.jio-widget-terms__selected');
if ($selected.find(`.jio-widget-terms__chip[data-term-id="${id}"]`).length) return;
const chip = $(`<span class="jio-widget-terms__chip" data-term-id="${id}"><span class="dashicons dashicons-move" aria-hidden="true"></span></span>`);
chip.append(document.createTextNode(name));
chip.append('<button type="button" class="button-link-delete aksrt-widget-terms__remove" aria-label="移除">×</button>');
chip.append('<button type="button" class="button-link-delete jio-widget-terms__remove" aria-label="移除">×</button>');
$selected.append(chip);
}
function updateWidgetTitle(root) {
const $root = $(root);
const title = String($root.find('.aksrt-widget-field[data-field-id="title"] input').first().val() || '').trim();
const title = String($root.find('.jio-widget-field[data-field-id="title"] input').first().val() || '').trim();
if (!title) return;
$root.closest('.widget').find('.widget-title h3, .widget-title-action + h3').first().contents().filter(function () {
return this.nodeType === Node.TEXT_NODE;
@@ -86,18 +86,18 @@
/* Lazy placeholder status uses the reference t-notice box (t-loading / t-error). */
function setLazyStatus($container, type, message) {
const $notice = $('<div class="t-notice"></div>').addClass(`t-${type}`).text(message);
$container.find('.aksrt-widget-form-lazy__status').empty().append($notice);
$container.find('.jio-widget-form-lazy__status').empty().append($notice);
}
function renumberRepeaters(_event, ui) {
const $form = $(ui?.item || this).closest('.aksrt-widget-form');
$form.find('.aksrt-widget-repeater__rows').each(function () {
$(this).children('.aksrt-widget-repeater__row').each(function (index) {
const $form = $(ui?.item || this).closest('.jio-widget-form');
$form.find('.jio-widget-repeater__rows').each(function () {
$(this).children('.jio-widget-repeater__row').each(function (index) {
this.dataset.rowIndex = String(index);
});
});
$form.find('[name]').each(function () {
const rowIndexes = $(this).parents('.aksrt-widget-repeater__row').get().reverse().map((row) => Number(row.dataset.rowIndex || 0));
const rowIndexes = $(this).parents('.jio-widget-repeater__row').get().reverse().map((row) => Number(row.dataset.rowIndex || 0));
if (!rowIndexes.length) return;
this.name = core.replaceRepeaterIndexes(this.name, rowIndexes);
});
@@ -105,12 +105,12 @@
}
function updateRepeaterTitles($form) {
$form.find('.aksrt-widget-repeater__rows').each(function () {
$(this).children('.aksrt-widget-repeater__row').each(function (index) {
$form.find('.jio-widget-repeater__rows').each(function () {
$(this).children('.jio-widget-repeater__row').each(function (index) {
const $row = $(this);
const $title = $row.find('.aksrt-widget-repeater__title').first();
const $title = $row.find('.jio-widget-repeater__title').first();
const prefix = String($title.data('title-prefix') || '项目');
const $firstControl = $row.children('.aksrt-widget-repeater__fields').find('input:not([type="hidden"]), select, textarea').first();
const $firstControl = $row.children('.jio-widget-repeater__fields').find('input:not([type="hidden"]), select, textarea').first();
const value = String($firstControl.val() || '').trim();
$title.text(prefix + (index + 1) + (value ? ':' + value : ''));
});
@@ -118,18 +118,18 @@
}
function updateRepeaterControls($root) {
$root.filter('.aksrt-widget-repeater').add($root.find('.aksrt-widget-repeater')).each(function () {
$root.filter('.jio-widget-repeater').add($root.find('.jio-widget-repeater')).each(function () {
const $repeater = $(this);
const count = $repeater.children('.aksrt-widget-repeater__rows').children('.aksrt-widget-repeater__row').length;
const count = $repeater.children('.jio-widget-repeater__rows').children('.jio-widget-repeater__row').length;
const min = Number($repeater.data('min-items') || 0);
const max = Number($repeater.data('max-items') || 50);
$repeater.children('.aksrt-widget-repeater__rows').children('.aksrt-widget-repeater__row').children('.aksrt-widget-repeater__bar').children('.aksrt-widget-repeater__remove').prop('disabled', count <= min);
$repeater.children('.aksrt-widget-repeater__add').prop('disabled', count >= max);
$repeater.children('.jio-widget-repeater__rows').children('.jio-widget-repeater__row').children('.jio-widget-repeater__bar').children('.jio-widget-repeater__remove').prop('disabled', count <= min);
$repeater.children('.jio-widget-repeater__add').prop('disabled', count >= max);
});
}
function fieldValue($form, id) {
const $field = $form.find(`.aksrt-widget-field[data-field-id="${CSS.escape(id)}"]`).first();
const $field = $form.find(`.jio-widget-field[data-field-id="${CSS.escape(id)}"]`).first();
const $checked = $field.find('input:checked').first();
if ($checked.length) return String($checked.val());
return String($field.find('input,select,textarea').first().val() ?? '');
@@ -138,7 +138,7 @@
function evaluateDependencies($form) {
$form.find('[data-dependency]').each(function () {
const rule = core.parseDependency(this.dataset.dependency || '[]');
const $row = $(this).closest('.aksrt-widget-repeater__row');
const $row = $(this).closest('.jio-widget-repeater__row');
const scope = $row.length ? $row : $form;
const ids = Array.isArray(rule[0]) ? rule[0].map((part) => part[0]) : String(rule[0] || '').split('|');
const current = {};
@@ -150,18 +150,18 @@
$(document)
.on('click', '.widget-top', function () {
const $widget = $(this).closest('.widget, .customize-control-widget_form');
window.setTimeout(() => $widget.find('.aksrt-widget-form-lazy').each(function () { loadForm(this); }), 20);
window.setTimeout(() => $widget.find('.jio-widget-form-lazy').each(function () { loadForm(this); }), 20);
})
.on('change input', '.aksrt-widget-form input, .aksrt-widget-form select, .aksrt-widget-form textarea', function () {
const $form = $(this).closest('.aksrt-widget-form');
.on('change input', '.jio-widget-form input, .jio-widget-form select, .jio-widget-form textarea', function () {
const $form = $(this).closest('.jio-widget-form');
evaluateDependencies($form);
updateWidgetTitle($form);
updateRepeaterTitles($form);
})
.on('click', '.aksrt-widget-repeater__add', function () {
const $repeater = $(this).closest('.aksrt-widget-repeater');
.on('click', '.jio-widget-repeater__add', function () {
const $repeater = $(this).closest('.jio-widget-repeater');
const max = Number($repeater.data('max-items') || 50);
const $rows = $repeater.children('.aksrt-widget-repeater__rows');
const $rows = $repeater.children('.jio-widget-repeater__rows');
if ($rows.children().length >= max) return;
const index = $rows.children().length;
const token = String($repeater.data('index-token') || '__index__');
@@ -171,38 +171,38 @@
renumberRepeaters.call($rows[0]);
updateRepeaterControls($repeater);
})
.on('click', '.aksrt-widget-repeater__remove', function (event) {
.on('click', '.jio-widget-repeater__remove', function (event) {
event.preventDefault();
event.stopPropagation();
const $repeater = $(this).closest('.aksrt-widget-repeater');
const $rows = $repeater.children('.aksrt-widget-repeater__rows');
if ($rows.children('.aksrt-widget-repeater__row').length <= Number($repeater.data('min-items') || 0)) return;
$(this).closest('.aksrt-widget-repeater__row').remove();
const $repeater = $(this).closest('.jio-widget-repeater');
const $rows = $repeater.children('.jio-widget-repeater__rows');
if ($rows.children('.jio-widget-repeater__row').length <= Number($repeater.data('min-items') || 0)) return;
$(this).closest('.jio-widget-repeater__row').remove();
renumberRepeaters.call($rows[0]);
updateRepeaterControls($repeater);
})
.on('click', '.aksrt-widget-terms__remove', function () {
$(this).closest('.aksrt-widget-terms__chip').remove();
syncTerms($(this).closest('.aksrt-widget-terms'));
.on('click', '.jio-widget-terms__remove', function () {
$(this).closest('.jio-widget-terms__chip').remove();
syncTerms($(this).closest('.jio-widget-terms'));
})
.on('change', '.aksrt-widget-terms__option input', function () {
const wrap = this.closest('.aksrt-widget-terms');
const option = this.closest('.aksrt-widget-terms__option');
.on('change', '.jio-widget-terms__option input', function () {
const wrap = this.closest('.jio-widget-terms');
const option = this.closest('.jio-widget-terms__option');
const id = String(this.value);
const name = (option.querySelector('[data-term-name]') || option).getAttribute('data-term-name');
if (this.checked) addTermChip(wrap, id, name || id);
else $(wrap).find('.aksrt-widget-terms__chip').filter((_index, chip) => String($(chip).data('term-id')) === id).remove();
else $(wrap).find('.jio-widget-terms__chip').filter((_index, chip) => String($(chip).data('term-id')) === id).remove();
syncTerms(wrap);
})
.on('input', '.aksrt-widget-terms__search', function () {
.on('input', '.jio-widget-terms__search', function () {
const needle = this.value.trim().toLowerCase();
$(this).closest('.aksrt-widget-terms').find('.aksrt-widget-terms__option').each(function () {
$(this).closest('.jio-widget-terms').find('.jio-widget-terms__option').each(function () {
const name = String(this.getAttribute('data-term-name') || '').toLowerCase();
this.hidden = needle !== '' && name.indexOf(needle) === -1;
});
})
.on('click', '.aksrt-widget-upload__choose', function () {
const $wrap = $(this).closest('.aksrt-widget-upload');
.on('click', '.jio-widget-upload__choose', function () {
const $wrap = $(this).closest('.jio-widget-upload');
const frame = wp.media({ title: $wrap.data('media-library') === 'video' ? '选择视频' : '选择图片', library: $wrap.data('media-library') ? { type: $wrap.data('media-library') } : undefined, multiple: false });
frame.on('select', () => {
const attachment = frame.state().get('selection').first().toJSON();
@@ -214,14 +214,14 @@
});
frame.open();
})
.on('click', '.aksrt-widget-upload__remove', function () {
const $wrap = $(this).closest('.aksrt-widget-upload');
.on('click', '.jio-widget-upload__remove', function () {
const $wrap = $(this).closest('.jio-widget-upload');
$wrap.find('input[type="url"]').val('').trigger('change');
$wrap.find('img').remove();
});
$(document).on('widget-added widget-updated', function (_event, widget) {
$(widget).find('.aksrt-widget-form-lazy').each(function () { loadForm(this); });
$(widget).find('.jio-widget-form-lazy').each(function () { loadForm(this); });
});
if (window.wp?.customize?.bind) {
@@ -229,14 +229,14 @@
$('#customize-theme-controls').on('expanded', function (_event, section) {
if (!section || !String(section.id || section).includes('sidebar-widgets')) return;
window.setTimeout(function () {
$('.customize-control-widget_form .aksrt-widget-form-lazy').each(function () { loadForm(this); });
$('.customize-control-widget_form .jio-widget-form-lazy').each(function () { loadForm(this); });
}, 100);
});
});
}
$(function () {
$('.aksrt-widget-form').each(function () { initForm(this); });
$('.widget.open .aksrt-widget-form-lazy').each(function () { loadForm(this); });
$('.jio-widget-form').each(function () { initForm(this); });
$('.widget.open .jio-widget-form-lazy').each(function () { loadForm(this); });
});
})(jQuery);