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>
110 lines
5.8 KiB
PHP
110 lines
5.8 KiB
PHP
<?php
|
|
/** Render thumbnail settings and image markup without a WordPress installation. */
|
|
declare(strict_types=1);
|
|
|
|
namespace Jio\Settings {
|
|
final class Settings {
|
|
public static array $values = [];
|
|
public static function get_all(): array { return self::$values; }
|
|
public static function get_post_list_style_settings(): array { return PostDisplay::get_post_list_style_settings(); }
|
|
public static function logo_url(): string { return ''; }
|
|
public static function logo_dark_url(): string { return ''; }
|
|
public static function favicon_url(): string { return ''; }
|
|
public static function theme_color(): string { return '#f04494'; }
|
|
public static function dark_theme_color(): string { return '#abcdef'; }
|
|
public static function main_radius(): int { return 8; }
|
|
public static function container_max_width(): int { return 1200; }
|
|
public static function font_family(): string { return 'system'; }
|
|
public static function font_family_custom(): string { return ''; }
|
|
public static function logo_width(): int { return 150; }
|
|
public static function get_sidebar_config(): array { return ['width' => 311]; }
|
|
public static function get_header_theme_config(): array { return []; }
|
|
public static function background_css(string $key): string { return ''; }
|
|
}
|
|
}
|
|
|
|
namespace Jio\Core {
|
|
final class PostMetaBox {
|
|
public static array $meta = [];
|
|
public static function get_meta_value(int $id, string $key, $default = '') { return self::$meta[$key] ?? $default; }
|
|
}
|
|
}
|
|
|
|
namespace {
|
|
define('ABSPATH', dirname(__DIR__, 2) . DIRECTORY_SEPARATOR);
|
|
set_error_handler(static function (int $severity, string $message, string $file, int $line): bool {
|
|
if (!(error_reporting() & $severity)) return false;
|
|
throw new \ErrorException($message, 0, $severity, $file, $line);
|
|
});
|
|
function __($text, $domain = ''): string { return (string) $text; }
|
|
function esc_html($text): string { return htmlspecialchars((string) $text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); }
|
|
function esc_attr($text): string { return esc_html($text); }
|
|
function esc_url($url): string { return esc_attr($url); }
|
|
function esc_url_raw($url): string { return (string) $url; }
|
|
function sanitize_key($value): string { return preg_replace('/[^a-z0-9_-]/', '', strtolower((string) $value)); }
|
|
function wp_kses_post($html): string { return (string) $html; }
|
|
function strip_shortcodes($content): string { return (string) $content; }
|
|
function wp_strip_all_tags($content): string { return strip_tags((string) $content); }
|
|
function get_post_thumbnail_id($id): int { return $GLOBALS['featured_id']; }
|
|
function attachment_url_to_postid($url): int { return 0; }
|
|
function wp_get_attachment_image_url($id, $size) {
|
|
return $id === 42 ? 'https://example.test/featured-' . $size . '.jpg' : false;
|
|
}
|
|
function get_post_field($field, $id, $context = ''): string { return $GLOBALS['post_content']; }
|
|
function get_the_category($id): array { return []; }
|
|
function get_post_format($id = null) { return false; }
|
|
function jio_get_lazy_thumb($size = ''): string { return 'https://example.test/placeholder.svg'; }
|
|
function jio_is_lazy($key): bool { return $key === 'lazy_sider'; }
|
|
function jio_get_lazy_attr($key, $src, $class = ''): string {
|
|
if (jio_is_lazy($key)) {
|
|
return ' class="lazyload ' . esc_attr($class) . '" src="' . jio_get_lazy_thumb() . '" data-src="' . esc_url($src) . '"';
|
|
}
|
|
return ' class="' . esc_attr($class) . '" src="' . esc_url($src) . '"';
|
|
}
|
|
|
|
require ABSPATH . 'src/Settings/PostDisplay.php';
|
|
require ABSPATH . 'src/Frontend/InlineStyleBuilder.php';
|
|
require ABSPATH . 'inc/helpers/posts-renderer/config.php';
|
|
require ABSPATH . 'inc/helpers/posts-renderer/post-data.php';
|
|
|
|
$styles = [];
|
|
foreach (['defaults' => [], 'custom' => ['list_list_option' => ['scale' => 100], 'list_card_option' => ['scale' => 56]], 'bounds' => ['list_list_option' => ['scale' => 1], 'list_card_option' => ['scale' => 900]]] as $name => $values) {
|
|
\Jio\Settings\Settings::$values = $values;
|
|
ob_start();
|
|
(new \Jio\Frontend\InlineStyleBuilder())->output();
|
|
$styles[$name] = (string) ob_get_clean();
|
|
}
|
|
|
|
$GLOBALS['featured_id'] = 42;
|
|
$GLOBALS['post_content'] = '<p><img src="https://example.test/content.jpg"></p>';
|
|
\Jio\Core\PostMetaBox::$meta = ['thumbnail_url' => 'https://example.test/external.jpg'];
|
|
$cfg = ['thumb' => ['thumb_postfirstimg_size' => 'large', 'thumb_postfirstimg_s' => true, 'spare_thumbnail' => ['https://example.test/spare.jpg']]];
|
|
$featured = jio_renderer_resolve_images(1, $cfg);
|
|
$GLOBALS['featured_id'] = 999;
|
|
$external = jio_renderer_resolve_images(1, $cfg);
|
|
\Jio\Core\PostMetaBox::$meta = [];
|
|
$content = jio_renderer_resolve_images(1, $cfg);
|
|
$GLOBALS['post_content'] = '';
|
|
$spare = jio_renderer_resolve_images(1, $cfg);
|
|
\Jio\Core\PostMetaBox::$meta = ['featured_slide' => '999,42'];
|
|
$slides = jio_renderer_curated_images(1, 'medium');
|
|
|
|
$data = [
|
|
'post_id' => 1, 'primary' => $featured['primary'], 'has_real' => true,
|
|
'permalink' => 'https://example.test/post/', 'title' => 'Featured image',
|
|
'video_url' => '', 'slides' => [], 'gallery_count' => 0,
|
|
];
|
|
$cover = jio_renderer_thumb($data, ['thumb' => ['list_thumb_fit' => '']]);
|
|
$contain = jio_renderer_thumb($data, ['thumb' => ['list_thumb_fit' => 'contain']]);
|
|
$data['is_slide'] = true;
|
|
$data['slides'] = ['https://example.test/slide.jpg'];
|
|
$single = jio_renderer_thumb($data, ['thumb' => []]);
|
|
\Jio\Core\PostMetaBox::$meta = ['featured_slide' => implode(',', array_fill(0, 12, '42'))];
|
|
$data['slides'] = jio_renderer_curated_images(1, 'large');
|
|
$multiple = jio_renderer_thumb($data, ['thumb' => ['list_thumb_fit' => 'contain']]);
|
|
$data['video_url'] = 'https://example.test/movie.mp4';
|
|
$video = jio_renderer_thumb($data, ['thumb' => ['list_thumb_video_s' => true, 'list_thumb_video_mute_s' => true]]);
|
|
|
|
echo json_encode(compact('styles', 'featured', 'external', 'content', 'spare', 'slides', 'cover', 'contain', 'single', 'multiple', 'video'), JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
|
|
}
|