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,16 +2,16 @@
|
||||
/**
|
||||
* Homepage queries, sidebars, post stream, and pagination.
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_homepage_get_latest_query')) {
|
||||
if (!function_exists('jio_homepage_get_latest_query')) {
|
||||
/**
|
||||
* Homepage main-stream query.
|
||||
*/
|
||||
function aksrt_homepage_get_latest_query(): WP_Query {
|
||||
function jio_homepage_get_latest_query(): WP_Query {
|
||||
static $query = null;
|
||||
|
||||
if ($query instanceof WP_Query) {
|
||||
@@ -19,48 +19,48 @@ if (!function_exists('aksrt_homepage_get_latest_query')) {
|
||||
}
|
||||
|
||||
$query_args = [
|
||||
'post_type' => aksrt_homepage_get_post_types(),
|
||||
'post_type' => jio_homepage_get_post_types(),
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => max(1, (int) get_option('posts_per_page')),
|
||||
'paged' => aksrt_homepage_get_current_page(),
|
||||
'paged' => jio_homepage_get_current_page(),
|
||||
'ignore_sticky_posts' => false,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'no_found_rows' => false,
|
||||
];
|
||||
|
||||
$exclude_ids = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::home_exclude_post_ids()
|
||||
$exclude_ids = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::home_exclude_post_ids()
|
||||
: [];
|
||||
if (!empty($exclude_ids)) {
|
||||
$query_args['post__not_in'] = $exclude_ids;
|
||||
}
|
||||
|
||||
$exclude_cat_ids = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::home_exclude_category_ids()
|
||||
$exclude_cat_ids = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::home_exclude_category_ids()
|
||||
: [];
|
||||
if (!empty($exclude_cat_ids)) {
|
||||
$query_args['category__not_in'] = $exclude_cat_ids;
|
||||
}
|
||||
|
||||
// legacy zib_sift_posts_per_orde:排序菜单的 ?orderby= 优先于后台默认排序。
|
||||
$request_sort = aksrt_homepage_get_request_sort();
|
||||
$request_sort = jio_homepage_get_request_sort();
|
||||
$query = new WP_Query(
|
||||
$request_sort !== ''
|
||||
? aksrt_homepage_apply_named_sort_args($query_args, $request_sort)
|
||||
: aksrt_homepage_apply_sort_args($query_args)
|
||||
? jio_homepage_apply_named_sort_args($query_args, $request_sort)
|
||||
: jio_homepage_apply_sort_args($query_args)
|
||||
);
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
if (!function_exists('aksrt_homepage_has_active_sidebars')) {
|
||||
if (!function_exists('jio_homepage_has_active_sidebars')) {
|
||||
/**
|
||||
* Check whether any sidebar in the given stack is active.
|
||||
*
|
||||
* @param string[] $sidebar_ids
|
||||
*/
|
||||
function aksrt_homepage_has_active_sidebars(array $sidebar_ids): bool {
|
||||
function jio_homepage_has_active_sidebars(array $sidebar_ids): bool {
|
||||
foreach ($sidebar_ids as $sidebar_id) {
|
||||
if (is_active_sidebar($sidebar_id)) {
|
||||
return true;
|
||||
@@ -71,15 +71,15 @@ if (!function_exists('aksrt_homepage_has_active_sidebars')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_render_widget_zone')) {
|
||||
if (!function_exists('jio_homepage_render_widget_zone')) {
|
||||
/**
|
||||
* Render a stacked widget zone.
|
||||
*
|
||||
* @param string[] $sidebar_ids
|
||||
* @param string $wrapper_class
|
||||
*/
|
||||
function aksrt_homepage_render_widget_zone(array $sidebar_ids, string $wrapper_class = ''): void {
|
||||
if (!aksrt_homepage_has_active_sidebars($sidebar_ids)) {
|
||||
function jio_homepage_render_widget_zone(array $sidebar_ids, string $wrapper_class = ''): void {
|
||||
if (!jio_homepage_has_active_sidebars($sidebar_ids)) {
|
||||
wp_reset_postdata();
|
||||
return;
|
||||
}
|
||||
@@ -94,19 +94,19 @@ if (!function_exists('aksrt_homepage_render_widget_zone')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_render_sidebar')) {
|
||||
if (!function_exists('jio_homepage_render_sidebar')) {
|
||||
/**
|
||||
* Render the homepage aside column.
|
||||
*
|
||||
* Visibility is aksrt_is_show_sidebar() alone; its filter already
|
||||
* Visibility is jio_is_show_sidebar() alone; its filter already
|
||||
* collapses the layout when the sidebar widget stack is empty.
|
||||
*/
|
||||
function aksrt_homepage_render_sidebar(): void {
|
||||
if (!aksrt_is_show_sidebar()) {
|
||||
function jio_homepage_render_sidebar(): void {
|
||||
if (!jio_is_show_sidebar()) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div class="sidebar aksrt-homepage__aside" role="complementary" aria-label="' . esc_attr__('Homepage Sidebar', 'aksrt') . '">';
|
||||
echo '<div class="sidebar jio-homepage__aside" role="complementary" aria-label="' . esc_attr__('Homepage Sidebar', 'jio') . '">';
|
||||
|
||||
if (is_active_sidebar('all_sidebar_top')) {
|
||||
dynamic_sidebar('all_sidebar_top');
|
||||
@@ -124,14 +124,14 @@ if (!function_exists('aksrt_homepage_render_sidebar')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_get_latest_panel_contract')) {
|
||||
if (!function_exists('jio_homepage_get_latest_panel_contract')) {
|
||||
/**
|
||||
* Public-safe latest stream contract shared by homepage pagination/AJAX.
|
||||
*
|
||||
* @return array{query_context:string,query_vars:string,render_config:string,render_config_array:array<string,mixed>}
|
||||
*/
|
||||
function aksrt_homepage_get_latest_panel_contract(): array {
|
||||
$query = aksrt_homepage_get_latest_query();
|
||||
function jio_homepage_get_latest_panel_contract(): array {
|
||||
$query = jio_homepage_get_latest_query();
|
||||
$query_vars = $query instanceof WP_Query ? $query->query_vars : [];
|
||||
if (!is_array($query_vars)) {
|
||||
$query_vars = [];
|
||||
@@ -139,7 +139,7 @@ if (!function_exists('aksrt_homepage_get_latest_panel_contract')) {
|
||||
|
||||
unset($query_vars['paged'], $query_vars['page']);
|
||||
|
||||
$render_config = aksrt_resolve_post_list_render_config(['context' => 'home']);
|
||||
$render_config = jio_resolve_post_list_render_config(['context' => 'home']);
|
||||
$render_config['skip_wrapper'] = true;
|
||||
|
||||
return [
|
||||
@@ -151,24 +151,24 @@ if (!function_exists('aksrt_homepage_get_latest_panel_contract')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_render_pagination')) {
|
||||
if (!function_exists('jio_homepage_render_pagination')) {
|
||||
/**
|
||||
* Render pagination for the fixed homepage latest stream.
|
||||
*/
|
||||
function aksrt_homepage_render_pagination(WP_Query $query): void {
|
||||
function jio_homepage_render_pagination(WP_Query $query): void {
|
||||
$max_pages = (int) $query->max_num_pages;
|
||||
if ($max_pages < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query_page = (int) $query->get('paged');
|
||||
$current_page = min(max(1, $query_page > 0 ? $query_page : aksrt_homepage_get_current_page()), $max_pages);
|
||||
$pagination_mode = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_post_pagination_mode()
|
||||
$current_page = min(max(1, $query_page > 0 ? $query_page : jio_homepage_get_current_page()), $max_pages);
|
||||
$pagination_mode = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::get_post_pagination_mode()
|
||||
: 'numbered';
|
||||
|
||||
if ($pagination_mode === 'numbered') {
|
||||
$base_url = (string) get_query_var('aksrt_homepage_pagination_base_url');
|
||||
$base_url = (string) get_query_var('jio_homepage_pagination_base_url');
|
||||
$base_args = [
|
||||
'format' => '',
|
||||
'current' => $current_page,
|
||||
@@ -194,7 +194,7 @@ if (!function_exists('aksrt_homepage_render_pagination')) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<nav class="navigation pagination" aria-label="<?php esc_attr_e('Posts', 'aksrt'); ?>">
|
||||
<nav class="navigation pagination" aria-label="<?php esc_attr_e('Posts', 'jio'); ?>">
|
||||
<div class="nav-links">
|
||||
<?php foreach ($links as $link) : ?>
|
||||
<?php echo wp_kses_post($link); ?>
|
||||
@@ -205,8 +205,8 @@ if (!function_exists('aksrt_homepage_render_pagination')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contract = aksrt_homepage_get_latest_panel_contract();
|
||||
aksrt_render_pagination($query, [
|
||||
$contract = jio_homepage_get_latest_panel_contract();
|
||||
jio_render_pagination($query, [
|
||||
'query_context' => $contract['query_context'],
|
||||
'render_config' => $contract['render_config_array'],
|
||||
'current_page' => $current_page,
|
||||
@@ -214,13 +214,13 @@ if (!function_exists('aksrt_homepage_render_pagination')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_get_post_gallery_images')) {
|
||||
if (!function_exists('jio_get_post_gallery_images')) {
|
||||
/**
|
||||
* Collect gallery images for homepage mult-thumb cards.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
function aksrt_get_post_gallery_images(int $post_id, int $limit = 4): array {
|
||||
function jio_get_post_gallery_images(int $post_id, int $limit = 4): array {
|
||||
static $request_cache = [];
|
||||
|
||||
$post_id = max(0, $post_id);
|
||||
@@ -235,7 +235,7 @@ if (!function_exists('aksrt_get_post_gallery_images')) {
|
||||
}
|
||||
|
||||
$modified_gmt = (string) get_post_field('post_modified_gmt', $post_id);
|
||||
$transient_key = 'aksrt_home_gallery_' . $post_id . '_' . md5($modified_gmt !== '' ? $modified_gmt : (string) $post_id);
|
||||
$transient_key = 'jio_home_gallery_' . $post_id . '_' . md5($modified_gmt !== '' ? $modified_gmt : (string) $post_id);
|
||||
$cached_images = get_transient($transient_key);
|
||||
|
||||
if (is_array($cached_images)) {
|
||||
@@ -278,20 +278,20 @@ if (!function_exists('aksrt_get_post_gallery_images')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_render_posts_grid')) {
|
||||
if (!function_exists('jio_homepage_render_posts_grid')) {
|
||||
/**
|
||||
* Render a list block for the fixed homepage.
|
||||
*/
|
||||
function aksrt_homepage_render_posts_grid(?WP_Query $query = null, bool $with_pagination = false): void {
|
||||
$query = $query instanceof WP_Query ? $query : aksrt_homepage_get_latest_query();
|
||||
$config = aksrt_resolve_post_list_render_config(['context' => 'home']);
|
||||
function jio_homepage_render_posts_grid(?WP_Query $query = null, bool $with_pagination = false): void {
|
||||
$query = $query instanceof WP_Query ? $query : jio_homepage_get_latest_query();
|
||||
$config = jio_resolve_post_list_render_config(['context' => 'home']);
|
||||
$config['skip_wrapper'] = true;
|
||||
|
||||
// Panel already provides posts-row.ajaxpager; avoid nested wrapper.
|
||||
aksrt_render_post_list($config, $query, true);
|
||||
jio_render_post_list($config, $query, true);
|
||||
|
||||
if ($with_pagination) {
|
||||
aksrt_homepage_render_pagination($query);
|
||||
jio_homepage_render_pagination($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,14 @@
|
||||
* This is the only header-slider rendering path. It consumes the original
|
||||
* legacy option IDs and the serialized page_config post meta contract.
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_header_slider_device_is_visible')) {
|
||||
if (!function_exists('jio_header_slider_device_is_visible')) {
|
||||
/** @param mixed $value */
|
||||
function aksrt_header_slider_device_is_visible($value): bool {
|
||||
function jio_header_slider_device_is_visible($value): bool {
|
||||
$devices = array_map('sanitize_key', (array) $value);
|
||||
return wp_is_mobile()
|
||||
? in_array('m_s', $devices, true)
|
||||
@@ -20,9 +20,9 @@ if (!function_exists('aksrt_header_slider_device_is_visible')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_header_slide_excluded_page_templates')) {
|
||||
if (!function_exists('jio_header_slide_excluded_page_templates')) {
|
||||
/** @return list<string> */
|
||||
function aksrt_header_slide_excluded_page_templates(): array {
|
||||
function jio_header_slide_excluded_page_templates(): array {
|
||||
return [
|
||||
'templates/pages/page-sign.php',
|
||||
'templates/pages/page-download.php',
|
||||
@@ -31,9 +31,9 @@ if (!function_exists('aksrt_header_slide_excluded_page_templates')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_get_page_header_slider_config')) {
|
||||
if (!function_exists('jio_get_page_header_slider_config')) {
|
||||
/** @return array<string,mixed> */
|
||||
function aksrt_get_page_header_slider_config(): array {
|
||||
function jio_get_page_header_slider_config(): array {
|
||||
if (!is_page()) {
|
||||
return [];
|
||||
}
|
||||
@@ -43,7 +43,7 @@ if (!function_exists('aksrt_get_page_header_slider_config')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_header_slide_current_page_type')) {
|
||||
if (!function_exists('jio_header_slide_current_page_type')) {
|
||||
/**
|
||||
* Resolve one mutually exclusive page type for the header component.
|
||||
*
|
||||
@@ -52,17 +52,17 @@ if (!function_exists('aksrt_header_slide_current_page_type')) {
|
||||
* Utility rewrites (go-link confirm) are error / hand-off surfaces and
|
||||
* opt out entirely, like the excluded templates.
|
||||
*/
|
||||
function aksrt_header_slide_current_page_type(): string {
|
||||
if ((string) get_query_var('aksrt_go_redirect') !== '') {
|
||||
function jio_header_slide_current_page_type(): string {
|
||||
if ((string) get_query_var('jio_go_redirect') !== '') {
|
||||
return '';
|
||||
}
|
||||
if ((string) get_query_var('aksrt_message_view') !== '') {
|
||||
if ((string) get_query_var('jio_message_view') !== '') {
|
||||
return 'page';
|
||||
}
|
||||
if (is_author() || (function_exists('aksrt_is_user_home_page') && aksrt_is_user_home_page())) {
|
||||
if (is_author() || (function_exists('jio_is_user_home_page') && jio_is_user_home_page())) {
|
||||
return 'author';
|
||||
}
|
||||
if (function_exists('aksrt_is_user_center_page') && aksrt_is_user_center_page()) {
|
||||
if (function_exists('jio_is_user_center_page') && jio_is_user_center_page()) {
|
||||
return 'user_center';
|
||||
}
|
||||
if (is_front_page()) {
|
||||
@@ -81,7 +81,7 @@ if (!function_exists('aksrt_header_slide_current_page_type')) {
|
||||
return 'search';
|
||||
}
|
||||
if (is_page()) {
|
||||
foreach (aksrt_header_slide_excluded_page_templates() as $template) {
|
||||
foreach (jio_header_slide_excluded_page_templates() as $template) {
|
||||
if (is_page_template($template)) {
|
||||
return '';
|
||||
}
|
||||
@@ -96,18 +96,18 @@ if (!function_exists('aksrt_header_slide_current_page_type')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_header_slide_matches_query')) {
|
||||
function aksrt_header_slide_matches_query(string $type): bool {
|
||||
if (!function_exists('jio_header_slide_matches_query')) {
|
||||
function jio_header_slide_matches_query(string $type): bool {
|
||||
$type = sanitize_key($type);
|
||||
if ($type === 'user_home') {
|
||||
$type = 'author';
|
||||
}
|
||||
return $type !== '' && $type === aksrt_header_slide_current_page_type();
|
||||
return $type !== '' && $type === jio_header_slide_current_page_type();
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_header_slide_is_show')) {
|
||||
function aksrt_header_slide_is_show(): bool {
|
||||
if (!function_exists('jio_header_slide_is_show')) {
|
||||
function jio_header_slide_is_show(): bool {
|
||||
global $wp_query;
|
||||
|
||||
if (is_admin() || !($wp_query instanceof WP_Query)) {
|
||||
@@ -119,8 +119,8 @@ if (!function_exists('aksrt_header_slide_is_show')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$settings = class_exists('\\AKSRT\\Settings\\Settings')
|
||||
? \AKSRT\Settings\Settings::get_header_slider_settings()
|
||||
$settings = class_exists('\\Jio\\Settings\\Settings')
|
||||
? \Jio\Settings\Settings::get_header_slider_settings()
|
||||
: [];
|
||||
$show_type = sanitize_key((string) ($settings['show_type'] ?? ''));
|
||||
if (($show_type === 'only_pc' && wp_is_mobile()) || ($show_type === 'only_sm' && !wp_is_mobile())) {
|
||||
@@ -129,7 +129,7 @@ if (!function_exists('aksrt_header_slide_is_show')) {
|
||||
|
||||
$matches_global_scope = false;
|
||||
foreach ((array) ($settings['show_on_pages'] ?? []) as $type) {
|
||||
if (aksrt_header_slide_matches_query((string) $type)) {
|
||||
if (jio_header_slide_matches_query((string) $type)) {
|
||||
$matches_global_scope = true;
|
||||
break;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ if (!function_exists('aksrt_header_slide_is_show')) {
|
||||
|
||||
// Per-page data may customize an already-enabled component, but it must
|
||||
// never bypass the global page scope selected in the theme settings.
|
||||
$page_config = aksrt_get_page_header_slider_config();
|
||||
$page_config = jio_get_page_header_slider_config();
|
||||
if ($page_config) {
|
||||
$page_show_type = sanitize_key((string) ($page_config['header_slider_show_type'] ?? ''));
|
||||
return !($page_show_type === 'only_pc' && wp_is_mobile())
|
||||
@@ -151,10 +151,10 @@ if (!function_exists('aksrt_header_slide_is_show')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_get_header_slider_args')) {
|
||||
if (!function_exists('jio_get_header_slider_args')) {
|
||||
/** @return array<string,mixed> */
|
||||
function aksrt_get_header_slider_args(): array {
|
||||
$page_config = aksrt_get_page_header_slider_config();
|
||||
function jio_get_header_slider_args(): array {
|
||||
$page_config = jio_get_page_header_slider_config();
|
||||
if ($page_config) {
|
||||
return [
|
||||
'header_slider' => (array) ($page_config['header_slider'] ?? []),
|
||||
@@ -168,8 +168,8 @@ if (!function_exists('aksrt_get_header_slider_args')) {
|
||||
];
|
||||
}
|
||||
|
||||
$settings = class_exists('\\AKSRT\\Settings\\Settings')
|
||||
? \AKSRT\Settings\Settings::get_header_slider_settings()
|
||||
$settings = class_exists('\\Jio\\Settings\\Settings')
|
||||
? \Jio\Settings\Settings::get_header_slider_settings()
|
||||
: [];
|
||||
return [
|
||||
'header_slider' => (array) ($settings['slides'] ?? []),
|
||||
@@ -184,9 +184,9 @@ if (!function_exists('aksrt_get_header_slider_args')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_header_slider_allowed_html')) {
|
||||
if (!function_exists('jio_header_slider_allowed_html')) {
|
||||
/** @return array<string,array<string,bool>> */
|
||||
function aksrt_header_slider_allowed_html(): array {
|
||||
function jio_header_slider_allowed_html(): array {
|
||||
return [
|
||||
'a' => ['href' => true, 'target' => true, 'rel' => true, 'class' => true],
|
||||
'b' => ['class' => true],
|
||||
@@ -202,21 +202,21 @@ if (!function_exists('aksrt_header_slider_allowed_html')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_header_slider_image')) {
|
||||
if (!function_exists('jio_header_slider_image')) {
|
||||
/** @param string $src @param string $class @param string $alt */
|
||||
function aksrt_header_slider_image(string $src, string $class, string $alt): string {
|
||||
$lazy = function_exists('aksrt_is_lazy') && aksrt_is_lazy('lazy_sider');
|
||||
function jio_header_slider_image(string $src, string $class, string $alt): string {
|
||||
$lazy = function_exists('jio_is_lazy') && jio_is_lazy('lazy_sider');
|
||||
if ($lazy) {
|
||||
$class .= ' swiper-lazy';
|
||||
}
|
||||
$attrs = aksrt_get_lazy_attr('lazy_sider', $src, $class, aksrt_get_lazy_thumb('lg'));
|
||||
$attrs = jio_get_lazy_attr('lazy_sider', $src, $class, jio_get_lazy_thumb('lg'));
|
||||
return '<img' . $attrs . ' alt="' . esc_attr($alt) . '">';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_get_header_slider_markup')) {
|
||||
if (!function_exists('jio_get_header_slider_markup')) {
|
||||
/** @param array<string,mixed> $options */
|
||||
function aksrt_get_header_slider_markup(array $options): string {
|
||||
function jio_get_header_slider_markup(array $options): string {
|
||||
$options = wp_parse_args($options, [
|
||||
'class' => 'slide-index slide-header',
|
||||
'direction' => 'horizontal',
|
||||
@@ -243,10 +243,10 @@ if (!function_exists('aksrt_get_header_slider_markup')) {
|
||||
}
|
||||
|
||||
$is_mobile = wp_is_mobile();
|
||||
$lazy = function_exists('aksrt_is_lazy') && aksrt_is_lazy('lazy_sider');
|
||||
$lazy = function_exists('jio_is_lazy') && jio_is_lazy('lazy_sider');
|
||||
$slides_html = '';
|
||||
$slide_count = 0;
|
||||
$allow = aksrt_header_slider_allowed_html();
|
||||
$allow = jio_header_slider_allowed_html();
|
||||
$site_suffix = ' - ' . get_bloginfo('name');
|
||||
|
||||
foreach ((array) $options['slides'] as $slide) {
|
||||
@@ -268,7 +268,7 @@ if (!function_exists('aksrt_get_header_slider_markup')) {
|
||||
if ($alt === '') {
|
||||
$alt = trim(wp_strip_all_tags((string) ($link['text'] ?? '')));
|
||||
}
|
||||
$alt = $alt !== '' ? $alt . $site_suffix : __('幻灯片', 'aksrt') . $site_suffix;
|
||||
$alt = $alt !== '' ? $alt . $site_suffix : __('幻灯片', 'jio') . $site_suffix;
|
||||
$slide_class = trim((string) ($slide['class'] ?? ''));
|
||||
$background_html = '';
|
||||
|
||||
@@ -284,11 +284,11 @@ if (!function_exists('aksrt_get_header_slider_markup')) {
|
||||
$poster_class = 'absolute dplayer-poster' . (!empty($options['gradient_bg']) ? ' gradient-bg' : '');
|
||||
$poster_attrs = !empty($options['gradient_bg']) ? ' data-opacity="0.2"' : '';
|
||||
$background_html .= '<div class="' . esc_attr($poster_class) . '"' . $poster_attrs . '>'
|
||||
. aksrt_header_slider_image($background, 'no-imgbox radius8', $alt)
|
||||
. jio_header_slider_image($background, 'no-imgbox radius8', $alt)
|
||||
. '<div class="absolute flex jc play-icon"><span class="toggle-radius"><i class="fas fa-play" aria-hidden="true"></i></span></div></div>';
|
||||
}
|
||||
} elseif ($background !== '') {
|
||||
$background_html = aksrt_header_slider_image($background, 'radius8', $alt);
|
||||
$background_html = jio_header_slider_image($background, 'radius8', $alt);
|
||||
}
|
||||
|
||||
if ($background_html === '') {
|
||||
@@ -297,7 +297,7 @@ if (!function_exists('aksrt_get_header_slider_markup')) {
|
||||
|
||||
$blur_html = '';
|
||||
if (!empty($options['blur_bg']) && $background !== '') {
|
||||
$blur_html = '<div class="slide-blur-bg">' . aksrt_header_slider_image($background, 'no-imgbox', $alt) . '</div>';
|
||||
$blur_html = '<div class="slide-blur-bg">' . jio_header_slider_image($background, 'no-imgbox', $alt) . '</div>';
|
||||
}
|
||||
|
||||
$layers_html = '';
|
||||
@@ -323,7 +323,7 @@ if (!function_exists('aksrt_get_header_slider_markup')) {
|
||||
if ($scale !== 100) {
|
||||
$layer_attrs .= ' data-swiper-parallax-scale="' . esc_attr((string) ($scale / 100)) . '"';
|
||||
}
|
||||
$layers_html .= '<div class="' . esc_attr($layer_class) . '"' . $layer_attrs . '>' . aksrt_header_slider_image((string) $layer['image'], 'radius8', $alt) . '</div>';
|
||||
$layers_html .= '<div class="' . esc_attr($layer_class) . '"' . $layer_attrs . '>' . jio_header_slider_image((string) $layer['image'], 'radius8', $alt) . '</div>';
|
||||
}
|
||||
|
||||
$text_html = '';
|
||||
@@ -397,18 +397,18 @@ if (!function_exists('aksrt_get_header_slider_markup')) {
|
||||
$controls .= '<div class="swiper-pagination kaoyou' . esc_attr($pagination_class) . '"></div>';
|
||||
}
|
||||
|
||||
return '<div class="relative aksrt-slider"><div class="new-swiper ' . esc_attr(trim($class)) . '"' . $attrs . ' style="' . esc_attr($style) . '"><div class="swiper-wrapper">'
|
||||
return '<div class="relative jio-slider"><div class="new-swiper ' . esc_attr(trim($class)) . '"' . $attrs . ' style="' . esc_attr($style) . '"><div class="swiper-wrapper">'
|
||||
. $slides_html . '</div>' . $controls . '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_header_slide')) {
|
||||
function aksrt_header_slide(): void {
|
||||
if (!aksrt_header_slide_is_show()) {
|
||||
if (!function_exists('jio_header_slide')) {
|
||||
function jio_header_slide(): void {
|
||||
if (!jio_header_slide_is_show()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$args = aksrt_get_header_slider_args();
|
||||
$args = jio_get_header_slider_args();
|
||||
$slides = (array) ($args['header_slider'] ?? []);
|
||||
$options = (array) ($args['header_slider_option'] ?? []);
|
||||
if (empty($slides[0])) {
|
||||
@@ -418,7 +418,7 @@ if (!function_exists('aksrt_header_slide')) {
|
||||
$options['class'] = 'slide-index slide-header';
|
||||
|
||||
$search_html = '';
|
||||
if (aksrt_header_slider_device_is_visible($args['header_slider_search_s'] ?? [])) {
|
||||
if (jio_header_slider_device_is_visible($args['header_slider_search_s'] ?? [])) {
|
||||
$search_options = wp_parse_args((array) ($args['header_slider_search_option'] ?? []), [
|
||||
'class' => '', 'show_keywords' => false, 'show_history' => false,
|
||||
'show_posts' => false, 'show_input_cat' => false, 'more_cats' => [],
|
||||
@@ -428,21 +428,21 @@ if (!function_exists('aksrt_header_slide')) {
|
||||
if (wp_is_mobile()) {
|
||||
$search_options['show_keywords'] = false;
|
||||
}
|
||||
$before = $search_options['before_html'] !== '' ? '<div class="header-slider-search-more text-center before">' . wp_kses((string) $search_options['before_html'], aksrt_header_slider_allowed_html()) . '</div>' : '';
|
||||
$after = $search_options['after_html'] !== '' ? '<div class="header-slider-search-more after">' . wp_kses((string) $search_options['after_html'], aksrt_header_slider_allowed_html()) . '</div>' : '';
|
||||
$before = $search_options['before_html'] !== '' ? '<div class="header-slider-search-more text-center before">' . wp_kses((string) $search_options['before_html'], jio_header_slider_allowed_html()) . '</div>' : '';
|
||||
$after = $search_options['after_html'] !== '' ? '<div class="header-slider-search-more after">' . wp_kses((string) $search_options['after_html'], jio_header_slider_allowed_html()) . '</div>' : '';
|
||||
unset($search_options['before_html'], $search_options['after_html']);
|
||||
$box = function_exists('aksrt_get_search_box') ? (string) aksrt_get_search_box($search_options) : '';
|
||||
$box = function_exists('jio_get_search_box') ? (string) jio_get_search_box($search_options) : '';
|
||||
$search_html = '<div class="header-slider-search abs-center">' . $before . $box . $after . '</div>';
|
||||
}
|
||||
|
||||
$cards_html = '';
|
||||
$card_count = 0;
|
||||
if (aksrt_header_slider_device_is_visible($args['header_slider_card_s'] ?? [])) {
|
||||
if (jio_header_slider_device_is_visible($args['header_slider_card_s'] ?? [])) {
|
||||
$card_options = wp_parse_args((array) ($args['header_slider_card_option'] ?? []), [
|
||||
'icon_radius4' => false, 'show_widget_bg' => false, 'cards' => [],
|
||||
]);
|
||||
// legacy (Zibll): with module background the card shrinks to
|
||||
// padding-10 inside a .zib-widget wrapper (.aksrt-panel here); the
|
||||
// padding-10 inside a .zib-widget wrapper (.jio-panel here); the
|
||||
// bg-less variant stretches each card in a .flex1 column.
|
||||
$show_bg = !empty($card_options['show_widget_bg']);
|
||||
$items = '';
|
||||
@@ -450,9 +450,9 @@ if (!function_exists('aksrt_header_slide')) {
|
||||
if (!is_array($card) || (empty($card['icon']) && empty($card['customize_icon']) && empty($card['custom_icon']) && empty($card['icon_image']))) {
|
||||
continue;
|
||||
}
|
||||
$card['class'] = $show_bg ? 'padding-10' : 'aksrt-panel';
|
||||
$card['class'] = $show_bg ? 'padding-10' : 'jio-panel';
|
||||
$card['icon_class'] = trim((string) ($card['icon_class'] ?? '') . (!empty($card_options['icon_radius4']) ? ' radius4' : ''));
|
||||
$inner = function_exists('aksrt_icon_cover_card') ? aksrt_icon_cover_card($card) : '';
|
||||
$inner = function_exists('jio_icon_cover_card') ? jio_icon_cover_card($card) : '';
|
||||
if ($inner === '') {
|
||||
continue;
|
||||
}
|
||||
@@ -461,19 +461,19 @@ if (!function_exists('aksrt_header_slide')) {
|
||||
}
|
||||
if ($items !== '') {
|
||||
$cards_html = '<div class="header-slider-card container">'
|
||||
. ($show_bg ? '<div class="aksrt-panel padding-10">' : '<div class="">')
|
||||
. ($show_bg ? '<div class="jio-panel padding-10">' : '<div class="">')
|
||||
. '<div class="flex jse flex-row gutters-5 flex-col-sm-2">' . $items . '</div></div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$nav_color = \AKSRT\Core\Color::sanitize((string) ($args['header_slider_nav_color'] ?? ''));
|
||||
$nav_color = \Jio\Core\Color::sanitize((string) ($args['header_slider_nav_color'] ?? ''));
|
||||
if ($nav_color && $nav_color !== '#ffffff') {
|
||||
echo '<style>body.nav-fixed:not(.body-scroll):not(.mobile-navbar-show) .header.show-slide{--header-color:' . esc_html($nav_color) . ';}</style>';
|
||||
}
|
||||
|
||||
$settings = class_exists('\\AKSRT\\Settings\\Settings') ? \AKSRT\Settings\Settings::get_header_slider_settings() : [];
|
||||
$filter_blur = aksrt_header_slider_device_is_visible($settings['filter_blur'] ?? []);
|
||||
$slider_html = aksrt_get_header_slider_markup($options);
|
||||
$settings = class_exists('\\Jio\\Settings\\Settings') ? \Jio\Settings\Settings::get_header_slider_settings() : [];
|
||||
$filter_blur = jio_header_slider_device_is_visible($settings['filter_blur'] ?? []);
|
||||
$slider_html = jio_get_header_slider_markup($options);
|
||||
if ($slider_html === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
/**
|
||||
* Fixed homepage layout renderer.
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_homepage_render_layout')) {
|
||||
if (!function_exists('jio_homepage_render_layout')) {
|
||||
/**
|
||||
* Render the fixed homepage layout (legacy latest-first content stream).
|
||||
*
|
||||
@@ -15,82 +15,82 @@ if (!function_exists('aksrt_homepage_render_layout')) {
|
||||
* fluid top → main.container → top content → tabs/list → bottom content → sidebar
|
||||
* → fluid bottom. Hero/header-slider is rendered from header.php, not here.
|
||||
*/
|
||||
function aksrt_homepage_render_layout(): void {
|
||||
$main_list_enabled = !class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::home_posts_list_enabled();
|
||||
function jio_homepage_render_layout(): void {
|
||||
$main_list_enabled = !class_exists('\Jio\Settings\Settings') || \Jio\Settings\Settings::home_posts_list_enabled();
|
||||
|
||||
// Fluid zones live outside <main>, once only (removed from header.php).
|
||||
aksrt_homepage_render_widget_zone(
|
||||
jio_homepage_render_widget_zone(
|
||||
['home_top_fluid'],
|
||||
'fluid-widget-wrap aksrt-homepage__fluid-zone aksrt-homepage__fluid-zone--top'
|
||||
'fluid-widget-wrap jio-homepage__fluid-zone jio-homepage__fluid-zone--top'
|
||||
);
|
||||
?>
|
||||
<main id="main-content" role="main" class="container site-main aksrt-homepage" tabindex="-1">
|
||||
<div class="content-wrap aksrt-homepage__shell">
|
||||
<div class="content-layout aksrt-homepage__content-layout aksrt-homepage__primary">
|
||||
<main id="main-content" role="main" class="container site-main jio-homepage" tabindex="-1">
|
||||
<div class="content-wrap jio-homepage__shell">
|
||||
<div class="content-layout jio-homepage__content-layout jio-homepage__primary">
|
||||
<?php
|
||||
aksrt_homepage_render_widget_zone(
|
||||
jio_homepage_render_widget_zone(
|
||||
['home_top_content'],
|
||||
'aksrt-homepage__content-zone aksrt-homepage__content-zone--top'
|
||||
'jio-homepage__content-zone jio-homepage__content-zone--top'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($main_list_enabled) :
|
||||
$tab_configs = aksrt_homepage_get_current_page() === 1 ? aksrt_homepage_get_tab_configs() : [];
|
||||
$tab_configs = jio_homepage_get_current_page() === 1 ? jio_homepage_get_tab_configs() : [];
|
||||
?>
|
||||
<div class="home-tab-content">
|
||||
<?php echo aksrt_homepage_get_tab_header_html($tab_configs); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php echo jio_homepage_get_tab_header_html($tab_configs); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<div class="tab-content">
|
||||
<div class="posts-row ajaxpager tab-pane fade in active" id="index-tab-main">
|
||||
<?php aksrt_homepage_render_ajax_option_menu(); ?>
|
||||
<?php aksrt_homepage_render_posts_grid(aksrt_homepage_get_latest_query(), true); ?>
|
||||
<?php jio_homepage_render_ajax_option_menu(); ?>
|
||||
<?php jio_homepage_render_posts_grid(jio_homepage_get_latest_query(), true); ?>
|
||||
</div>
|
||||
<?php echo aksrt_homepage_get_tab_panes_html($tab_configs); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php echo jio_homepage_get_tab_panes_html($tab_configs); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
aksrt_homepage_render_widget_zone(
|
||||
jio_homepage_render_widget_zone(
|
||||
['home_bottom_content'],
|
||||
'aksrt-homepage__content-zone aksrt-homepage__content-zone--bottom'
|
||||
'jio-homepage__content-zone jio-homepage__content-zone--bottom'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php aksrt_homepage_render_sidebar(); ?>
|
||||
<?php jio_homepage_render_sidebar(); ?>
|
||||
</main>
|
||||
<?php
|
||||
aksrt_homepage_render_widget_zone(
|
||||
jio_homepage_render_widget_zone(
|
||||
['home_bottom_fluid'],
|
||||
'fluid-widget-wrap aksrt-homepage__fluid-zone aksrt-homepage__fluid-zone--bottom'
|
||||
'fluid-widget-wrap jio-homepage__fluid-zone jio-homepage__fluid-zone--bottom'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_get_tab_header_html')) {
|
||||
if (!function_exists('jio_homepage_get_tab_header_html')) {
|
||||
/**
|
||||
* legacy zib_index_tab_html:tab 导航 / 翻页标题条 / 空占位 三态。
|
||||
*
|
||||
* @param array<int, array<string, mixed>> $tab_configs Configured term tabs.
|
||||
*/
|
||||
function aksrt_homepage_get_tab_header_html(array $tab_configs): string {
|
||||
$list_title = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::home_list_title()
|
||||
function jio_homepage_get_tab_header_html(array $tab_configs): string {
|
||||
$list_title = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::home_list_title()
|
||||
: '';
|
||||
$fallback_title = $list_title !== '' ? $list_title : __('最新发布', 'aksrt');
|
||||
$paged = aksrt_homepage_get_current_page();
|
||||
$fallback_title = $list_title !== '' ? $list_title : __('最新发布', 'jio');
|
||||
$paged = jio_homepage_get_current_page();
|
||||
|
||||
//不是第一页
|
||||
if ($paged > 1) {
|
||||
return '<div class="box-body notop nobottom"><div class="title-theme">' . $fallback_title
|
||||
. '<small class="ml10">' . esc_html(sprintf(__('第%s页', 'aksrt'), $paged)) . '</small></div></div>';
|
||||
. '<small class="ml10">' . esc_html(sprintf(__('第%s页', 'jio'), $paged)) . '</small></div></div>';
|
||||
}
|
||||
|
||||
$index_tab_nav = '';
|
||||
foreach ($tab_configs as $index => $tab_cfg) {
|
||||
$index_tab_nav .= '<li><a data-toggle="tab" data-ajax="' . esc_url(aksrt_homepage_get_tab_link($tab_cfg))
|
||||
$index_tab_nav .= '<li><a data-toggle="tab" data-ajax="' . esc_url(jio_homepage_get_tab_link($tab_cfg))
|
||||
. '" href="#index-tab-' . (int) $index . '">' . wp_kses_post($tab_cfg['title']) . '</a></li>';
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ if (!function_exists('aksrt_homepage_get_tab_header_html')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_get_tab_panes_html')) {
|
||||
if (!function_exists('jio_homepage_get_tab_panes_html')) {
|
||||
/**
|
||||
* legacy zib_index_tab('content'):每个栏目的原位刷新 pane。
|
||||
*
|
||||
@@ -115,18 +115,18 @@ if (!function_exists('aksrt_homepage_get_tab_panes_html')) {
|
||||
*
|
||||
* @param array<int, array<string, mixed>> $tab_configs Configured term tabs.
|
||||
*/
|
||||
function aksrt_homepage_get_tab_panes_html(array $tab_configs): string {
|
||||
function jio_homepage_get_tab_panes_html(array $tab_configs): string {
|
||||
if (!$tab_configs) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$html = '';
|
||||
foreach ($tab_configs as $index => $tab_cfg) {
|
||||
$config = aksrt_archive_get_render_config(['context' => 'category', 'term_id' => (int) $tab_cfg['term_id']]);
|
||||
$config = jio_archive_get_render_config(['context' => 'category', 'term_id' => (int) $tab_cfg['term_id']]);
|
||||
$is_card = ($config['mode'] ?? 'list') === 'card';
|
||||
$placeholder = aksrt_render_placeholder($is_card ? 'card' : 'list', $is_card ? (wp_is_mobile() ? 4 : 12) : (wp_is_mobile() ? 4 : 6));
|
||||
$placeholder = jio_render_placeholder($is_card ? 'card' : 'list', $is_card ? (wp_is_mobile() ? 4 : 12) : (wp_is_mobile() ? 4 : 6));
|
||||
$html .= '<div class="ajaxpager tab-pane fade" id="index-tab-' . (int) $index . '">';
|
||||
$html .= '<span class="post_ajax_trigger"><a class="ajax_load ajax-next ajax-open" href="' . esc_url(aksrt_homepage_get_tab_link($tab_cfg)) . '"></a></span>';
|
||||
$html .= '<span class="post_ajax_trigger"><a class="ajax_load ajax-next ajax-open" href="' . esc_url(jio_homepage_get_tab_link($tab_cfg)) . '"></a></span>';
|
||||
$html .= '<div class="post_ajax_loader">' . $placeholder . '</div>';
|
||||
$html .= '</div>';
|
||||
}
|
||||
@@ -135,13 +135,13 @@ if (!function_exists('aksrt_homepage_get_tab_panes_html')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_homepage_get_tab_link')) {
|
||||
if (!function_exists('jio_homepage_get_tab_link')) {
|
||||
/**
|
||||
* 栏目 tab 的加载链接:栏目页 + nofilter(抑制响应页的筛选菜单)。
|
||||
*
|
||||
* @param array<string, mixed> $tab_cfg Tab config with term and orderby.
|
||||
*/
|
||||
function aksrt_homepage_get_tab_link(array $tab_cfg): string {
|
||||
function jio_homepage_get_tab_link(array $tab_cfg): string {
|
||||
$term = $tab_cfg['term'] ?? null;
|
||||
if (!$term instanceof WP_Term) {
|
||||
return home_url('/');
|
||||
@@ -161,17 +161,17 @@ if (!function_exists('aksrt_homepage_get_tab_link')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_render_fixed_homepage')) {
|
||||
if (!function_exists('jio_render_fixed_homepage')) {
|
||||
/**
|
||||
* Render the new fixed homepage layout.
|
||||
*/
|
||||
function aksrt_render_fixed_homepage(): bool {
|
||||
if (!aksrt_is_fixed_homepage_request()) {
|
||||
function jio_render_fixed_homepage(): bool {
|
||||
if (!jio_is_fixed_homepage_request()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
get_header();
|
||||
aksrt_homepage_render_layout();
|
||||
jio_homepage_render_layout();
|
||||
get_footer();
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user