mirror of
https://github.com/yunluo/gdk.git
synced 2024-05-04 23:43:23 +02:00
加载新的静态资源
后台增加下拉选择表单
This commit is contained in:
parent
8b3271b9e7
commit
689f0b8348
|
@ -15,19 +15,22 @@ add_action('admin_enqueue_scripts', 'gdk_admin_enqueue_script');
|
|||
function gdk_enqueue_script_frontend()
|
||||
{
|
||||
if (!is_admin()) {
|
||||
wp_enqueue_style('pure_css', GDK_BASE_URL . 'assets/css/css-mint.min.css', false, GDK_PLUGIN_VER, 'all');
|
||||
wp_enqueue_style('font-awesome', GDK_BASE_URL . 'assets/css/font-awesome.min.css', false, GDK_PLUGIN_VER, 'all');
|
||||
//wp_enqueue_style( 'milligram_css', GDK_BASE_URL.'assets/css/milligram.min.css', false, GDK_PLUGIN_VER, 'all' );
|
||||
wp_enqueue_style('gdk_css', GDK_BASE_URL . 'assets/css/gdk.css', false, GDK_PLUGIN_VER, 'all');
|
||||
wp_enqueue_style( 'uikit', 'https://cdn.jsdelivr.net/npm/uikit@3.7.4/dist/css/uikit.min.css', false, GDK_PLUGIN_VER, 'all' );
|
||||
|
||||
wp_enqueue_style('gdk', GDK_BASE_URL . 'assets/css/gdk.css', false, GDK_PLUGIN_VER, 'all');
|
||||
|
||||
wp_deregister_script('jquery');
|
||||
wp_enqueue_script('jquery', 'https://cdn.jsdelivr.net/npm/jquery@2.1.0/dist/jquery.min.js', false, GDK_PLUGIN_VER, true); //加载自定义jQuery2.0.3
|
||||
|
||||
//wp_enqueue_script('code_prettify_js', GDK_BASE_URL . 'assets/js/prettify.min.js', array('jquery'), GDK_PLUGIN_VER, true);
|
||||
//wp_enqueue_script('fancybox_js', GDK_BASE_URL . 'assets/js/fancybox.min.js', array('jquery'), GDK_PLUGIN_VER, true);
|
||||
wp_enqueue_script('libs_js', GDK_BASE_URL . 'assets/js/libs.min.js', array('jquery'), GDK_PLUGIN_VER, true);
|
||||
//wp_enqueue_script('sweetalert_js', 'https://cdn.jsdelivr.net/combine/npm/sweetalert@2.0.0,npm/qrious@4.0.2', [], GDK_PLUGIN_VER, true);
|
||||
wp_enqueue_script('gdk_js', GDK_BASE_URL . 'assets/js/gdk.js', array('jquery'), GDK_PLUGIN_VER, true);
|
||||
wp_localize_script('gdk_js', 'gdk', [
|
||||
wp_enqueue_script('jquery', 'https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js', false, GDK_PLUGIN_VER, true); //加载自定义jQuery2.0.3
|
||||
// Comment Reply
|
||||
if (is_singular() && comments_open() && get_option('thread_comments')) {
|
||||
wp_enqueue_script('comment-reply');
|
||||
}
|
||||
|
||||
wp_enqueue_script('libs', GDK_BASE_URL . 'assets/js/libs.min.js', ['jquery'], GDK_PLUGIN_VER, true);
|
||||
wp_enqueue_script('uikit', 'https://cdn.jsdelivr.net/npm/uikit@3.7.4/dist/js/uikit.min.js', [], GDK_PLUGIN_VER, true);
|
||||
wp_enqueue_script('uikit-icon', 'https://cdn.jsdelivr.net/npm/uikit@3.7.4/dist/js/uikit-icons.min.js', [], GDK_PLUGIN_VER, true);
|
||||
wp_enqueue_script('gdk', GDK_BASE_URL . 'assets/js/gdk.js', ['jquery'], GDK_PLUGIN_VER, true);
|
||||
wp_localize_script('gdk', 'gdk', [
|
||||
'ajaxurl' => admin_url('admin-ajax.php'),
|
||||
'pass_nonce' => wp_create_nonce('pass_nonce'),
|
||||
'pay_points' => wp_create_nonce('pay_points'),
|
||||
|
|
|
@ -9,7 +9,7 @@ $gdk_options = [
|
|||
'name' => '古腾堡编辑器',
|
||||
'desc' => '新版编辑器尚不成熟,很多主题不兼容,建议禁用',
|
||||
'id' => 'gdk_diasble_gutenberg',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'0' => '启用',
|
||||
'1' => '禁用',
|
||||
|
@ -20,7 +20,7 @@ $gdk_options = [
|
|||
'name' => '新版小工具块编辑器',
|
||||
'desc' => '5.8版本小工具使用块编辑器,很多主题不兼容,建议禁用',
|
||||
'id' => 'gdk_diasble_widgets_block',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'0' => '启用',
|
||||
'1' => '禁用',
|
||||
|
@ -73,7 +73,7 @@ $gdk_options = [
|
|||
'name' => '文件上传重命名',
|
||||
'desc' => '该功能会将上传的文件图片等按照数字格式重命名,服务器文件不建议使用中文,默认开启',
|
||||
'id' => 'gdk_upload_rename',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'0' => '禁用',
|
||||
'1' => '开启',
|
||||
|
@ -96,7 +96,7 @@ $gdk_options = [
|
|||
'name' => '头像加速功能',
|
||||
'desc' => '该功能会增加头像加载速度,有随机头像,V2EX头像镜像和七牛头像镜像,默认选择随机头像,本地头像和微信头像不受影响',
|
||||
'id' => 'gdk_switch_get_avatar',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'1' => '随机头像',
|
||||
'2' => 'V2EX头像镜像',
|
||||
|
@ -200,7 +200,7 @@ $gdk_options = [
|
|||
'name' => '屏蔽各种不正常的请求',
|
||||
'desc' => '该功能会将各种不正常的请求比如破解,注入类的屏蔽掉,默认开启',
|
||||
'id' => 'gdk_block_requst',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'0' => '禁用',
|
||||
'1' => '启用',
|
||||
|
@ -233,7 +233,7 @@ $gdk_options = [
|
|||
'name' => '登陆安全保护',
|
||||
'desc' => '该功能会将连续多次登陆错误的用户暂时锁定,待解锁后方可重新登陆,默认开启',
|
||||
'id' => 'gdk_lock_login',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'1' => '启用',
|
||||
'0' => '禁用',
|
||||
|
@ -274,7 +274,7 @@ $gdk_options = [
|
|||
'name' => '垃圾评论拦截',
|
||||
'desc' => '该功能会默认屏蔽垃圾评论,支持纯外语拦截,日语拦截[外贸站慎用],关键词黑名单拦截,请务必选择对应主题的评论方式,关键词黑名单如图设置<a class="key_word" target="_blank" href="https://ae03.alicdn.com/kf/U146356e193b14a6da3f7cbb9cf507ea3D.png">点击查看如图设置</a>',
|
||||
'id' => 'gdk_fuck_spam',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'0' => '禁用',
|
||||
'1' => '启用(推荐)',
|
||||
|
@ -379,7 +379,7 @@ $gdk_options = [
|
|||
'name' => '静态CDN服务商',
|
||||
'desc' => '选择使用国内CDN服务商,此项主要影响CDN缩略图,请选择对应服务商',
|
||||
'id' => 'gdk_cdn_serves',
|
||||
'type' => 'radio',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'1' => '七牛云',
|
||||
'2' => '又拍云',
|
||||
|
|
|
@ -126,6 +126,22 @@ break;
|
|||
<p><textarea name="<?php echo $id; ?>" id="<?php echo $id; ?>" rows="10" cols="50" class="large-text code"><?php echo esc_textarea(gdk_option($id)) ?></textarea></p>
|
||||
<?php
|
||||
break;
|
||||
case 'select':
|
||||
?>
|
||||
|
||||
<label for="<?php echo $id; ?>"></label>
|
||||
<label>
|
||||
<select name="<?php echo $id; ?>" id="<?php echo $id; ?>">
|
||||
<?php foreach ($option['options'] as $val => $name) : ?>
|
||||
<option value="<?php echo $val; ?>" <?php selected(gdk_option($id), $val); ?>>
|
||||
<?php echo $name; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<p class="description"><?php echo $option['desc']; ?></p>
|
||||
<?php
|
||||
break;
|
||||
case 'radio':
|
||||
?>
|
||||
<fieldset>
|
||||
|
@ -257,7 +273,7 @@ break;
|
|||
.gdk_option input[type=checkbox]:checked::before,.gdk_option input[type=radio]:checked::before {
|
||||
background-color: #6b48ff;
|
||||
}
|
||||
.gdk_option input[type=checkbox] {
|
||||
.gdk_option input[type=checkbox],.gdk_option input[type=select] {
|
||||
margin:4px;
|
||||
}
|
||||
.gdk_option input[type=radio]:focus, .gdk_option input[type=checkbox]:focus{
|
||||
|
|
|
@ -322,29 +322,6 @@ function gdk_comment_author_link($link, $author_id, $author_nicename)
|
|||
}
|
||||
add_filter('author_link', 'gdk_comment_author_link', 10, 3);
|
||||
|
||||
//文章目录,来自露兜,云落修改
|
||||
if (gdk_option('gdk_article_list')) {
|
||||
function article_index($content)
|
||||
{
|
||||
$matches = array();
|
||||
$ul_li = '';
|
||||
$r = "/<h2>([^<]+)<\/h2>/im";
|
||||
if (is_single() && preg_match_all($r, $content, $matches)) {
|
||||
foreach ($matches[1] as $num => $title) {
|
||||
$title = trim(strip_tags($title));
|
||||
$content = str_replace($matches[0][$num], '<h2 id="title-' . $num . '">' . $title . '</h2>', $content);
|
||||
$ul_li .= '<li><a href="#title-' . $num . '">' . $title . "</a></li>\n";
|
||||
}
|
||||
$content = '<div id="article-index">
|
||||
<strong>文章目录<a class="hidetoc">[隐藏]</a></strong>
|
||||
<ul id="index-ul">' . $ul_li . '</ul>
|
||||
</div>' . $content;
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
add_filter('the_content', 'article_index');
|
||||
}
|
||||
|
||||
function weauth_page_activate()
|
||||
{
|
||||
$awesome_page_id = get_option('weixin_page_id');
|
||||
|
|
Loading…
Reference in a new issue