修复了一些问题
This commit is contained in:
1 parent
dbb1f776f2
commit
0109a59922
10 files changed
+121
-33
No files matched your search
@@ -54,20 +54,33 @@ function aksrt_get_new_post_url(int $edit_id = 0): string {
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_get_messages_rewrite_slug')) :
|
||||
/** 获取消息中心当前唯一的重写别名。 */
|
||||
function aksrt_get_messages_rewrite_slug(): string {
|
||||
$settings = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::notification_settings()
|
||||
: [];
|
||||
$slug = sanitize_key((string) ($settings['slug'] ?? 'message'));
|
||||
return $slug !== '' ? $slug : 'message';
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_get_messages_page_url')) :
|
||||
/** 消息中心 URL。 */
|
||||
function aksrt_get_messages_page_url(string $view = 'unread'): string {
|
||||
if (class_exists('\AKSRT\Settings\Settings') && !\AKSRT\Settings\Settings::message_enabled()) {
|
||||
return '';
|
||||
}
|
||||
$paths = [
|
||||
'unread' => '/message/',
|
||||
'posts' => '/message/posts/',
|
||||
'like' => '/message/like/',
|
||||
'system' => '/message/system/',
|
||||
if (class_exists('\AKSRT\Settings\Settings') && !\AKSRT\Settings\Settings::message_enabled()) {
|
||||
return '';
|
||||
}
|
||||
$suffixes = [
|
||||
'unread' => '',
|
||||
'posts' => 'posts',
|
||||
'like' => 'like',
|
||||
'system' => 'system',
|
||||
];
|
||||
$view = sanitize_key($view);
|
||||
return home_url($paths[$view] ?? $paths['unread']);
|
||||
$suffix = $suffixes[$view] ?? $suffixes['unread'];
|
||||
$path = '/' . aksrt_get_messages_rewrite_slug() . ($suffix !== '' ? '/' . $suffix : '') . '/';
|
||||
return home_url($path);
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
Reference in new issue
Block a user