2020-01-25 12:06:43 +01:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
2021-10-10 15:48:53 +02:00
|
|
|
|
* Git 插件后台选项.
|
2020-01-25 12:06:43 +01:00
|
|
|
|
*/
|
2020-03-15 14:29:06 +01:00
|
|
|
|
if (!defined('WPINC')) {
|
2021-10-10 15:48:53 +02:00
|
|
|
|
exit;
|
2020-03-15 14:29:06 +01:00
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-06 15:44:41 +02:00
|
|
|
|
$gdk_default = [];
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$gdk_options = [];
|
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
include 'options-config.php';
|
2021-10-06 15:44:41 +02:00
|
|
|
|
$gdk_config = get_option('gdk_options_setup');
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
function gdk_update_options()
|
|
|
|
|
{
|
2021-10-06 15:44:41 +02:00
|
|
|
|
global $gdk_default, $gdk_options, $gdk_config;
|
2020-03-15 14:29:06 +01:00
|
|
|
|
foreach ($gdk_options as $panel) {
|
|
|
|
|
foreach ($panel as $option) {
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$id = $option['id'] ?? '';
|
2020-03-15 14:29:06 +01:00
|
|
|
|
$type = $option['type'] ?? '';
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$std = $option['std'] ?? '';
|
2020-03-15 14:29:06 +01:00
|
|
|
|
if (!$id) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-06 15:44:41 +02:00
|
|
|
|
$gdk_default[$id] = $std;
|
|
|
|
|
if (isset($gdk_config[$id])) {
|
2020-03-15 14:29:06 +01:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-06 15:44:41 +02:00
|
|
|
|
$gdk_config[$id] = $std;
|
2020-03-15 14:29:06 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
}
|
2021-10-06 19:29:30 +02:00
|
|
|
|
gdk_update_options();
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
|
|
|
|
//获取设置选项
|
2021-10-06 15:44:41 +02:00
|
|
|
|
function gdk_option($id, $Default = false)
|
2020-03-15 14:29:06 +01:00
|
|
|
|
{
|
2021-10-06 15:44:41 +02:00
|
|
|
|
global $gdk_default, $gdk_config;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
|
|
|
|
return stripslashes(trim($Default ? $gdk_default[$id] : $gdk_config[$id]));
|
2020-01-25 12:06:43 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//设置页面模板
|
2020-03-15 14:29:06 +01:00
|
|
|
|
function gdk_options_page()
|
|
|
|
|
{
|
2021-10-10 15:48:53 +02:00
|
|
|
|
global $gdk_options; ?>
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
|
|
|
|
<div class="wrap">
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<h2>GDK选项 <input type="button" class="add-new-h2 get_new_version" value="检测更新"><input type="button"
|
|
|
|
|
style="display:none;" class="add-new-h2 install_new_version" value="安装更新"></h2>
|
|
|
|
|
<hr />
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
if (isset($_GET['update'])) {
|
|
|
|
|
echo '<div class="updated"><p><strong>设置已保存。</strong></p></div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['reset'])) {
|
|
|
|
|
echo '<div class="updated"><p><strong>设置已重置。</strong></p></div>';
|
2021-10-10 15:48:53 +02:00
|
|
|
|
} ?>
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
|
|
|
|
<div class="wp-filter">
|
|
|
|
|
<ul class="filter-links">
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<?php
|
2021-10-06 15:44:41 +02:00
|
|
|
|
$activePanelIdx = $_GET['panel'] ?? 0;
|
2020-03-15 14:29:06 +01:00
|
|
|
|
foreach (array_keys($gdk_options) as $i => $name) {
|
2021-10-10 15:48:53 +02:00
|
|
|
|
echo '<li><a href="#panel_'.$i.'" data-panel="'.$i.'" '.($i == $activePanelIdx ? 'class="current"' : '').'>'.$name.'</a></li>';
|
|
|
|
|
} ?>
|
2021-10-07 17:25:32 +02:00
|
|
|
|
<li><a href="#panel_about" data-panel="about" class="about">关于</a></li>
|
2020-01-25 12:06:43 +01:00
|
|
|
|
</ul>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<div class="search-form"><label class="screen-reader-text" for="wp-filter-search-input">筛选插件选项…</label><input
|
|
|
|
|
placeholder="筛选插件选项…" type="search" id="wp-filter-search-input" class="wp-filter-search"></div>
|
|
|
|
|
</div>
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<form method="post">
|
|
|
|
|
<?php
|
2020-01-25 12:06:43 +01:00
|
|
|
|
$index = 0;
|
2020-03-15 14:29:06 +01:00
|
|
|
|
foreach ($gdk_options as $panel) {
|
2021-10-10 15:48:53 +02:00
|
|
|
|
echo '<div class="panel gdk_option" id="panel_'.$index.'" '.($index == $activePanelIdx ? ' style="display:block"' : '').'><table class="form-table">';
|
2020-03-15 14:29:06 +01:00
|
|
|
|
foreach ($panel as $option) {
|
|
|
|
|
$type = $option['type'];
|
2021-10-10 15:48:53 +02:00
|
|
|
|
if ('title' == $type) {
|
2020-03-15 14:29:06 +01:00
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<tr class="title">
|
|
|
|
|
<th colspan="2">
|
|
|
|
|
<h3><?php echo $option['title']; ?>
|
|
|
|
|
</h3>
|
|
|
|
|
<?php if (isset($option['desc'])) {
|
|
|
|
|
echo '<p>'.$option['desc'].'</p>';
|
|
|
|
|
} ?>
|
|
|
|
|
</th>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$id = $option['id']; ?>
|
|
|
|
|
<tr id="row-<?php echo $id; ?>">
|
|
|
|
|
<th><label for="<?php echo $id; ?>"><?php echo $option['name']; ?></label>
|
|
|
|
|
</th>
|
|
|
|
|
<td>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
switch ($type) {
|
|
|
|
|
case 'text':
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<label>
|
|
|
|
|
<input name="<?php echo $id; ?>"
|
|
|
|
|
class="regular-text" id="<?php echo $id; ?>"
|
|
|
|
|
type="text"
|
|
|
|
|
value="<?php echo esc_attr(gdk_option($id)); ?>" />
|
|
|
|
|
</label>
|
|
|
|
|
<p class="description"><?php echo $option['desc']; ?>
|
|
|
|
|
</p>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
case 'number':
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<label>
|
|
|
|
|
<input name="<?php echo $id; ?>"
|
|
|
|
|
class="small-text" id="<?php echo $id; ?>"
|
|
|
|
|
type="number"
|
|
|
|
|
value="<?php echo esc_attr(gdk_option($id)); ?>" />
|
|
|
|
|
<span class="description"><?php echo $option['desc']; ?></span>
|
|
|
|
|
</label>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
case 'textarea':
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<p><label for="<?php echo $id; ?>"><?php echo $option['desc']; ?></label>
|
|
|
|
|
</p>
|
|
|
|
|
<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
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2021-10-08 19:17:38 +02:00
|
|
|
|
case 'select':
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<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);
|
2021-10-08 20:27:52 +02:00
|
|
|
|
?>>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<?php echo $name;
|
2021-10-08 20:27:52 +02:00
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
</option>
|
|
|
|
|
<?php }
|
2021-10-08 20:27:52 +02:00
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
</select>
|
|
|
|
|
</label>
|
|
|
|
|
<p class="description"><?php echo $option['desc'];
|
|
|
|
|
?>
|
|
|
|
|
</p>
|
|
|
|
|
<?php
|
2021-10-08 19:17:38 +02:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2021-10-08 20:27:52 +02:00
|
|
|
|
case 'radio':
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<fieldset>
|
|
|
|
|
<?php foreach ($option['options'] as $val => $name) { ?>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="radio" name="<?php echo $id; ?>"
|
|
|
|
|
id="<?php echo $id.'_'.$val; ?>"
|
|
|
|
|
value="<?php echo $val; ?>" <?php checked(gdk_option($id), $val); ?>>
|
|
|
|
|
<?php echo $name; ?>
|
|
|
|
|
</label>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</fieldset>
|
|
|
|
|
<p class="description"><?php echo $option['desc']; ?>
|
|
|
|
|
</p>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
case 'checkbox':
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<label>
|
|
|
|
|
<input type='checkbox' name="<?php echo $id; ?>"
|
|
|
|
|
id="<?php echo $id; ?>" value="1" <?php echo checked(gdk_option($id)); ?> />
|
|
|
|
|
<span><?php echo $option['desc']; ?></span>
|
|
|
|
|
</label>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
case 'checkboxs':
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<fieldset>
|
|
|
|
|
<?php $checkboxValues = gdk_option($id);
|
|
|
|
|
if (!is_array($checkboxValues)) {
|
|
|
|
|
$checkboxValues = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($option['options'] as $id => $name) { ?>
|
|
|
|
|
<label>
|
|
|
|
|
<input type="checkbox"
|
|
|
|
|
name="<?php echo $id; ?>[]"
|
|
|
|
|
id="<?php echo $id; ?>[]"
|
|
|
|
|
value="<?php echo $id; ?>" <?php checked(array_key_exists($id, $checkboxValues), 1); ?>>
|
|
|
|
|
<?php echo $name; ?>
|
|
|
|
|
</label>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
</fieldset>
|
|
|
|
|
<p class="description"><?php echo $option['desc']; ?>
|
|
|
|
|
</p>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
default:
|
|
|
|
|
?>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
<label>
|
|
|
|
|
<input name="<?php echo $id; ?>"
|
|
|
|
|
class="regular-text" id="<?php echo $id; ?>"
|
|
|
|
|
type="<?php echo $type; ?>"
|
|
|
|
|
value="<?php echo esc_attr(gdk_option($id)); ?>" />
|
|
|
|
|
</label>
|
|
|
|
|
<p class="description"><?php echo $option['desc']; ?>
|
|
|
|
|
</p>
|
|
|
|
|
<?php
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
echo '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
echo '</table></div>';
|
2021-10-10 15:48:53 +02:00
|
|
|
|
++$index;
|
|
|
|
|
} ?>
|
|
|
|
|
<div class="panel" id="panel_about">
|
|
|
|
|
<table class="form-table">
|
|
|
|
|
<tr>
|
|
|
|
|
<th>
|
|
|
|
|
<h4>联系方式</h4>
|
|
|
|
|
</th>
|
|
|
|
|
<td>
|
|
|
|
|
<ul>
|
|
|
|
|
<li>QQ:865113728(推荐)</li>
|
|
|
|
|
<li>邮箱:<a href="mailto:sp91@qq.com">sp91@qq.com</a></li>
|
|
|
|
|
<li>
|
|
|
|
|
<p style="font-size:14px;color:#72777c">* 和主题无关的问题恕不回复</p>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>
|
|
|
|
|
<h4>意见反馈</h4>
|
|
|
|
|
</th>
|
|
|
|
|
<td>
|
|
|
|
|
<input type="button" class="add-new-h2 feedback-btn" value="意见反馈">
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<hr />
|
|
|
|
|
<p class="submit" style="display:inline;float:left;margin-right:50px;">
|
|
|
|
|
<input name="submit" type="submit" class="button button-primary" value="保存更改" />
|
|
|
|
|
<input type="hidden" name="action" value="update" />
|
|
|
|
|
<input type="hidden" name="panel"
|
|
|
|
|
value="<?php echo $activePanelIdx; ?>"
|
|
|
|
|
id="active_panel_name" />
|
|
|
|
|
</p>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<form method="post" style="display:inline;float:left;margin-right:50px;">
|
|
|
|
|
<p class="submit">
|
|
|
|
|
<input name="reset" type="submit" class="button button-secondary" value="重置选项"
|
|
|
|
|
onclick="return confirm('你确定要重置选项吗?');" />
|
|
|
|
|
<input type="hidden" name="action" value="reset" />
|
|
|
|
|
</p>
|
|
|
|
|
</form>
|
|
|
|
|
<form style="display:inline;float:left;margin-right:50px;">
|
|
|
|
|
<p class="submit">
|
|
|
|
|
<input type="button" class="button button-secondary mail_test" value="SMTP测试"
|
|
|
|
|
onclick="return confirm('点击后点击后,网站会向指定邮箱发送测试邮件,如果发送有响应则证明邮箱成功,如果没有任何响应说明邮箱配置失败!');" />
|
|
|
|
|
</p>
|
|
|
|
|
</form>
|
2020-01-25 12:06:43 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 静态资源css&js -->
|
|
|
|
|
<style>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.panel {
|
|
|
|
|
display: none;
|
|
|
|
|
margin: 0 20px;
|
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.panel h3 {
|
|
|
|
|
margin: 0;
|
|
|
|
|
border-bottom: 1px solid #d2d3e0;
|
|
|
|
|
padding-bottom: 5px;
|
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.key_word {
|
|
|
|
|
color: #f70044;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
margin: 10px;
|
|
|
|
|
}
|
2020-01-25 15:50:40 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.panel th {
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
}
|
2020-02-02 20:35:39 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.wp-filter {
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
}
|
2020-01-26 18:57:04 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.filter-links .current,
|
|
|
|
|
.filter-links.current:focus {
|
|
|
|
|
color: #6b48ff !important;
|
|
|
|
|
border-bottom: 4px solid #6b48ff;
|
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.filter-links li>a:hover {
|
|
|
|
|
color: #666
|
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
.filter-links a:focus {
|
|
|
|
|
color: #6b48ff;
|
|
|
|
|
box-shadow: none
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.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=select] {
|
|
|
|
|
margin: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.gdk_option input[type=radio]:focus,
|
|
|
|
|
.gdk_option input[type=checkbox]:focus {
|
|
|
|
|
box-shadow: 0 0 0 1px #6b48ff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.wp-filter .drawer-toggle:before {
|
|
|
|
|
content: "\f463";
|
|
|
|
|
color: #fff !important;
|
|
|
|
|
background: #e14d43;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
box-shadow: inset 0 0 0 2px #e14d43, 0 0 0 2px #e14d43;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.install_new_version,
|
|
|
|
|
.wrap.searching .nav-tab-wrapper a,
|
|
|
|
|
.wrap.searching .panel tr,
|
|
|
|
|
body.show-filters .wrap form {
|
|
|
|
|
display: none
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.wrap.searching .panel {
|
|
|
|
|
display: block !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.filter-drawer {
|
|
|
|
|
padding-top: 0;
|
|
|
|
|
padding-bottom: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.filter-drawer ul {
|
|
|
|
|
list-style: disc inside;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.get_update_res,
|
|
|
|
|
.get_new_version {
|
|
|
|
|
margin-left: 20px;
|
|
|
|
|
padding: 5px;
|
|
|
|
|
font-size: medium;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.g-load {
|
|
|
|
|
background: url(images/spinner.gif) no-repeat;
|
|
|
|
|
background-size: 20px 20px;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
opacity: .7;
|
|
|
|
|
filter: alpha(opacity=70);
|
|
|
|
|
width: 20px;
|
|
|
|
|
height: 20px;
|
|
|
|
|
margin: 4px 10px 0;
|
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
</style>
|
|
|
|
|
<style id="theme-options-filter"></style>
|
|
|
|
|
<script>
|
2021-10-10 15:48:53 +02:00
|
|
|
|
/* global wp */
|
|
|
|
|
jQuery(function($) {
|
|
|
|
|
var $body = $("body");
|
|
|
|
|
var $themeOptionsFilter = $("#theme-options-filter");
|
|
|
|
|
var $wpFilterSearchInput = $("#wp-filter-search-input");
|
|
|
|
|
|
|
|
|
|
$(".filter-links a").click(function() {
|
|
|
|
|
$(this).addClass("current").parent().siblings().children(".current").removeClass("current");
|
|
|
|
|
$(".panel").hide();
|
|
|
|
|
$($(this).attr("href")).show();
|
|
|
|
|
$("#active_panel_name").val($(this).data("panel"));
|
|
|
|
|
$body.removeClass("show-filters");
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
if ($wpFilterSearchInput.is(":visible")) {
|
|
|
|
|
var wrap = $(".wrap");
|
|
|
|
|
|
|
|
|
|
$(".panel tr").each(function() {
|
|
|
|
|
$(this).attr("data-searchtext", $(this).text().replace(/\r|\n|px/g, '').replace(/ +/g, ' ')
|
|
|
|
|
.replace(/^\s+|\s+$/g, '').toLowerCase());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$wpFilterSearchInput.on("input", function() {
|
|
|
|
|
var text = $(this).val().trim().toLowerCase();
|
|
|
|
|
if (text) {
|
|
|
|
|
wrap.addClass("searching");
|
|
|
|
|
$themeOptionsFilter.text(".wrap.searching .panel tr[data-searchtext*='" + text +
|
|
|
|
|
"']{display:block}");
|
|
|
|
|
} else {
|
|
|
|
|
wrap.removeClass("searching");
|
|
|
|
|
$themeOptionsFilter.text("");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-01-25 12:06:43 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$(".wrap form").submit(function() {
|
|
|
|
|
$(".submit .button").prop("disabled", true);
|
|
|
|
|
$(this).find(".submit .button").val("正在提交…");
|
2020-01-25 12:06:43 +01:00
|
|
|
|
});
|
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$(".mail_test").click(function() {
|
|
|
|
|
var ajax_data = {
|
|
|
|
|
action: 'gdk_test_email'
|
|
|
|
|
};
|
|
|
|
|
$.post(ajaxurl, ajax_data,
|
|
|
|
|
function(a) {
|
|
|
|
|
a = $.trim(a);
|
|
|
|
|
if (a == '200') {
|
|
|
|
|
alert("测试成功,您的SMTP邮箱邮件发送已成功,Enjoy it");
|
|
|
|
|
} else {
|
|
|
|
|
alert("测试失败,您的SMTP邮箱邮件响应失败,请重试");
|
|
|
|
|
}
|
|
|
|
|
});
|
2020-01-25 12:06:43 +01:00
|
|
|
|
});
|
2020-01-27 19:03:14 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$(".get_new_version").click(function() {
|
|
|
|
|
$(".get_new_version").after("<span class='g-load'></span>");
|
|
|
|
|
var ajax_data = {
|
|
|
|
|
action: 'get_new_version'
|
|
|
|
|
};
|
|
|
|
|
$.get(ajaxurl, ajax_data,
|
|
|
|
|
function(a) {
|
|
|
|
|
a = $.trim(a);
|
|
|
|
|
$(".g-load").hide();
|
|
|
|
|
if (a !== '400') {
|
|
|
|
|
if ($(".get_update_res").length > 0) return;
|
|
|
|
|
$(".get_new_version").after(a);
|
|
|
|
|
if ($(".has_new_version").length > 0) {
|
|
|
|
|
$(".install_new_version").show();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$(".get_new_version").after("检测失败,网络错误");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2020-01-27 19:03:14 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$(".install_new_version").click(function() {
|
|
|
|
|
$(".install_new_version").after("<span class='g-load'></span>");
|
|
|
|
|
var ajax_data = {
|
|
|
|
|
action: 'install_new_version'
|
|
|
|
|
};
|
|
|
|
|
$.get(ajaxurl, ajax_data,
|
|
|
|
|
function() {
|
|
|
|
|
$(".g-load").hide();
|
|
|
|
|
//window.location.reload();
|
|
|
|
|
});
|
|
|
|
|
});
|
2020-03-21 16:43:54 +01:00
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
$(".feedback-btn").click(function() {
|
|
|
|
|
$(".feedback-btn").after("<span class='g-load'></span>");
|
|
|
|
|
$("<link>").attr({
|
|
|
|
|
rel: "stylesheet",
|
|
|
|
|
type: "text/css",
|
|
|
|
|
href: "https://cdn.bootcss.com/fancybox/3.0.39/jquery.fancybox.min.css"
|
|
|
|
|
}).appendTo("head");
|
|
|
|
|
|
|
|
|
|
$.getScript("https://cdn.bootcss.com/fancybox/3.0.39/jquery.fancybox.min.js",
|
|
|
|
|
function() {
|
|
|
|
|
$(".g-load").hide();
|
|
|
|
|
$.fancybox.open({
|
|
|
|
|
src: 'https://support.qq.com/products/51158/',
|
|
|
|
|
type: 'iframe',
|
|
|
|
|
opts: {
|
|
|
|
|
afterShow: function(instance, current) {
|
|
|
|
|
console.info('done!');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
2020-02-20 11:59:26 +01:00
|
|
|
|
|
|
|
|
|
|
2021-10-10 15:48:53 +02:00
|
|
|
|
});
|
2020-01-25 12:06:43 +01:00
|
|
|
|
</script>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
function gdk_add_options_page()
|
|
|
|
|
{
|
|
|
|
|
global $gdk_options;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
if (isset($_POST['action'], $_GET['page']) && 'gdk-options' == $_GET['page']) {
|
2020-03-15 14:29:06 +01:00
|
|
|
|
$action = $_POST['action'];
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
switch ($action) {
|
|
|
|
|
case 'update':
|
|
|
|
|
$_POST['uid'] = uniqid();
|
|
|
|
|
update_option('gdk_options_setup', $_POST);
|
|
|
|
|
gdk_update_options();
|
2021-10-10 15:48:53 +02:00
|
|
|
|
header('Location: admin.php?page=gdk-options&update=true&panel='.$_POST['panel']);
|
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
case 'reset':
|
|
|
|
|
delete_option('gdk_options_setup');
|
|
|
|
|
gdk_update_options();
|
2021-10-10 15:48:53 +02:00
|
|
|
|
header('Location: admin.php?page=gdk-options&reset=true&panel='.$_POST['panel']);
|
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
2021-10-10 15:48:53 +02:00
|
|
|
|
|
2020-03-15 14:29:06 +01:00
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
add_menu_page('GDK选项', 'GDK选项', 'manage_options', 'gdk-options', 'gdk_options_page', 'dashicons-buddicons-replies');
|
2020-01-25 12:06:43 +01:00
|
|
|
|
}
|
2021-10-10 15:48:53 +02:00
|
|
|
|
add_action('admin_menu', 'gdk_add_options_page');
|