Merge branch '1' into test

# Conflicts:
#	README.md
#	README.zh-CN.md
#	assets/js/kratos.js
#	functions.php
#	inc/update-checker/update.json
#	languages/kratos.pot
#	style.css
pull/620/head
耗子 2024-09-20 02:52:35 +08:00
commit d3c9107432
14 changed files with 803 additions and 627 deletions

91
.gitignore vendored
View File

@ -1,6 +1,87 @@
#################### VisualStudioCode.gitignore ####################
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
#################### Linux.gitignore ####################
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
#################### Windows.gitignore ####################
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
#################### macOS.gitignore ####################
# General
.DS_Store
vendor/
composer.lock
composer.phar
package.tar
/packages.json
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
#################### Custom.gitignore ####################
!.gitkeep

View File

@ -1,12 +1,12 @@
English | [简体中文](README.zh-CN.md)
**English** | [简体中文](README.zh-CN.md)
<p align="center">
<img src="assets/img/options/about.png">
</p>
<p align="center">
<img src="https://img.shields.io/badge/PHP-%3E7.4-777BB4?style=flat-square&logo=php&logoColor=#777BB4">
<img src="https://img.shields.io/badge/WordPress-v6.4%20alpha%20tested-21759B?style=flat-square&logo=wordpress">
<img src="https://img.shields.io/badge/PHP-%3E8.0-777BB4?style=flat-square&logo=php&logoColor=#777BB4">
<img src="https://img.shields.io/badge/WordPress-v6.7%20tested-21759B?style=flat-square&logo=wordpress">
<a href="https://github.com/devhaozi/kratos/issues">
<img src="https://img.shields.io/github/issues/devhaozi/kratos?style=flat-square&color=blue">
</a>
@ -40,7 +40,7 @@ English | [简体中文](README.zh-CN.md)
## 🤝 Contributing
We welcome all contributions. You can submit any ideas as pull requests or as issues, have a good time! :)
We welcome all contributions. You can submit any ideas as Pull requests or as Issues, have a good time!
## 📃 License

View File

