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:
1 parent
5b16bc6e15
commit
35bb96e82f
997 files changed
+28216
-28188
No files matched your search
@@ -73,31 +73,31 @@ class wpdb {
|
||||
$GLOBALS['wpdb'] = new wpdb();
|
||||
|
||||
// Fake posts the stub WP_Query will serve, keyed by expected cat.
|
||||
$GLOBALS['aksrt_harness_posts'] = [
|
||||
$GLOBALS['jio_harness_posts'] = [
|
||||
['id' => 101, 'title' => '第一篇文章', 'cat' => 5],
|
||||
['id' => 102, 'title' => '第二篇文章', 'cat' => 5],
|
||||
['id' => 103, 'title' => '第三篇文章', 'cat' => 5],
|
||||
['id' => 104, 'title' => '第四篇文章', 'cat' => 5],
|
||||
];
|
||||
$GLOBALS['aksrt_harness_cursor'] = 0;
|
||||
$GLOBALS['jio_harness_cursor'] = 0;
|
||||
|
||||
class WP_Query {
|
||||
public array $posts = [];
|
||||
public int $found_posts = 0;
|
||||
public function __construct(public array $query_args = []) {
|
||||
$cat_in = (array) ($query_args['category__in'] ?? []);
|
||||
$matched = array_values(array_filter($GLOBALS['aksrt_harness_posts'], static fn(array $p): bool => in_array($p['cat'], $cat_in, true)));
|
||||
$matched = array_values(array_filter($GLOBALS['jio_harness_posts'], static fn(array $p): bool => in_array($p['cat'], $cat_in, true)));
|
||||
$this->found_posts = count($matched);
|
||||
foreach ($matched as $post) {
|
||||
$this->posts[] = new WP_Post($post['id']);
|
||||
$GLOBALS['aksrt_harness_lookup'][$post['id']] = $post;
|
||||
$GLOBALS['jio_harness_lookup'][$post['id']] = $post;
|
||||
}
|
||||
}
|
||||
public function have_posts(): bool { return $GLOBALS['aksrt_harness_cursor'] < count($this->posts); }
|
||||
public function have_posts(): bool { return $GLOBALS['jio_harness_cursor'] < count($this->posts); }
|
||||
public function the_post(): void {
|
||||
$post = $this->posts[$GLOBALS['aksrt_harness_cursor']];
|
||||
$GLOBALS['aksrt_harness_cursor']++;
|
||||
$GLOBALS['aksrt_harness_current_post'] = $GLOBALS['aksrt_harness_lookup'][$post->ID] ?? ['id' => $post->ID, 'title' => '文章' . $post->ID];
|
||||
$post = $this->posts[$GLOBALS['jio_harness_cursor']];
|
||||
$GLOBALS['jio_harness_cursor']++;
|
||||
$GLOBALS['jio_harness_current_post'] = $GLOBALS['jio_harness_lookup'][$post->ID] ?? ['id' => $post->ID, 'title' => '文章' . $post->ID];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ function human_time_diff(int $from, int $to = 0): string {
|
||||
function get_avatar_url($id, array $args = []): string { return 'https://example.test/avatar-' . (int) $id . '.jpg'; }
|
||||
function get_post_meta($id, $key = '', $single = false) { unset($id, $key, $single); return ''; }
|
||||
function get_term_meta(int $term_id, string $key, bool $single = false) {
|
||||
if ($key === 'aksrt_category_cover_id') {
|
||||
if ($key === 'jio_category_cover_id') {
|
||||
return $term_id === 5 ? 55 : 0;
|
||||
}
|
||||
return '';
|
||||
@@ -170,10 +170,10 @@ function get_term(int $term_id, string $taxonomy = '') {
|
||||
function get_term_link(WP_Term $term) {
|
||||
return 'https://example.test/cat-' . $term->term_id;
|
||||
}
|
||||
function get_the_ID(): int { return (int) ($GLOBALS['aksrt_harness_current_post']['id'] ?? 0); }
|
||||
function get_the_ID(): int { return (int) ($GLOBALS['jio_harness_current_post']['id'] ?? 0); }
|
||||
function get_the_title($id = 0): string {
|
||||
unset($id);
|
||||
return (string) ($GLOBALS['aksrt_harness_current_post']['title'] ?? '');
|
||||
return (string) ($GLOBALS['jio_harness_current_post']['title'] ?? '');
|
||||
}
|
||||
function get_permalink($id = 0): string { return 'https://example.test/post-' . (int) ($id ?: get_the_ID()); }
|
||||
function get_the_excerpt($id = 0): string { unset($id); return '这是摘要'; }
|
||||
@@ -191,19 +191,19 @@ function get_comments_link($id = 0): string { return get_permalink($id) . '#comm
|
||||
function comments_open($id = 0): bool { unset($id); return true; }
|
||||
function get_post_type($id = 0): string { unset($id); return 'post'; }
|
||||
function has_post_format($formats, $id = 0): bool { unset($formats, $id); return false; }
|
||||
function aksrt_get_pay_meta($post = null): array { unset($post); return ['pay_type' => 'no', 'price' => 0]; }
|
||||
function aksrt_get_post_views($id = 0): int { return (int) ($id % 90) + 10; }
|
||||
function aksrt_get_post_likes($id = 0): int { return (int) ($id % 7); }
|
||||
function aksrt_get_post_favorites($id = 0): int { return (int) ($id % 5); }
|
||||
function aksrt_resource_card_badge_text($id = 0): string { unset($id); return ''; }
|
||||
function aksrt_format_number($num): string { return (string) $num; }
|
||||
function aksrt_is_lazy(string $key, bool $default = false): bool { unset($key); return $default; }
|
||||
function aksrt_get_lazy_thumb(string $size = ''): string { unset($size); return 'https://example.test/lazy.svg'; }
|
||||
function aksrt_get_lazy_attr(string $type, string $src, string $class = '', string $lazy_src = ''): string {
|
||||
function jio_get_pay_meta($post = null): array { unset($post); return ['pay_type' => 'no', 'price' => 0]; }
|
||||
function jio_get_post_views($id = 0): int { return (int) ($id % 90) + 10; }
|
||||
function jio_get_post_likes($id = 0): int { return (int) ($id % 7); }
|
||||
function jio_get_post_favorites($id = 0): int { return (int) ($id % 5); }
|
||||
function jio_resource_card_badge_text($id = 0): string { unset($id); return ''; }
|
||||
function jio_format_number($num): string { return (string) $num; }
|
||||
function jio_is_lazy(string $key, bool $default = false): bool { unset($key); return $default; }
|
||||
function jio_get_lazy_thumb(string $size = ''): string { unset($size); return 'https://example.test/lazy.svg'; }
|
||||
function jio_get_lazy_attr(string $type, string $src, string $class = '', string $lazy_src = ''): string {
|
||||
$url = $lazy_src !== '' ? $lazy_src : $src;
|
||||
return ' class="' . esc_attr($class) . '" src="' . esc_url($url) . '" data-src="' . esc_url($src) . '" data-lazy-type="' . esc_attr($type) . '"';
|
||||
}
|
||||
function aksrt_renderer_resolve_images($post_id, array $cfg): array {
|
||||
function jio_renderer_resolve_images($post_id, array $cfg): array {
|
||||
unset($post_id, $cfg);
|
||||
return ['primary' => '', 'has_real' => false, 'gallery' => [], 'slides' => [], 'is_slide' => false, 'video_url' => ''];
|
||||
}
|
||||
@@ -241,11 +241,11 @@ class WP_Widget {
|
||||
}
|
||||
|
||||
require dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||
require dirname(__DIR__, 2) . '/inc/helpers/aksrt-graphic-card.php';
|
||||
require dirname(__DIR__, 2) . '/inc/helpers/aksrt-widgets-markup.php';
|
||||
require dirname(__DIR__, 2) . '/inc/helpers/jio-graphic-card.php';
|
||||
require dirname(__DIR__, 2) . '/inc/helpers/jio-widgets-markup.php';
|
||||
require dirname(__DIR__, 2) . '/inc/helpers/posts-renderer/post-data.php';
|
||||
|
||||
use AKSRT\WidgetSystem\Renderers\ContentRenderer;
|
||||
use Jio\WidgetSystem\Renderers\ContentRenderer;
|
||||
|
||||
$instance = [
|
||||
'term_id' => [5, 8],
|
||||
@@ -270,7 +270,7 @@ try {
|
||||
|
||||
// Single-term variant (is_row=false) + animation variant.
|
||||
try {
|
||||
$GLOBALS['aksrt_harness_cursor'] = 0;
|
||||
$GLOBALS['jio_harness_cursor'] = 0;
|
||||
$single = ContentRenderer::render('term_aggregation', array_merge($instance, ['term_id' => [5], 'obs_animation' => 'fade']));
|
||||
echo "=== SINGLE OK (len=" . strlen($single) . ") ===\n";
|
||||
echo $single . "\n";
|
||||
@@ -280,16 +280,16 @@ try {
|
||||
|
||||
// Full pipeline: registry -> definition -> normalize(raw form input '5,8') -> FrontendRenderer.
|
||||
try {
|
||||
$definitions = \AKSRT\WidgetSystem\WidgetRegistry::all();
|
||||
$definitions = \Jio\WidgetSystem\WidgetRegistry::all();
|
||||
echo "=== REGISTRY: term_aggregation present = " . (isset($definitions['term_aggregation']) ? 'yes' : 'NO') . " ===\n";
|
||||
$definition = $definitions['term_aggregation'];
|
||||
$widget = new \AKSRT\WidgetSystem\SchemaWidget($definition);
|
||||
$widget = new \Jio\WidgetSystem\SchemaWidget($definition);
|
||||
$widget->_set(2);
|
||||
$normalized = $definition->normalize(['term_id' => '5,8']);
|
||||
echo "=== NORMALIZED term_id = " . json_encode($normalized['term_id']) . " ===\n";
|
||||
$GLOBALS['aksrt_harness_cursor'] = 0;
|
||||
$GLOBALS['jio_harness_cursor'] = 0;
|
||||
ob_start();
|
||||
\AKSRT\WidgetSystem\FrontendRenderer::render(
|
||||
\Jio\WidgetSystem\FrontendRenderer::render(
|
||||
$definition,
|
||||
['before_widget' => '<section class="w">', 'after_widget' => '</section>'],
|
||||
$normalized,
|
||||
@@ -301,7 +301,7 @@ try {
|
||||
|
||||
// Empty selection must render nothing at all.
|
||||
ob_start();
|
||||
\AKSRT\WidgetSystem\FrontendRenderer::render($definition, ['before_widget' => '<section>', 'after_widget' => '</section>'], $definition->normalize([]), $widget);
|
||||
\Jio\WidgetSystem\FrontendRenderer::render($definition, ['before_widget' => '<section>', 'after_widget' => '</section>'], $definition->normalize([]), $widget);
|
||||
$empty = (string) ob_get_clean();
|
||||
echo "=== EMPTY SELECTION OUTPUT len=" . strlen($empty) . " ===\n";
|
||||
|
||||
@@ -309,12 +309,12 @@ try {
|
||||
ob_start();
|
||||
$widget->render_full_form($definition->normalize(['term_id' => '5,8']));
|
||||
$form = (string) ob_get_clean();
|
||||
if (preg_match('/<div class="aksrt-widget-field aksrt-widget-field--terms".*?<\/div>\s*<\/div>\s*<\/div>/s', $form, $m)) {
|
||||
if (preg_match('/<div class="jio-widget-field jio-widget-field--terms".*?<\/div>\s*<\/div>\s*<\/div>/s', $form, $m)) {
|
||||
echo "=== TERMS FIELD HTML ===\n" . $m[0] . "\n";
|
||||
}
|
||||
echo "=== FORM contains hidden terms value name = " . (strpos($form, 'name="widget-aksrt_widget_term_aggregation[2][term_id]"') !== false ? 'yes' : 'NO') . " ===\n";
|
||||
echo "=== FORM contains hidden terms value name = " . (strpos($form, 'name="widget-jio_widget_term_aggregation[2][term_id]"') !== false ? 'yes' : 'NO') . " ===\n";
|
||||
echo "=== FORM hidden value = ";
|
||||
preg_match('/class="aksrt-widget-terms__value"[^>]*value="([^"]*)"/', $form, $v);
|
||||
preg_match('/class="jio-widget-terms__value"[^>]*value="([^"]*)"/', $form, $v);
|
||||
echo ($v[1] ?? '(not found)') . " ===\n";
|
||||
} catch (Throwable $e) {
|
||||
echo '=== FULL PATH FATAL: ' . get_class($e) . ': ' . $e->getMessage() . ' @ ' . $e->getFile() . ':' . $e->getLine() . "\n";
|
||||
|
||||
Reference in new issue
Block a user