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
+26
-26
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
namespace AKSRT\Admin;
|
||||
namespace Jio\Admin;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
@@ -52,8 +52,8 @@ class AIController extends ControllerBase {
|
||||
if (current_user_can('edit_posts')) {
|
||||
return true;
|
||||
}
|
||||
if (class_exists('\AKSRT\Core\FrontSubmit')) {
|
||||
return (bool) \AKSRT\Core\FrontSubmit::get_instance()->can_submit();
|
||||
if (class_exists('\Jio\Core\FrontSubmit')) {
|
||||
return (bool) \Jio\Core\FrontSubmit::get_instance()->can_submit();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -62,8 +62,8 @@ class AIController extends ControllerBase {
|
||||
* POST /ai/seo-generate — 从 post/term 实体生成 SEO 三字段。
|
||||
*/
|
||||
public function seo_generate(\WP_REST_Request $request): \WP_REST_Response {
|
||||
if (!class_exists('\AKSRT\Ai\AISEO')) {
|
||||
return $this->error(__('AI SEO 模块未加载', 'aksrt'), 500);
|
||||
if (!class_exists('\Jio\Ai\AISEO')) {
|
||||
return $this->error(__('AI SEO 模块未加载', 'jio'), 500);
|
||||
}
|
||||
|
||||
$params = $this->get_json_params($request);
|
||||
@@ -71,30 +71,30 @@ class AIController extends ControllerBase {
|
||||
$id = absint($params['id'] ?? 0);
|
||||
|
||||
if (!in_array($type, ['post', 'term'], true) || $id <= 0) {
|
||||
return $this->error(__('参数错误', 'aksrt'), 422);
|
||||
return $this->error(__('参数错误', 'jio'), 422);
|
||||
}
|
||||
|
||||
if ($type === 'post') {
|
||||
if (!current_user_can('edit_post', $id)) {
|
||||
return $this->error(__('权限不足,无法编辑此文章', 'aksrt'), 403);
|
||||
return $this->error(__('权限不足,无法编辑此文章', 'jio'), 403);
|
||||
}
|
||||
} else {
|
||||
if (!current_user_can('edit_term', $id)) {
|
||||
return $this->error(__('权限不足,无法编辑此分类/标签', 'aksrt'), 403);
|
||||
return $this->error(__('权限不足,无法编辑此分类/标签', 'jio'), 403);
|
||||
}
|
||||
}
|
||||
|
||||
$result = \AKSRT\Ai\AISEO::get_instance()->generate_fields($type, $id);
|
||||
$result = \Jio\Ai\AISEO::get_instance()->generate_fields($type, $id);
|
||||
if (empty($result['success'])) {
|
||||
return $this->error((string) ($result['message'] ?? __('生成失败', 'aksrt')));
|
||||
return $this->error((string) ($result['message'] ?? __('生成失败', 'jio')));
|
||||
}
|
||||
|
||||
return $this->success(['data' => $result['data']]);
|
||||
}
|
||||
|
||||
public function summary_suggest(\WP_REST_Request $request): \WP_REST_Response {
|
||||
if (!class_exists('\AKSRT\Ai\AI') || !class_exists('\AKSRT\Ai\AIPrompt')) {
|
||||
return $this->error(__('AI 模块未加载', 'aksrt'), 500);
|
||||
if (!class_exists('\Jio\Ai\AI') || !class_exists('\Jio\Ai\AIPrompt')) {
|
||||
return $this->error(__('AI 模块未加载', 'jio'), 500);
|
||||
}
|
||||
|
||||
$params = $this->get_json_params($request);
|
||||
@@ -114,19 +114,19 @@ class AIController extends ControllerBase {
|
||||
$max_len = max(50, min(500, (int) ($params['max_length'] ?? 200)));
|
||||
|
||||
if ($content === '') {
|
||||
return $this->error(__('内容不能为空,请先在编辑器填写正文后再生成摘要', 'aksrt'), 422);
|
||||
return $this->error(__('内容不能为空,请先在编辑器填写正文后再生成摘要', 'jio'), 422);
|
||||
}
|
||||
|
||||
$ai = \AKSRT\Ai\AI::get_instance();
|
||||
$ai = \Jio\Ai\AI::get_instance();
|
||||
if (!$ai->is_available()) {
|
||||
return $this->error(
|
||||
__('AI 服务不可用,请配置 WordPress AI Connectors。', 'aksrt'),
|
||||
__('AI 服务不可用,请配置 WordPress AI Connectors。', 'jio'),
|
||||
503
|
||||
);
|
||||
}
|
||||
|
||||
// Prefer excerpt-oriented prompt when title is present.
|
||||
$prompt_builder = \AKSRT\Ai\AIPrompt::get_instance();
|
||||
$prompt_builder = \Jio\Ai\AIPrompt::get_instance();
|
||||
if ($title !== '' && method_exists($prompt_builder, 'build_excerpt_prompt')) {
|
||||
$prompt = $prompt_builder->build_excerpt_prompt($title, $content);
|
||||
} else {
|
||||
@@ -136,13 +136,13 @@ class AIController extends ControllerBase {
|
||||
$result = $ai->generate_text($prompt, [
|
||||
'max_tokens' => min(600, max(120, $max_len * 2)),
|
||||
'temperature' => 0.5,
|
||||
'system_instruction' => __('你是中文内容编辑,只输出摘要正文,不要标题、前缀或 Markdown。', 'aksrt'),
|
||||
'system_instruction' => __('你是中文内容编辑,只输出摘要正文,不要标题、前缀或 Markdown。', 'jio'),
|
||||
]);
|
||||
|
||||
if (!empty($result['success'])) {
|
||||
$summary = trim((string) ($result['content'] ?? ''));
|
||||
if ($summary === '') {
|
||||
return $this->error(__('AI 返回内容为空,请稍后重试或检查模型配置', 'aksrt'), 502);
|
||||
return $this->error(__('AI 返回内容为空,请稍后重试或检查模型配置', 'jio'), 502);
|
||||
}
|
||||
// Soft trim to requested length (characters).
|
||||
if (function_exists('mb_substr') && mb_strlen($summary) > $max_len + 20) {
|
||||
@@ -158,7 +158,7 @@ class AIController extends ControllerBase {
|
||||
|
||||
$message = trim((string) ($result['message'] ?? ''));
|
||||
if ($message === '') {
|
||||
$message = __('生成失败', 'aksrt');
|
||||
$message = __('生成失败', 'jio');
|
||||
}
|
||||
|
||||
// Upstream/provider failures are not client validation errors.
|
||||
@@ -173,8 +173,8 @@ class AIController extends ControllerBase {
|
||||
}
|
||||
|
||||
public function tags_suggest(\WP_REST_Request $request): \WP_REST_Response {
|
||||
if (!class_exists('\AKSRT\Ai\AI') || !class_exists('\AKSRT\Ai\AIPrompt')) {
|
||||
return $this->error(__('AI 模块未加载', 'aksrt'), 500);
|
||||
if (!class_exists('\Jio\Ai\AI') || !class_exists('\Jio\Ai\AIPrompt')) {
|
||||
return $this->error(__('AI 模块未加载', 'jio'), 500);
|
||||
}
|
||||
|
||||
$params = $this->get_json_params($request);
|
||||
@@ -182,11 +182,11 @@ class AIController extends ControllerBase {
|
||||
$content = wp_kses_post((string) ($params['content'] ?? ''));
|
||||
|
||||
if ($title === '' && trim(wp_strip_all_tags($content)) === '') {
|
||||
return $this->error(__('标题或内容不能为空', 'aksrt'));
|
||||
return $this->error(__('标题或内容不能为空', 'jio'));
|
||||
}
|
||||
|
||||
$prompt = \AKSRT\Ai\AIPrompt::get_instance()->build_tags_prompt($title, $content);
|
||||
$result = \AKSRT\Ai\AI::get_instance()->generate_text($prompt, [
|
||||
$prompt = \Jio\Ai\AIPrompt::get_instance()->build_tags_prompt($title, $content);
|
||||
$result = \Jio\Ai\AI::get_instance()->generate_text($prompt, [
|
||||
'max_tokens' => 300,
|
||||
'temperature' => 0.5,
|
||||
]);
|
||||
@@ -200,6 +200,6 @@ class AIController extends ControllerBase {
|
||||
return $this->success(['data' => ['tags' => $tags]]);
|
||||
}
|
||||
|
||||
return $this->error((string) ($result['message'] ?? __('生成失败', 'aksrt')));
|
||||
return $this->error((string) ($result['message'] ?? __('生成失败', 'jio')));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user