@ -1,12 +1,12 @@
[English](README.md) | 简体中文
[English](README.md) | **简体中文**
<p align="center">
<img src="assets/img/options/about.png">
</p>
<p align="center">
<img src="https://img.shields.io/badge/PHP-%3E7.4-777BB4?style=flat-square&logo=php&logoColor=#777BB4">
<img src="https://img.shields.io/badge/WordPress-v6.4%20alpha%20tested-21759B?style=flat-square&logo=wordpress">
<img src="https://img.shields.io/badge/PHP-%3E8.0-777BB4?style=flat-square&logo=php&logoColor=#777BB4">
<img src="https://img.shields.io/badge/WordPress-v6.7%20tested-21759B?style=flat-square&logo=wordpress">
<a href="https://github.com/devhaozi/kratos/issues">
<img src="https://img.shields.io/github/issues/devhaozi/kratos?style=flat-square&color=blue">
</a>
@ -40,7 +40,7 @@
## 🤝 参与共建
我们欢迎所有的贡献,你可以将任何想法作为 pull requests 或 issues 提交,顺颂商祺 :)
我们欢迎所有的贡献,你可以将任何想法作为 Pull requests 或 Issues 提交,顺颂商祺!
## 📃 开源许可

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -3,194 +3,194 @@
* Seaton Jiang <hi@seatonjiang.com>
*/
var KRATOS_VERSION = "4.2.4.2";
var $ = jQuery.noConflict();
var $ = jQuery.noConflict();
var KRATOS_VERSION = "4.3.1";
var navbarConfig = function () {
$("#navbutton").on("click", function () {
$(".navbar-toggler").toggleClass("nav-close");
});
};
var navbarConfig = function () {
$("#navbutton").on("click", function () {
$(".navbar-toggler").toggleClass("nav-close");
});
};
var tooltipConfig = function () {
$("[data-toggle=\"tooltip\"]").tooltip();
};
var tooltipConfig = function () {
$('[data-toggle="tooltip"]').tooltip();
};
var gotopConfig = function () {
$(window).on("load", function () {
var $win = $(window);
var setShowOrHide = function () {
if ($win.scrollTop() > 200) {
$(".gotop").addClass("active");
var gotopConfig = function () {
$(window).on("load", function () {
var $win = $(window);
var setShowOrHide = function () {
if ($win.scrollTop() > 200) {
$(".gotop").addClass("active");
} else {
$(".gotop").removeClass("active");
}
};
setShowOrHide();
$win.scroll(setShowOrHide);
});
$(".gotop").on("click", function (event) {
event.preventDefault();
$("html, body").animate({ scrollTop: $("html").offset().top }, 500);
return false;
});
};
var searchConfig = function () {
$(".search").on("click", function (e) {
$(".search-form").animate({ width: "200px" }, 200);
$(".search-form input").css("display", "block");
$(document).one("click", function () {
$(".search-form").animate({ width: "0" }, 100);
$(".search-form input").hide();
});
e.stopPropagation();
});
$(".search-form").on("click", function (e) {
e.stopPropagation();
});
};
var wechatConfig = function () {
$(".wechat").mouseout(function () {
$(".wechat-pic")[0].style.display = "none";
});
$(".wechat").mouseover(function () {
$(".wechat-pic")[0].style.display = "block";
});
};
var smiliesConfig = function () {
$("#addsmile").on("click", function (e) {
$(".smile").toggleClass("open");
$(document).one("click", function () {
$(".smile").toggleClass("open");
});
e.stopPropagation();
return false;
});
};
var postlikeConfig = function () {
$.fn.postLike = function () {
if ($(this).hasClass("done")) {
layer.msg(kratos.repeat, function () {});
return false;
} else {
$(".gotop").removeClass("active");
$(this).addClass("done");
layer.msg(kratos.thanks);
var id = $(this).data("id"),
action = $(this).data("action");
var ajax_data = {
action: "love",
um_id: id,
um_action: action,
};
$.post(
kratos.site + "/wp-admin/admin-ajax.php",
ajax_data,
function (data) {}
);
return false;
}
};
setShowOrHide();
$win.scroll(setShowOrHide);
});
$(".gotop").on("click", function (event) {
event.preventDefault();
$("html, body").animate({ scrollTop: $("html").offset().top }, 500);
return false;
});
};
var searchConfig = function () {
$(".search").on("click", function (e) {
$(".search-form").animate({ width: "200px" }, 200);
$(".search-form input").css("display", "block");
$(document).one("click", function () {
$(".search-form").animate({ width: "0" }, 100);
$(".search-form input").hide();
$(document).on("click", ".btn-thumbs", function () {
$(this).postLike();
});
e.stopPropagation();
});
$(".search-form").on("click", function (e) {
e.stopPropagation();
});
};
};
var wechatConfig = function () {
$(".wechat").mouseout(function () {
$(".wechat-pic")[0].style.display = "none";
});
$(".wechat").mouseover(function () {
$(".wechat-pic")[0].style.display = "block";
});
};
var smiliesConfig = function () {
$("#addsmile").on("click", function (e) {
$(".smile").toggleClass("open");
$(document).one("click", function () {
$(".smile").toggleClass("open");
var donateConfig = function () {
$("#donate").on("click", function () {
layer.open({
type: 1,
area: ["300px", "370px"],
title: kratos.donate,
resize: false,
scrollbar: false,
content:
'<div class="donate-box"><div class="meta-pay text-center my-2"><strong>' +
kratos.scan +
'</strong></div><div class="qr-pay text-center"><img class="pay-img" id="alipay_qr" src="' +
kratos.alipay +
'"><img class="pay-img d-none" id="wechat_qr" src="' +
kratos.wechat +
'"></div><div class="choose-pay text-center mt-2"><input id="alipay" type="radio" name="pay-method" checked><label for="alipay" class="pay-button"><img src="' +
kratos.directory +
'/assets/img/payment/alipay.png"></label><input id="wechatpay" type="radio" name="pay-method"><label for="wechatpay" class="pay-button"><img src="' +
kratos.directory +
'/assets/img/payment/wechat.png"></label></div></div>',
});
$('.choose-pay input[type="radio"]').click(function () {
var id = $(this).attr("id");
if (id == "alipay") {
$(".qr-pay #alipay_qr").removeClass("d-none");
$(".qr-pay #wechat_qr").addClass("d-none");
}
if (id == "wechatpay") {
$(".qr-pay #alipay_qr").addClass("d-none");
$(".qr-pay #wechat_qr").removeClass("d-none");
}
});
});
e.stopPropagation();
return false;
});
};
};
var postlikeConfig = function () {
$.fn.postLike = function () {
if ($(this).hasClass("done")) {
layer.msg(kratos.repeat, function () {});
return false;
} else {
$(this).addClass("done");
layer.msg(kratos.thanks);
var id = $(this).data("id"),
action = $(this).data("action");
var ajax_data = {
action: "love",
um_id: id,
um_action: action,
};
$.post(
kratos.site + "/wp-admin/admin-ajax.php",
ajax_data,
function (data) {},
);
return false;
var accordionConfig = function () {
$(".acheader").on("click", function (event) {
var $this = $(this);
$this.closest(".accordion").find(".contents").slideToggle(300);
if ($this.closest(".accordion").hasClass("active")) {
$this.closest(".accordion").removeClass("active");
} else {
$this.closest(".accordion").addClass("active");
}
event.preventDefault();
});
};
var consoleConfig = function () {
console.log(
"\n Kratos Pjax Edition v" +
KRATOS_VERSION +
"\n\n https://github.com/devhaozi/kratos \n\n"
);
};
var lightGalleryConfig = function () {
if (typeof lightGallery !== 'undefined') {
lightGallery(document.getElementById("lightgallery"), {
selector:
'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]',
});
}
};
$(document).on("click", ".btn-thumbs", function () {
$(this).postLike();
document.addEventListener("DOMContentLoaded", function () {
accordionConfig();
navbarConfig();
tooltipConfig();
gotopConfig();
searchConfig();
wechatConfig();
smiliesConfig();
postlikeConfig();
donateConfig();
consoleConfig();
lightGalleryConfig();
});
};
var donateConfig = function () {
$("#donate").on("click", function () {
layer.open({
type: 1,
area: ["300px", "370px"],
title: kratos.donate,
resize: false,
scrollbar: false,
content:
"<div class=\"donate-box\"><div class=\"meta-pay text-center my-2\"><strong>" +
kratos.scan +
"</strong></div><div class=\"qr-pay text-center\"><img class=\"pay-img\" id=\"alipay_qr\" src=\"" +
kratos.alipay +
"\"><img class=\"pay-img d-none\" id=\"wechat_qr\" src=\"" +
kratos.wechat +
"\"></div><div class=\"choose-pay text-center mt-2\"><input id=\"alipay\" type=\"radio\" name=\"pay-method\" checked><label for=\"alipay\" class=\"pay-button\"><img src=\"" +
kratos.directory +
"/assets/img/payment/alipay.png\"></label><input id=\"wechatpay\" type=\"radio\" name=\"pay-method\"><label for=\"wechatpay\" class=\"pay-button\"><img src=\"" +
kratos.directory +
"/assets/img/payment/wechat.png\"></label></div></div>",
});
$(".choose-pay input[type=\"radio\"]").click(function () {
var id = $(this).attr("id");
if (id == "alipay") {
$(".qr-pay #alipay_qr").removeClass("d-none");
$(".qr-pay #wechat_qr").addClass("d-none");
}
if (id == "wechatpay") {
$(".qr-pay #alipay_qr").addClass("d-none");
$(".qr-pay #wechat_qr").removeClass("d-none");
}
});
});
};
var accordionConfig = function () {
$(".acheader").on("click", function (event) {
var $this = $(this);
$this.closest(".accordion").find(".contents").slideToggle(300);
if ($this.closest(".accordion").hasClass("active")) {
$this.closest(".accordion").removeClass("active");
} else {
$this.closest(".accordion").addClass("active");
}
event.preventDefault();
});
};
var consoleConfig = function () {
console.log(
"\n Kratos Pjax Edition v" +
KRATOS_VERSION +
"\n\n https://github.com/devhaozi/kratos \n\n",
);
};
var lightGalleryConfig = function () {
if (kratos.lightgallery === "1" && window.lightGallery !== undefined) {
lightGallery(document.getElementById("lightgallery"), {
selector:
"a[href$=\".jpg\"], a[href$=\".jpeg\"], a[href$=\".png\"], a[href$=\".gif\"], a[href$=\".bmp\"], a[href$=\".webp\"]",
});
}
};
document.addEventListener("DOMContentLoaded", function () {
accordionConfig();
navbarConfig();
tooltipConfig();
gotopConfig();
searchConfig();
wechatConfig();
smiliesConfig();
postlikeConfig();
donateConfig();
consoleConfig();
lightGalleryConfig();
});
function afterPjax() {
accordionConfig();
navbarConfig();
tooltipConfig();
gotopConfig();
searchConfig();
wechatConfig();
smiliesConfig();
postlikeConfig();
donateConfig();
consoleConfig();
lightGalleryConfig();
accordionConfig();
navbarConfig();
tooltipConfig();
gotopConfig();
searchConfig();
wechatConfig();
smiliesConfig();
postlikeConfig();
donateConfig();
consoleConfig();
lightGalleryConfig();
}
function grin(tag) {

View File

@ -7,7 +7,7 @@
* @version 2023.08.25
*/
define('THEME_VERSION', '4.2.4.2');
define('THEME_VERSION', '4.3.1.1');
if (defined('WP_USE_THEMES') && WP_USE_THEMES === false) {
return;

View File

@ -4,7 +4,7 @@
* 核心函数
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2023.04.04
* @version 2024.08.05
*/
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
@ -43,7 +43,7 @@ function theme_autoload()
wp_enqueue_style('bootstrap', ASSET_PATH . '/assets/css/bootstrap.min.css', array(), '4.5.0');
wp_enqueue_style('kicon', ASSET_PATH . '/assets/css/iconfont.min.css', array(), THEME_VERSION);
wp_enqueue_style('layer', ASSET_PATH . '/assets/css/layer.min.css', array(), '3.1.1');
if (kratos_option('g_lightgallery', true)) {
if ((kratos_option('g_article_lightgallery', true) && is_single()) || (kratos_option('g_page_lightgallery', true) && is_page())) {
wp_enqueue_script('lightgallery', ASSET_PATH . '/assets/js/lightgallery.min.js', array(), '1.4.0', true);
wp_enqueue_style('lightgallery', ASSET_PATH . '/assets/css/lightgallery.min.css', array(), '1.4.0');
}
@ -112,7 +112,6 @@ function theme_autoload()
'directory' => ASSET_PATH,
'alipay' => kratos_option('g_donate_fieldset')['g_donate_alipay'] ?? '',
'wechat' => kratos_option('g_donate_fieldset')['g_donate_wechat'] ?? '',
'lightgallery' => kratos_option('g_lightgallery', true),
'repeat' => __('您已经赞过了', 'kratos'),
'thanks' => __('感谢您的支持', 'kratos'),
'donate' => __('打赏作者', 'kratos'),
@ -131,6 +130,16 @@ function kratos_admin_enqueue()
add_action('admin_enqueue_scripts', 'kratos_admin_enqueue', 20);
// 后台提示
if (kratos_option('g_admin_notice', true)) {
function custom_admin_notice()
{
$message = __('感谢您使用 Kratos 主题进行创作,全新主题 Fraise 即将上线,欢迎加入 QQ 群讨论交流618958939可在「主题设置 - 全站配置 - 后台管理员通知」关闭此通知。', 'kratos');
echo '<div class="notice notice-info "><p>' . $message . '</p></div>';
}
add_action('admin_notices', 'custom_admin_notice');
}
// 前台管理员导航
if (!kratos_option('g_adminbar', true)) {
add_filter('show_admin_bar', '__return_false');

View File

@ -1,4 +1,5 @@
<?php
/**
* WP Bootstrap Navwalker
*
@ -8,7 +9,7 @@
* Plugin Name: WP Bootstrap Navwalker
* Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Bootstrap 4 navigation style in a custom theme using the WordPress built in menu manager.
* Author: Edward McIntyre - @twittem, WP Bootstrap, William Patton - @pattonwebz
* Author: Edward McIntyre - @twittem, WP Bootstrap, William Patton - @pattonwebz, IanDelMar - @IanDelMar
* Version: 4.3.0
* Author URI: https://github.com/wp-bootstrap
* GitHub Plugin URI: https://github.com/wp-bootstrap/wp-bootstrap-navwalker
@ -310,7 +311,6 @@ if (!class_exists('WP_Bootstrap_Navwalker')) {
// END appending the internal item contents to the output.
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
}
/**
@ -337,11 +337,13 @@ if (!class_exists('WP_Bootstrap_Navwalker')) {
public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
{
if (!$element) {
return;}
return;
}
$id_field = $this->db_fields['id'];
// Display this element.
if (is_object($args[0])) {
$args[0]->has_children = !empty($children_elements[$element->$id_field]);}
$args[0]->has_children = !empty($children_elements[$element->$id_field]);
}
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
@ -381,9 +383,11 @@ if (!class_exists('WP_Bootstrap_Navwalker')) {
}
$fallback_output .= '<ul';
if ($menu_id) {
$fallback_output .= ' id="' . esc_attr($menu_id) . '"';}
$fallback_output .= ' id="' . esc_attr($menu_id) . '"';
}
if ($menu_class) {
$fallback_output .= ' class="' . esc_attr($menu_class) . '"';}
$fallback_output .= ' class="' . esc_attr($menu_class) . '"';
}
$fallback_output .= '>';
$fallback_output .= '<li class="nav-item"><a href="' . esc_url(admin_url('nav-menus.php')) . '" class="nav-link">' . esc_attr__('添加导航', 'kratos') . '</a></li>';
$fallback_output .= '</ul>';

View File

@ -4,7 +4,7 @@
* 主题选项
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2023.08.25
* @version 2024.01.17
*/
defined('ABSPATH') || exit;
@ -172,6 +172,20 @@ CSF::createSection($prefix, array(
'subtitle' => __('启用/禁用 Gutenberg 编辑器', 'kratos'),
'default' => false,
),
array(
'id' => 'g_page_lightgallery',
'type' => 'switcher',
'title' => __('页面图片灯箱', 'kratos'),
'subtitle' => __('启用/禁用页面图片灯箱功能', 'kratos'),
'default' => true,
),
array(
'id' => 'g_admin_notice',
'type' => 'switcher',
'title' => __('后台管理员通知', 'kratos'),
'subtitle' => __('启用/禁用后台管理员通知', 'kratos'),
'default' => true,
),
array(
'id' => 'g_excerpt_length',
'type' => 'text',
@ -739,7 +753,7 @@ CSF::createSection($prefix, array(
'default' => true,
),
array(
'id' => 'g_lightgallery',
'id' => 'g_article_lightgallery',
'type' => 'switcher',
'title' => __('文章图片灯箱', 'kratos'),
'subtitle' => __('启用/禁用文章图片灯箱功能', 'kratos'),
@ -1282,7 +1296,7 @@ CSF::createSection($prefix, array(
),
array(
'type' => 'content',
'content' => '如果您有用到我开发维护的项目,请考虑支持一下我的工作,让我可以持续的维护它们,您可在爱发电(<a href="https://afdian.net/a/seatonjiang" target="_blank">https://afdian.net/a/seatonjiang</a>)中进行打赏,谢谢!',
'content' => '如果您有用到我开发维护的项目,请考虑支持一下我的工作,让我可以持续的维护它们,您可在爱发电(<a href="https://afdian.com/a/seatonjiang" target="_blank">https://afdian.com/a/seatonjiang</a>)中进行打赏,谢谢!',
),
),
));

View File

@ -1,5 +1,5 @@
{
"version": "4.2.4.2",
"details_url": "https://github.com/devhaozi/kratos/releases/tag/v4.2.4.2",
"download_url": "https://dl.cdn.haozi.net/kratos/v4.2.4.2.zip"
"version": "4.3.1.1",
"details_url": "https://github.com/devhaozi/kratos/releases/tag/v4.3.1.1",
"download_url": "https://dl.cdn.haozi.net/kratos/v4.3.1.1.zip"
}

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
* Template Name: 单页样式
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.11.27
* @version 2024.01.17
*/
get_header(); ?>
@ -18,7 +18,7 @@ get_header(); ?>
<div class="header text-center">
<h1 class="title m-0"><?php the_title(); ?></h1>
</div>
<div class="content">
<div class="content" id="lightgallery">
<?php
the_content();
wp_link_pages(
@ -56,4 +56,4 @@ get_header(); ?>
</div>
</div>
</div>
<?php get_footer(); ?>
<?php get_footer(); ?>

View File

@ -4,7 +4,7 @@
* 页面模板
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2024.01.17
*/
get_header(); ?>
@ -18,7 +18,7 @@ get_header(); ?>
<div class="header text-center">
<h1 class="title m-0"><?php the_title(); ?></h1>
</div>
<div class="content">
<div class="content" id="lightgallery">
<?php
the_content();
wp_link_pages(
@ -59,4 +59,4 @@ get_header(); ?>
</div>
</div>
</div>
<?php get_footer(); ?>
<?php get_footer(); ?>

View File

@ -2,8 +2,8 @@
/*
Theme Name: Kratos Pjax Edition
Text Domain: kratos
Version: 4.2.4.2
Requires PHP: 7.4
Version: 4.3.1
Requires PHP: 8.0
Requires at least: 5.3.0
Description:
Tags: , , , , , , , , , , , , ,