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
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax list helpers and declarative modal trigger markup.
|
||||
*
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('jio_get_ajax_null')) {
|
||||
/**
|
||||
* Empty state for AJAX list replace.
|
||||
*/
|
||||
function jio_get_ajax_null(?string $text = null, $margin = 60, string $img = 'null.svg', int $width = 280): string {
|
||||
if (null === $text) {
|
||||
$text = __('内容空空如也', 'jio');
|
||||
}
|
||||
if (function_exists('jio_get_null')) {
|
||||
return jio_get_null($text, $margin, $img, 'ajax-item jio-ajax-null', $width);
|
||||
}
|
||||
return '<div class="text-center ajax-item jio-ajax-null" style="padding:' . esc_attr((string) $margin) . 'px 0;">'
|
||||
. '<p class="muted-3-color">' . esc_html((string) $text) . '</p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('jio_get_ajax_next_paginate')) {
|
||||
/**
|
||||
* Load-more style paginate block (legacy subset).
|
||||
*
|
||||
* @param int $count_all Total items.
|
||||
* @param int $page Current page (1-based).
|
||||
* @param int $per_page Per page.
|
||||
* @param string $ajax_url Next page URL (full or REST).
|
||||
* @param string $pag_class Wrapper class.
|
||||
* @param string $next_class Link class.
|
||||
* @param string $label Button label.
|
||||
*/
|
||||
function jio_get_ajax_next_paginate(
|
||||
int $count_all,
|
||||
int $page = 1,
|
||||
int $per_page = 10,
|
||||
string $ajax_url = '',
|
||||
string $pag_class = 'text-center theme-pagination ajax-pag',
|
||||
string $next_class = 'next-page ajax-next',
|
||||
string $label = ''
|
||||
): string {
|
||||
$page = max(1, $page);
|
||||
$per_page = max(1, $per_page);
|
||||
$max = (int) ceil($count_all / $per_page);
|
||||
if ($page >= $max || $count_all <= 0) {
|
||||
return '<div class="' . esc_attr($pag_class) . ' hide"><div class="' . esc_attr($next_class) . '"><a href="#"></a></div></div>';
|
||||
}
|
||||
if ($label === '') {
|
||||
$label = __('加载更多', 'jio');
|
||||
}
|
||||
$next = $page + 1;
|
||||
$url = $ajax_url !== '' ? $ajax_url : '#';
|
||||
// Prefer caller-provided URL already containing next page.
|
||||
return '<div class="' . esc_attr($pag_class) . '">'
|
||||
. '<div class="' . esc_attr($next_class) . '">'
|
||||
. '<a href="' . esc_url($url) . '" class="ajax-next" data-page="' . esc_attr((string) $next) . '">'
|
||||
. esc_html($label)
|
||||
. '</a></div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('jio_get_modal_link')) {
|
||||
/**
|
||||
* Build a declarative modal runtime trigger.
|
||||
*
|
||||
* @param array{
|
||||
* tag?:string,class?:string,text?:string,url?:string,
|
||||
* data_class?:string,height?:int,mobile_bottom?:bool,
|
||||
* query_arg?:array<string,scalar>
|
||||
* } $args
|
||||
*/
|
||||
function jio_get_modal_link(array $args = []): string {
|
||||
$tag = sanitize_key((string) ($args['tag'] ?? 'a'));
|
||||
if (!in_array($tag, ['a', 'button', 'span'], true)) {
|
||||
$tag = 'a';
|
||||
}
|
||||
$class = trim((string) ($args['class'] ?? ''));
|
||||
$text = (string) ($args['text'] ?? __('打开', 'jio'));
|
||||
$url = (string) ($args['url'] ?? '');
|
||||
if ($url === '' && !empty($args['query_arg']) && is_array($args['query_arg'])) {
|
||||
// Prefer REST absolute URL if provided via action helper.
|
||||
$url = add_query_arg($args['query_arg'], admin_url('admin-ajax.php'));
|
||||
}
|
||||
$data_class = (string) ($args['data_class'] ?? 'modal-mini full-sm');
|
||||
$height = isset($args['height']) ? (int) $args['height'] : 0;
|
||||
$mobile = !isset($args['mobile_bottom']) || !empty($args['mobile_bottom']);
|
||||
$cache = !isset($args['cache']) || !empty($args['cache']);
|
||||
|
||||
$attrs = ' class="' . esc_attr(trim($class . ' jio-modal-link')) . '"';
|
||||
$attrs .= ' data-jio-modal="remote"';
|
||||
$attrs .= ' data-jio-modal-url="' . esc_url($url) . '"';
|
||||
$attrs .= ' data-jio-modal-class="' . esc_attr($data_class) . '"';
|
||||
if (!$cache) {
|
||||
$attrs .= ' data-jio-modal-cache="false"';
|
||||
}
|
||||
if ($height > 0) {
|
||||
$attrs .= ' data-jio-modal-height="' . esc_attr((string) $height) . '"';
|
||||
}
|
||||
if ($mobile) {
|
||||
$attrs .= ' data-jio-modal-mobile-bottom="true"';
|
||||
}
|
||||
if ($tag === 'a') {
|
||||
$attrs .= ' href="' . esc_url($url !== '' ? $url : '#') . '"';
|
||||
} else {
|
||||
$attrs .= ' type="button"';
|
||||
}
|
||||
|
||||
return '<' . $tag . $attrs . '>' . esc_html($text) . '</' . $tag . '>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('jio_get_ajax_number_paginate')) {
|
||||
/**
|
||||
* Numbered AJAX pager (legacy subset).
|
||||
*
|
||||
* Links use class next-page ajax-next + ajax-replace so ajax-list.js
|
||||
* replaces .ajax-item rows inside the nearest .ajaxpager.
|
||||
*
|
||||
* @param int $count_all Total items.
|
||||
* @param int $page Current page (1-based).
|
||||
* @param int $per_page Per page.
|
||||
* @param string $ajax_url Base REST/URL (page query key replaced).
|
||||
* @param string $pag_class Wrapper class.
|
||||
* @param string $next_class Link base class.
|
||||
* @param string $query_key Page query arg (default page).
|
||||
*/
|
||||
function jio_get_ajax_number_paginate(
|
||||
int $count_all,
|
||||
int $page = 1,
|
||||
int $per_page = 10,
|
||||
string $ajax_url = '',
|
||||
string $pag_class = 'ajax-pag',
|
||||
string $next_class = 'next-page ajax-next',
|
||||
string $query_key = 'page'
|
||||
): string {
|
||||
$page = max(1, $page);
|
||||
$per_page = max(1, $per_page);
|
||||
$total_pages = (int) ceil(max(0, $count_all) / $per_page);
|
||||
if ($total_pages < 2 || $count_all <= 0) {
|
||||
return '<div class="' . esc_attr($pag_class) . ' hide"><div class="' . esc_attr($next_class) . '"><a href="#"></a></div></div>';
|
||||
}
|
||||
|
||||
$base = $ajax_url !== '' ? $ajax_url : '#';
|
||||
// Ensure %#% placeholder for page numbers.
|
||||
if (strpos($base, '%#%') === false) {
|
||||
$base = add_query_arg($query_key, '%#%', $base);
|
||||
}
|
||||
|
||||
$end_size = 1;
|
||||
$mid_size = 2;
|
||||
$links = [];
|
||||
$dots = false;
|
||||
|
||||
// Prev.
|
||||
if ($page > 1) {
|
||||
$url = esc_url(str_replace('%#%', (string) ($page - 1), $base));
|
||||
$links[] = '<a class="' . esc_attr($next_class) . ' prev page-numbers" ajax-replace="true" href="' . $url . '"><i class="fa fas fa-angle-left em12" aria-hidden="true"></i></a>';
|
||||
}
|
||||
|
||||
for ($n = 1; $n <= $total_pages; $n++) {
|
||||
$in_window = $n <= $end_size
|
||||
|| $n > $total_pages - $end_size
|
||||
|| ($n >= $page - $mid_size && $n <= $page + $mid_size);
|
||||
if (!$in_window) {
|
||||
if ($dots) {
|
||||
continue;
|
||||
}
|
||||
$links[] = '<span class="page-numbers dots">…</span>';
|
||||
$dots = true;
|
||||
continue;
|
||||
}
|
||||
$dots = false;
|
||||
if ($n === $page) {
|
||||
$links[] = '<span class="page-numbers current">' . (int) $n . '</span>';
|
||||
} else {
|
||||
$url = esc_url(str_replace('%#%', (string) $n, $base));
|
||||
$links[] = '<a class="' . esc_attr($next_class) . ' page-numbers" ajax-replace="true" href="' . $url . '">' . (int) $n . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Next.
|
||||
if ($page < $total_pages) {
|
||||
$url = esc_url(str_replace('%#%', (string) ($page + 1), $base));
|
||||
$links[] = '<a class="' . esc_attr($next_class) . ' next page-numbers" ajax-replace="true" href="' . $url . '"><i class="fa fas fa-angle-right em12" aria-hidden="true"></i></a>';
|
||||
}
|
||||
|
||||
return '<div class="pagenav ' . esc_attr($pag_class) . '">' . implode('', $links) . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user