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
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* User template registry + template utils
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
@@ -12,7 +12,7 @@ defined('ABSPATH') || exit;
|
||||
// 修改此处即可增删模板页面,无需改动其他逻辑
|
||||
// ============================================================
|
||||
// Only true fixed template pages live in the registry.
|
||||
$_aksrt_special_templates = [
|
||||
$_jio_special_templates = [
|
||||
'sign' => [
|
||||
'file' => 'templates/pages/page-sign.php',
|
||||
'slug' => 'sign',
|
||||
@@ -46,7 +46,7 @@ $_aksrt_special_templates = [
|
||||
];
|
||||
|
||||
/** @var array 缓存 key=模板文件路径 => value=WP_Post|null */
|
||||
$_aksrt_template_page_cache = [];
|
||||
$_jio_template_page_cache = [];
|
||||
|
||||
|
||||
// ============================================================
|
||||
@@ -59,10 +59,10 @@ $_aksrt_template_page_cache = [];
|
||||
* @param string $template_file 相对于主题的模板路径
|
||||
* @return WP_Post|null
|
||||
*/
|
||||
function aksrt_find_template_page(string $template_file) {
|
||||
global $_aksrt_template_page_cache;
|
||||
if (isset($_aksrt_template_page_cache[$template_file])) {
|
||||
return $_aksrt_template_page_cache[$template_file];
|
||||
function jio_find_template_page(string $template_file) {
|
||||
global $_jio_template_page_cache;
|
||||
if (isset($_jio_template_page_cache[$template_file])) {
|
||||
return $_jio_template_page_cache[$template_file];
|
||||
}
|
||||
|
||||
$page = null;
|
||||
@@ -76,7 +76,7 @@ function aksrt_find_template_page(string $template_file) {
|
||||
$page = $pages[0];
|
||||
}
|
||||
|
||||
$_aksrt_template_page_cache[$template_file] = $page;
|
||||
$_jio_template_page_cache[$template_file] = $page;
|
||||
return $page;
|
||||
}
|
||||
|
||||
@@ -86,18 +86,18 @@ function aksrt_find_template_page(string $template_file) {
|
||||
* @param string $key 注册表 key(当前仅 profile 使用)
|
||||
* @return string 页面 URL 或回退地址
|
||||
*/
|
||||
function aksrt_get_template_url(string $key): string {
|
||||
global $_aksrt_special_templates;
|
||||
if (!isset($_aksrt_special_templates[$key])) {
|
||||
function jio_get_template_url(string $key): string {
|
||||
global $_jio_special_templates;
|
||||
if (!isset($_jio_special_templates[$key])) {
|
||||
return home_url('/');
|
||||
}
|
||||
|
||||
$cfg = $_aksrt_special_templates[$key];
|
||||
$page = aksrt_find_template_page($cfg['file']);
|
||||
$cfg = $_jio_special_templates[$key];
|
||||
$page = jio_find_template_page($cfg['file']);
|
||||
|
||||
if (!$page) {
|
||||
aksrt_ensure_template_page($key);
|
||||
$page = aksrt_find_template_page($cfg['file']);
|
||||
jio_ensure_template_page($key);
|
||||
$page = jio_find_template_page($cfg['file']);
|
||||
}
|
||||
|
||||
if ($page) {
|
||||
@@ -113,18 +113,18 @@ function aksrt_get_template_url(string $key): string {
|
||||
* @param string $template_file 相对于主题的路径
|
||||
* @return string|false 文件绝对路径或 false
|
||||
*/
|
||||
function aksrt_locate_template_file(string $template_file) {
|
||||
function jio_locate_template_file(string $template_file) {
|
||||
$path = locate_template([$template_file]);
|
||||
if ($path) return $path;
|
||||
|
||||
$full = AKSRT_DIR . '/' . $template_file;
|
||||
$full = JIO_DIR . '/' . $template_file;
|
||||
return file_exists($full) ? $full : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a public-facing page template file from stored meta or page slug.
|
||||
*/
|
||||
function aksrt_resolve_page_template_file(string $template_file = '', string $post_slug = ''): string {
|
||||
function jio_resolve_page_template_file(string $template_file = '', string $post_slug = ''): string {
|
||||
$template_file = ltrim($template_file, '/\\');
|
||||
$post_slug = sanitize_title($post_slug);
|
||||
|
||||
@@ -136,7 +136,7 @@ function aksrt_resolve_page_template_file(string $template_file = '', string $po
|
||||
return $template_file;
|
||||
}
|
||||
|
||||
if (strpos($template_file, 'templates/pages/') === 0 && aksrt_locate_template_file($template_file)) {
|
||||
if (strpos($template_file, 'templates/pages/') === 0 && jio_locate_template_file($template_file)) {
|
||||
return $template_file;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ function aksrt_resolve_page_template_file(string $template_file = '', string $po
|
||||
'profile' => 'templates/pages/page-profile.php',
|
||||
];
|
||||
|
||||
if (!empty($slug_map[$post_slug]) && aksrt_locate_template_file($slug_map[$post_slug])) {
|
||||
if (!empty($slug_map[$post_slug]) && jio_locate_template_file($slug_map[$post_slug])) {
|
||||
return $slug_map[$post_slug];
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ function aksrt_resolve_page_template_file(string $template_file = '', string $po
|
||||
/**
|
||||
* Normalize auth view keys used by the unified sign page.
|
||||
*/
|
||||
function aksrt_normalize_auth_tab(string $tab): string {
|
||||
function jio_normalize_auth_tab(string $tab): string {
|
||||
$tab = sanitize_key($tab);
|
||||
|
||||
switch ($tab) {
|
||||
@@ -185,57 +185,57 @@ function aksrt_normalize_auth_tab(string $tab): string {
|
||||
/**
|
||||
* 清除模板页面缓存
|
||||
*/
|
||||
function aksrt_clear_template_page_cache(): void {
|
||||
global $_aksrt_template_page_cache;
|
||||
$_aksrt_template_page_cache = [];
|
||||
function jio_clear_template_page_cache(): void {
|
||||
global $_jio_template_page_cache;
|
||||
$_jio_template_page_cache = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the public user-home template context and return its template path.
|
||||
*/
|
||||
function aksrt_get_user_home_template_path(): string {
|
||||
global $_aksrt_special_templates, $aksrt_profile_user;
|
||||
function jio_get_user_home_template_path(): string {
|
||||
global $_jio_special_templates, $jio_profile_user;
|
||||
|
||||
$identifier = (string) get_query_var('aksrt_author_identifier');
|
||||
$identifier = (string) get_query_var('jio_author_identifier');
|
||||
if ($identifier === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
$user = function_exists('aksrt_resolve_public_user') ? aksrt_resolve_public_user($identifier) : null;
|
||||
$user = function_exists('jio_resolve_public_user') ? jio_resolve_public_user($identifier) : null;
|
||||
if (!$user instanceof WP_User) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$template_path = aksrt_locate_template_file('templates/pages/page-user-home.php');
|
||||
$template_path = jio_locate_template_file('templates/pages/page-user-home.php');
|
||||
|
||||
if (!$template_path) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$aksrt_profile_user = $user;
|
||||
$jio_profile_user = $user;
|
||||
return $template_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the active special-page template path for the current request.
|
||||
*/
|
||||
function aksrt_get_current_special_template_path(): string {
|
||||
if (get_query_var('aksrt_message_view')) {
|
||||
$message_template = aksrt_locate_template_file('templates/pages/page-messages.php');
|
||||
function jio_get_current_special_template_path(): string {
|
||||
if (get_query_var('jio_message_view')) {
|
||||
$message_template = jio_locate_template_file('templates/pages/page-messages.php');
|
||||
return $message_template ?: '';
|
||||
}
|
||||
|
||||
if (get_query_var('aksrt_author_identifier')) {
|
||||
return aksrt_get_user_home_template_path();
|
||||
if (get_query_var('jio_author_identifier')) {
|
||||
return jio_get_user_home_template_path();
|
||||
}
|
||||
|
||||
if (get_query_var('aksrt_user_center')) {
|
||||
$profile_template = aksrt_locate_template_file('templates/pages/page-profile.php');
|
||||
if (get_query_var('jio_user_center')) {
|
||||
$profile_template = jio_locate_template_file('templates/pages/page-profile.php');
|
||||
return $profile_template ?: '';
|
||||
}
|
||||
|
||||
if (get_query_var('aksrt_sign')) {
|
||||
$auth_template_path = aksrt_locate_template_file('templates/pages/page-sign.php');
|
||||
if (get_query_var('jio_sign')) {
|
||||
$auth_template_path = jio_locate_template_file('templates/pages/page-sign.php');
|
||||
return $auth_template_path ?: '';
|
||||
}
|
||||
|
||||
@@ -243,13 +243,13 @@ function aksrt_get_current_special_template_path(): string {
|
||||
$page_id = get_queried_object_id();
|
||||
if ($page_id > 0) {
|
||||
$page_template = get_post_meta($page_id, '_wp_page_template', true);
|
||||
$resolved_template = aksrt_resolve_page_template_file(
|
||||
$resolved_template = jio_resolve_page_template_file(
|
||||
is_string($page_template) ? $page_template : '',
|
||||
(string) get_post_field('post_name', $page_id)
|
||||
);
|
||||
|
||||
if ($resolved_template !== '') {
|
||||
$resolved_path = aksrt_locate_template_file($resolved_template);
|
||||
$resolved_path = jio_locate_template_file($resolved_template);
|
||||
if ($resolved_path) {
|
||||
return $resolved_path;
|
||||
}
|
||||
@@ -265,8 +265,8 @@ function aksrt_get_current_special_template_path(): string {
|
||||
*
|
||||
* 用于前台直接访问固定 slug 时的自动补页。
|
||||
*/
|
||||
function aksrt_get_requested_template_key(): string {
|
||||
global $_aksrt_special_templates;
|
||||
function jio_get_requested_template_key(): string {
|
||||
global $_jio_special_templates;
|
||||
|
||||
$request_uri = isset($_SERVER['REQUEST_URI']) ? (string) $_SERVER['REQUEST_URI'] : '';
|
||||
if ($request_uri === '') {
|
||||
@@ -288,7 +288,7 @@ function aksrt_get_requested_template_key(): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
foreach ($_aksrt_special_templates as $key => $cfg) {
|
||||
foreach ($_jio_special_templates as $key => $cfg) {
|
||||
$slug = isset($cfg['slug']) ? sanitize_title((string) $cfg['slug']) : '';
|
||||
if ($slug !== '' && $slug === $request_slug) {
|
||||
return (string) $key;
|
||||
@@ -303,23 +303,23 @@ function aksrt_get_requested_template_key(): string {
|
||||
*
|
||||
* @param string $key 注册表 key
|
||||
*/
|
||||
function aksrt_ensure_template_page(string $key): void {
|
||||
global $_aksrt_special_templates;
|
||||
if (!isset($_aksrt_special_templates[$key])) return;
|
||||
function jio_ensure_template_page(string $key): void {
|
||||
global $_jio_special_templates;
|
||||
if (!isset($_jio_special_templates[$key])) return;
|
||||
|
||||
$cfg = $_aksrt_special_templates[$key];
|
||||
$cfg = $_jio_special_templates[$key];
|
||||
if (array_key_exists('auto_create', $cfg) && empty($cfg['auto_create'])) {
|
||||
return;
|
||||
}
|
||||
$desired_slug = sanitize_title($cfg['slug'] ?? $key);
|
||||
|
||||
// 已有页面使用此模板?仍校验模板 meta,避免空白默认页。
|
||||
$found_page = aksrt_find_template_page($cfg['file']);
|
||||
$found_page = jio_find_template_page($cfg['file']);
|
||||
if ($found_page instanceof WP_Post) {
|
||||
$current_tpl = get_post_meta((int) $found_page->ID, '_wp_page_template', true);
|
||||
if ($current_tpl !== $cfg['file']) {
|
||||
update_post_meta((int) $found_page->ID, '_wp_page_template', $cfg['file']);
|
||||
aksrt_clear_template_page_cache();
|
||||
jio_clear_template_page_cache();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -346,8 +346,8 @@ function aksrt_ensure_template_page(string $key): void {
|
||||
|
||||
if (!is_wp_error($page_id) && $page_id > 0) {
|
||||
update_post_meta($page_id, '_wp_page_template', $cfg['file']);
|
||||
update_post_meta($page_id, '_aksrt_managed_template_page', (string) $key);
|
||||
aksrt_clear_template_page_cache();
|
||||
update_post_meta($page_id, '_jio_managed_template_page', (string) $key);
|
||||
jio_clear_template_page_cache();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user