mirror of
https://github.com/yunluo/gdk.git
synced 2024-05-04 15:33:23 +02:00
更新代码
This commit is contained in:
parent
7255d0a179
commit
b7784ddf7f
|
@ -38,6 +38,7 @@ function gdk_enqueue_script_frontend()
|
|||
'gdk_weauth_check' => wp_create_nonce('gdk_weauth_check'),
|
||||
'gdk_payjs_alipay' => gdk_option('gdk_payjs_alipay'),
|
||||
'user_id' => get_current_user_id(),
|
||||
'msg_nonce' => wp_create_nonce('msg_nonce'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -577,5 +577,32 @@ jQuery(function ($) { /**声明加载jQuery */
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 在线留言
|
||||
*/
|
||||
$("#msg_submit").click(function () {
|
||||
var ajax_data = {
|
||||
action: $("#msg_submit").data("action"),
|
||||
mail: $("#msg_mail").val(),
|
||||
msg_content: $("#msg_content").val(),
|
||||
msg_nonce: gdk.msg_nonce
|
||||
};
|
||||
$.post(gdk.ajaxurl, ajax_data, function (b) {
|
||||
b = $.trim(b);
|
||||
if (b == '200') {
|
||||
$(".Anther_Guestbook").append('<div class="msg-message cm-alert success mt-2">您的留言已提交</div>');
|
||||
}
|
||||
if (b == '403') {
|
||||
$(".Anther_Guestbook").append('<div class="msg-message cm-alert error mt-2">请输入正确的邮箱</div>');
|
||||
}
|
||||
if (b == '400') {
|
||||
$(".Anther_Guestbook").append('<div class="msg-message cm-alert error mt-2">发送错误,请重试</div>');
|
||||
}
|
||||
setTimeout("$('.msg-message').remove()", 3000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**jQuery结尾,不要超过此行 */
|
||||
});
|
|
@ -57,8 +57,8 @@ class Wechat_Captcha
|
|||
//解析POST数据(XML格式)
|
||||
$object = simplexml_load_string($postData, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$messgeType = trim($object->MsgType); //取得消息类型
|
||||
$this->fromUser = "" . $object->FromUserName;
|
||||
$this->toUser = "" . $object->ToUserName;
|
||||
$this->fromUser = $object->FromUserName;
|
||||
$this->toUser = $object->ToUserName;
|
||||
$keyword = trim($object->Content);
|
||||
if ($messgeType == 'text' && $keyword == '验证码') {
|
||||
$response_content = '您的验证码为:【' . $this->captcha . '】,验证码有效期为2分钟,请抓紧使用,过期需重新申请';
|
||||
|
|
|
@ -364,3 +364,28 @@ function point_buy()
|
|||
}
|
||||
add_action('wp_ajax_gdk_pay_buy', 'point_buy');
|
||||
add_action('wp_ajax_nopriv_gdk_pay_buy', 'point_buy');
|
||||
|
||||
//ajax 表单
|
||||
function msg_form()
|
||||
{
|
||||
if (empty($_POST['mail']) || empty($_POST['msg_content']) || $_POST['action'] !== 'msg_submit' || !wp_verify_nonce($_POST['msg_nonce'], 'msg_nonce')) {
|
||||
exit('400');
|
||||
}
|
||||
if (!is_email($_POST['mail'])) {
|
||||
exit('403');
|
||||
}
|
||||
|
||||
$msg = array(
|
||||
'post_title' => '【来自' . $_POST['mail'] . '留言】',
|
||||
'post_author' => 1,
|
||||
'post_content' => $_POST['msg_content'],
|
||||
);
|
||||
// 将文章插入数据库
|
||||
$status = wp_insert_post($msg);
|
||||
if ($status != 0) {
|
||||
wp_mail(get_bloginfo('admin_email'), $msg['post_title'], $msg['post_content']);
|
||||
exit('200');
|
||||
}
|
||||
}
|
||||
add_action('wp_ajax_msg_submit', 'msg_form');
|
||||
add_action('wp_ajax_nopriv_msg_submit', 'msg_form');
|
||||
|
|
|
@ -759,7 +759,6 @@ function gdk_panlinks($links)
|
|||
//一个简单可重复使用的邮件模板
|
||||
function mail_temp($mail_title, $mail_cotent, $link, $link_title)
|
||||
{
|
||||
|
||||
$content = '<div style="width:500px;margin:auto">
|
||||
<h1 style="background:#2695f3;color:#fff;padding:20px 10px;">' . $mail_title . '</h1>
|
||||
<div style="padding:15px;border-bottom:dashed 1px #ddd;">' . $mail_cotent . '</div>
|
||||
|
@ -768,7 +767,6 @@ function mail_temp($mail_title, $mail_cotent, $link, $link_title)
|
|||
<div style="color:#cecece;font-size: 12px;">本邮件为系统自动发送,请勿回复。<br>
|
||||
如果不想被此类邮件打扰,请前往 <a style="color: #cecece;" href="' . home_url() . '" rel="noopener" target="_blank">' . get_option('blogname') . '</a> 留言说明,由我们来操作处理。
|
||||
</div></div>';
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
@ -829,7 +827,7 @@ function gdk_thumb_color()
|
|||
{
|
||||
switch (gdk_option('gdk_cdn_serves')) {
|
||||
case '1':
|
||||
case '3':
|
||||
case '3':
|
||||
return '?imageAve';
|
||||
break;
|
||||
case '2':
|
||||
|
@ -909,8 +907,9 @@ function gdk_thumbnail_src()
|
|||
function gdk_thumb_img($way, $width, $height, $atrr = 'class="thumb_img"')
|
||||
{
|
||||
$url = gdk_thumbnail_src();
|
||||
if ($way === 1) {//cdn
|
||||
$src = $url . gdk_thumb_style($width, $height);
|
||||
if ($way === 1) {
|
||||
//cdn
|
||||
$src = $url . gdk_thumb_style($width, $height);
|
||||
} elseif ($way === 2) {
|
||||
$src = GDK_BASE_URL . 'public/timthumb.php?src=' . $url . '&h=' . $height . '&w=' . $width . '&q=90&zc=1&ct=1';
|
||||
} elseif ($way === 3) {
|
||||
|
@ -1373,3 +1372,11 @@ function blank_open()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
function gdk_guest_form()
|
||||
{
|
||||
?>
|
||||
<p><textarea id="msg_content" placeholder="请输入留言内容" name="" rows="5" cols="" required></textarea></p>
|
||||
<p><input type="email" id="msg_mail" placeholder="请输入邮箱" style="margin-right:30px;" required/><input id="msg_submit" data-action="msg_submit" type="button" value="提交"></p>
|
||||
<?php
|
||||
}
|
|
@ -513,7 +513,7 @@ if (gdk_option('gdk_no_category')) {
|
|||
function gdk_notify_admin($notify_message, $comment_ID)
|
||||
{
|
||||
$notify = $notify_message;
|
||||
$notify .= '<br/> 快速回复此评论: ' . admin_url("edit-comments.php") . '#comment-' . $comment_ID;
|
||||
$notify .= '快速回复此评论: ' . admin_url("edit-comments.php") . '#comment-' . $comment_ID;
|
||||
return $notify;
|
||||
}
|
||||
add_filter('comment_notification_text', 'gdk_notify_admin', 10, 2);
|
||||
|
|
|
@ -124,7 +124,7 @@ if (!class_exists('GDK_Limit_Login_Attempts')) {
|
|||
}
|
||||
}
|
||||
|
||||
private function __when($time)
|
||||
private function when($time)
|
||||
{
|
||||
if (!$time) {
|
||||
return;
|
||||
|
@ -176,7 +176,7 @@ function gdk_disable_login_errors($error)
|
|||
}
|
||||
return $error;
|
||||
}
|
||||
add_filter('login_errors', 'gdk_disable_login_errors');
|
||||
//add_filter('login_errors', 'gdk_disable_login_errors');
|
||||
|
||||
//网站维护代码
|
||||
function gdk_maintenance_mode()
|
||||
|
|
|
@ -337,7 +337,7 @@ function gdk_table_shortcode_handler($atts, $content = '')
|
|||
}
|
||||
$output .= '</tbody>';
|
||||
$width = ' width="' . $width . '"';
|
||||
$output = '<table class="gdk-table"' . $width . ' >' . $output . '</table>\n';
|
||||
$output = '<table class="gdk-table"' . $width . ' >' . $output . '</table>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue