mirror of
https://github.com/yunluo/gdk.git
synced 2024-05-13 11:46:57 +02:00
修改大量代码
This commit is contained in:
parent
f7fbafca09
commit
7c6ee11ab4
|
@ -40,25 +40,38 @@ function gdk_admin_script() {
|
|||
<script>
|
||||
jQuery(function($) {
|
||||
/* bengin */
|
||||
$("#content").pasteUploadImage(ajaxurl);//ajax img upload
|
||||
$(".insert-shortcodes").click(function() {//shortcode botton
|
||||
if ($(".shortcodes-wrap").hasClass("is-active")) {
|
||||
$(".shortcodes-wrap").removeClass("is-active")
|
||||
} else {
|
||||
$(".shortcodes-wrap").addClass("is-active")
|
||||
}
|
||||
});
|
||||
$(".add-shortcode").click(function() {
|
||||
send_to_editor(" " + $(this).data("shortcodes") + " ");
|
||||
$(".shortcodes-wrap").removeClass("is-active");
|
||||
return false
|
||||
if ($("#ed_toolbar").length > 0) {
|
||||
/***文章编辑器 */
|
||||
QTags.addButton('ipre', '代码高亮', '<pre class="prettyprint linenums" >\n\n</pre>', "");
|
||||
$("#content").pasteUploadImage(ajaxurl); //ajax img upload
|
||||
$(".insert-shortcodes").click(function() { //shortcode botton
|
||||
if ($(".shortcodes-wrap").hasClass("is-active")) {
|
||||
$(".shortcodes-wrap").removeClass("is-active")
|
||||
} else {
|
||||
$(".shortcodes-wrap").addClass("is-active")
|
||||
}
|
||||
});
|
||||
$(".add-shortcode").click(function() {
|
||||
send_to_editor(" " + $(this).data("shortcodes") + " ");
|
||||
$(".shortcodes-wrap").removeClass("is-active");
|
||||
return false
|
||||
});
|
||||
}
|
||||
|
||||
$("textarea").keypress(function(e){
|
||||
if(e.ctrlKey&&e.which==13||e.which==10){
|
||||
$("#replybtn").click();
|
||||
}
|
||||
});
|
||||
if ($("#replysubmit").length > 0) {
|
||||
/**评论框 */
|
||||
$("textarea").keypress(function(e) {
|
||||
if (e.ctrlKey && e.which == 13 || e.which == 10) {
|
||||
$("#replybtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**end**/
|
||||
|
||||
});
|
||||
|
@ -68,8 +81,8 @@ jQuery(function($) {
|
|||
}
|
||||
add_action('admin_footer','gdk_admin_script');
|
||||
|
||||
function git_admin_style() {
|
||||
function gdk_admin_style() {
|
||||
?><style>*{font-family: "Microsoft YaHei";}.shortcodes-wrap{background:#fff;border: 1px solid #ccc;box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.24);padding: 10px;position: absolute;top:54px;width:500px;display:none}.is-active.shortcodes-wrap{display:block}.insert-shortcodes{padding-left:35px!important}#insert-shortcode-button {background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj4gPHBhdGggZD0iTTI5MC41OSAxOTJjLTIwLjE4IDAtMTA2LjgyIDEuOTgtMTYyLjU5IDg1Ljk1VjE5MmMwLTUyLjk0LTQzLjA2LTk2LTk2LTk2LTE3LjY3IDAtMzIgMTQuMzMtMzIgMzJzMTQuMzMgMzIgMzIgMzJjMTcuNjQgMCAzMiAxNC4zNiAzMiAzMnYyNTZjMCAzNS4zIDI4LjcgNjQgNjQgNjRoMTc2YzguODQgMCAxNi03LjE2IDE2LTE2di0xNmMwLTE3LjY3LTE0LjMzLTMyLTMyLTMyaC0zMmwxMjgtOTZ2MTQ0YzAgOC44NCA3LjE2IDE2IDE2IDE2aDMyYzguODQgMCAxNi03LjE2IDE2LTE2VjI4OS44NmMtMTAuMjkgMi42Ny0yMC44OSA0LjU0LTMyIDQuNTQtNjEuODEgMC0xMTMuNTItNDQuMDUtMTI1LjQxLTEwMi40ek00NDggOTZoLTY0bC02NC02NHYxMzQuNGMwIDUzLjAyIDQyLjk4IDk2IDk2IDk2czk2LTQyLjk4IDk2LTk2VjMybC02NCA2NHptLTcyIDgwYy04Ljg0IDAtMTYtNy4xNi0xNi0xNnM3LjE2LTE2IDE2LTE2IDE2IDcuMTYgMTYgMTYtNy4xNiAxNi0xNiAxNnptODAgMGMtOC44NCAwLTE2LTcuMTYtMTYtMTZzNy4xNi0xNiAxNi0xNiAxNiA3LjE2IDE2IDE2LTcuMTYgMTYtMTYgMTZ6Ij48L3BhdGg+IDwvc3ZnPg==) no-repeat left/30%;background-position: 10% 40%;}#wp-content-media-buttons > div> a:nth-child(20){background:#f6003c;border-color:#f6003c;color:#fff;}.wp-block{max-width:45pc}.wp-block[data-align=wide]{max-width:810pt}.wp-block[data-align=full]{max-width:none}</style>
|
||||
<?php
|
||||
}
|
||||
add_action('admin_head', 'git_admin_style');
|
||||
add_action('admin_head', 'gdk_admin_style');
|
|
@ -83,7 +83,7 @@ public static function pay($atts, $content = null) {
|
|||
$notice.= '<div class="alert alert-info"">';
|
||||
$notice.= '<p style="color:red;">本段内容需要支付 ' . $point . '金币查看</p>';
|
||||
$notice.= '<p style="color:red;">您当前拥有 <em><strong>' . Points::get_user_total_points($user_id, 'accepted') . '</strong></em> 金币,您的金币不足,请充值</p>';
|
||||
$notice.= '<p><a class="lhb" href="' . get_permalink(git_page_id('chongzhi')) . '" target="_blank" rel="nofollow" data-original-title="立即充值" title="">立即充值</a></p>';
|
||||
$notice.= '<p><a class="lhb" href="' . get_permalink(gdk_page_id('chongzhi')) . '" target="_blank" rel="nofollow" data-original-title="立即充值" title="">立即充值</a></p>';
|
||||
$notice.= '</div>';
|
||||
} else {
|
||||
$notice.= '<div id="pay_notice" class="alert alert-info"">';
|
||||
|
|
|
@ -139,20 +139,20 @@ $gdk_options = [
|
|||
[
|
||||
'name' => '网站关键字',//选项显示的文字,选填
|
||||
'desc' => '各关键字间用半角逗号','分割,数量在6个以内最佳。',//选项显示的一段描述文字,选填
|
||||
'id' => 'git_keywords',//选项的id,必须是唯一,后面根据这个获取值,必填
|
||||
'id' => 'gdk_keywords',//选项的id,必须是唯一,后面根据这个获取值,必填
|
||||
'type' => 'text',//种类,这个是普通的文字输入,必填
|
||||
'std' => ''//选项的默认值,选填
|
||||
],
|
||||
[
|
||||
'name' => '网站描述',
|
||||
'desc' => '用简洁的文字描述本站点,字数建议在120个字以内。',
|
||||
'id' => 'git_description',
|
||||
'id' => 'gdk_description',
|
||||
'type' => 'text'
|
||||
],
|
||||
[
|
||||
'name' => 'title分隔符',
|
||||
'desc' => '显示在浏览器标题栏的一个用来风格网站名字的',
|
||||
'id' => 'git_delimiter',
|
||||
'id' => 'gdk_delimiter',
|
||||
'type' => 'text',
|
||||
'std' => '|'
|
||||
],
|
||||
|
@ -383,7 +383,7 @@ $gdk_options = [
|
|||
[
|
||||
'name' => '侧边栏缓存',
|
||||
'desc' => '启用 【开启后,将会自动缓存小工具,如果想禁止缓存某个小工具,可以去小工具页面排除】',
|
||||
'id' => 'git_sidebar_cache',
|
||||
'id' => 'gdk_sidebar_cache',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
[
|
||||
|
@ -478,7 +478,7 @@ $gdk_options = [
|
|||
[
|
||||
'name' => 'CDN镜像后台化',
|
||||
'desc' => '启用【一般可不启用,如果您启用CDN镜像之后并在FTP删除了本地文件,则必须开启】',
|
||||
'id' => 'git_adminqn_b',
|
||||
'id' => 'gdk_adminqn_b',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
[
|
||||
|
@ -488,13 +488,13 @@ $gdk_options = [
|
|||
[
|
||||
'name' => '是否启用微信扫码登录',
|
||||
'desc' => '启用 【开启后,新建微信登录页面即可,另外需要HTTPS】',
|
||||
'id' => 'git_weauth_oauth',
|
||||
'id' => 'gdk_weauth_oauth',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
[
|
||||
'name' => '是否启用强制微信登录',
|
||||
'desc' => '启用 【开启后,将禁用WordPress自带的登录,所有登录地址都跳转到微信的登录,如需临时使用自带登录,可以使用这个链接:你的域名/wp-login.php?loggedout=true】',
|
||||
'id' => 'git_weauth_oauth_force',
|
||||
'id' => 'gdk_weauth_oauth_force',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
[
|
||||
|
@ -504,34 +504,34 @@ $gdk_options = [
|
|||
[
|
||||
'name' => '评论微信推送提醒',
|
||||
'desc' => '启用【开启后,如果网站有新的评论,可以给您的微信推送提醒,这个只是给网站管理员提醒,不涉及访客】',
|
||||
'id' => 'git_Server',
|
||||
'id' => 'gdk_Server',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
[
|
||||
'name' => '微信推送KEY',
|
||||
'desc' => '请输入您的微信推送KEY',
|
||||
'id' => 'git_Server_key',
|
||||
'id' => 'gdk_Server_key',
|
||||
'type' => 'text',
|
||||
'std' => ''
|
||||
],
|
||||
[
|
||||
'name' => '微信订阅号/公众号二维码',
|
||||
'desc' => '请输入您的微信订阅号/公众号二维码图片链接,不要想得太多,只是给主题调用的。',
|
||||
'id' => 'git_mp_qr',
|
||||
'id' => 'gdk_mp_qr',
|
||||
'type' => 'text',
|
||||
'std' => ''
|
||||
],
|
||||
[
|
||||
'name' => '微信验证码',
|
||||
'desc' => '请输入您的微信验证码,这里的必须要要和微信里面回复的保持一致。',
|
||||
'id' => 'git_mp_code',
|
||||
'id' => 'gdk_mp_code',
|
||||
'type' => 'text',
|
||||
'std' => '2233'
|
||||
],
|
||||
[
|
||||
'name' => '微信可见提示信息,可用html代码',
|
||||
'desc' => '在本输入框内输入您的微信公众号描述信息,支持html代码,字数合适就行,不能太多',
|
||||
'id' => 'git_mp_tips',
|
||||
'id' => 'gdk_mp_tips',
|
||||
'type' => 'textarea',
|
||||
'std' => '请关注极客公园官方微信公众号,关注并订阅<span class="key_word">云落极客公园</span>获取验证码。在微信里搜索<span class="key_word">云落极客公园</span>或者微信扫描二维码都可以关注极客公园官方微信公众号。'
|
||||
],
|
||||
|
@ -553,42 +553,42 @@ $gdk_options = [
|
|||
[
|
||||
'name' => 'HTML5推送标题【必选】',
|
||||
'desc' => '显示在弹窗顶部',
|
||||
'id' => 'git_notification_title',
|
||||
'id' => 'gdk_notification_title',
|
||||
'type' => 'text',
|
||||
'std' => 'Hi,你好'
|
||||
],
|
||||
[
|
||||
'name' => 'HTML5推送间隔【必选】',
|
||||
'desc' => '输入数字,当自动关闭或者用户关闭之后多久再次弹窗,默认10天',
|
||||
'id' => 'git_notification_days',
|
||||
'id' => 'gdk_notification_days',
|
||||
'type' => 'number',
|
||||
'std' => 10
|
||||
],
|
||||
[
|
||||
'name' => 'HTML5推送COOKIE【必选】',
|
||||
'desc' => '修改COOKIE值可以强制向访客推送新的信息,无视时间间隔,不能使用中文,默认233',
|
||||
'id' => 'git_notification_cookie',
|
||||
'id' => 'gdk_notification_cookie',
|
||||
'type' => 'text',
|
||||
'std' => '233'
|
||||
],
|
||||
[
|
||||
'name' => 'HTML5推送图片【必选】',
|
||||
'desc' => '填写一个正方形的图片,显示在推送信息左侧,默认为默认头像',
|
||||
'id' => 'git_notification_icon',
|
||||
'id' => 'gdk_notification_icon',
|
||||
'type' => 'text',
|
||||
'std' => '',
|
||||
],
|
||||
[
|
||||
'name' => 'HTML5推送链接【可选】',
|
||||
'desc' => '当用户点击弹窗的时候说点击的链接,默认为极客公园',
|
||||
'id' => 'git_notification_link',
|
||||
'id' => 'gdk_notification_link',
|
||||
'type' => 'text',
|
||||
'std' => 'https://gitcafe.net'
|
||||
],
|
||||
[
|
||||
'name' => 'HTML5推送内容',
|
||||
'desc' => '在这里输入推送主体内容,字数合适就行,不能太多【必选】',
|
||||
'id' => 'git_notification_body',
|
||||
'id' => 'gdk_notification_body',
|
||||
'type' => 'textarea',
|
||||
'std' => '极客公园,一个分享有趣的安卓APP和实用的WordPress技术以及Windows使用技巧的网站'
|
||||
],
|
||||
|
|
|
@ -366,8 +366,8 @@ depend('gdk_smtp','#row-gdk_smtp_username,#row-gdk_smtp_host,#row-gdk_smtp_port,
|
|||
depend('gdk_baidu_push','#row-gdk_baidu_token');
|
||||
depend('gdk_tag_link','#row-gdk_tag_num');
|
||||
depend('gdk_cdn','#row-gdk_cdn_host,#row-gdk_cdn_ext,#row-gdk_cdn_dir,#row-gdk_cdn_style,#row-gdk_cdn_water');
|
||||
depend('gdk_h5notice','#row-git_notification_title,#row-git_notification_days,#row-git_notification_cookie,#row-git_notification_icon,#row-git_notification_link,#row-git_notification_body');
|
||||
depend('gdk_payjs','#row-gdk_rate,#row-git_payjs_rate,#row-gdk_payjs_id,#row-gdk_payjs_key');
|
||||
depend('gdk_h5notice','#row-gdk_notification_title,#row-gdk_notification_days,#row-gdk_notification_cookie,#row-gdk_notification_icon,#row-gdk_notification_link,#row-gdk_notification_body');
|
||||
depend('gdk_payjs','#row-gdk_rate,#row-gdk_payjs_rate,#row-gdk_payjs_id,#row-gdk_payjs_key');
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -132,7 +132,7 @@ function getcontent() {
|
|||
$id = $_POST["id"];
|
||||
$action = $_POST["action"];
|
||||
if ( isset($id) && $_POST['action'] == 'getcontent') {
|
||||
$pay_content = get_post_meta($id, 'git_pay_content', true);
|
||||
$pay_content = get_post_meta($id, 'gdk_pay_content', true);
|
||||
exit($pay_content);
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ function payjs_view(){
|
|||
$data = [
|
||||
'body' => '在线付费查看', // 订单标题
|
||||
'attach' => 'P'.$id,
|
||||
'out_trade_no' => git_order_id(), // 订单号
|
||||
'out_trade_no' => gdk_order_id(), // 订单号
|
||||
'total_fee' => intval($money)*100, // 金额,单位:分
|
||||
'notify_url' => GDK_BASE_URL.'/public/push.php',
|
||||
'hide' => '1'
|
||||
|
@ -181,7 +181,7 @@ function payjs_view(){
|
|||
if($way == 1) $data['type'] = 'alipay';
|
||||
$result_money = intval($money);
|
||||
$result_trade_no = $data['out_trade_no'];
|
||||
if(git_is_mobile()){
|
||||
if(gdk_is_mobile()){
|
||||
$rst = $payjs->cashier($data);//手机使用
|
||||
$result_img = $rst;
|
||||
}else{
|
||||
|
@ -240,28 +240,28 @@ add_action( 'wp_ajax_nopriv_addcode', 'addcode' );
|
|||
function pay_chongzhi() {
|
||||
if (isset($_POST['jine']) && $_POST['action'] == 'pay_chongzhi') {
|
||||
$config = [
|
||||
'mchid' => git_get_option('git_payjs_id'), // 配置商户号
|
||||
'key' => git_get_option('git_payjs_secret'), // 配置通信密钥
|
||||
'mchid' => gdk_option('gdk_payjs_id'), // 配置商户号
|
||||
'key' => gdk_option('gdk_payjs_secret'), // 配置通信密钥
|
||||
];
|
||||
// 初始化
|
||||
$payjs = new Payjs($config);
|
||||
$data = [
|
||||
'body' => '积分充值', // 订单标题
|
||||
'attach' => get_current_user_id(), // 订单备注
|
||||
'out_trade_no' => git_order_id(), // 订单号
|
||||
'out_trade_no' => gdk_order_id(), // 订单号
|
||||
'total_fee' => intval($_POST['jine'])*100, // 金额,单位:分
|
||||
'notify_url' => GDK_BASE_URL.'/public/push.php',
|
||||
'hide' => '1'
|
||||
];
|
||||
$result_money = intval($_POST['jine']);
|
||||
$result_trade_no = $data['out_trade_no'];
|
||||
if( git_get_option('git_payjs_alipay') && $_POST['way'] =='alipay' ) {
|
||||
if( gdk_option('gdk_payjs_alipay') && $_POST['way'] =='alipay' ) {
|
||||
$data['type'] = 'alipay';
|
||||
$result_way = '支付宝';
|
||||
} else {
|
||||
$result_way = '微信';
|
||||
}
|
||||
if(git_is_mobile()) {
|
||||
if(gdk_is_mobile()) {
|
||||
$rst = $payjs->cashier($data);//手机使用
|
||||
$result_img = $rst;
|
||||
} else {
|
||||
|
@ -278,7 +278,7 @@ add_action( 'wp_ajax_nopriv_pay_chongzhi', 'pay_chongzhi' );
|
|||
//检查付款情况
|
||||
function payrest(){
|
||||
if (isset($_POST['check_trade_no']) && $_POST['action'] == 'payrest') {
|
||||
if (git_check($_POST['check_trade_no'])) {
|
||||
if (gdk_check($_POST['check_trade_no'])) {
|
||||
exit('1');
|
||||
} else {
|
||||
exit('0');
|
||||
|
|
|
@ -931,8 +931,8 @@ function gdk_term_meta($term,$meta,$id) {
|
|||
function gdk_thumbnail_src() {
|
||||
global $post;
|
||||
$gdk_thumbnail_src = '';
|
||||
if ($values = get_post_custom_values('git_thumb')) { //输出自定义域图片地址
|
||||
$values = get_post_custom_values('git_thumb');
|
||||
if ($values = get_post_custom_values('gdk_thumb')) { //输出自定义域图片地址
|
||||
$values = get_post_custom_values('gdk_thumb');
|
||||
$gdk_thumbnail_src = $values[0];
|
||||
} elseif (has_post_thumbnail()) { //如果有特色缩略图,则输出缩略图地址
|
||||
$thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID) , 'full');
|
||||
|
@ -952,7 +952,7 @@ function gdk_thumbnail_src() {
|
|||
|
||||
|
||||
//生成订单号编码
|
||||
function git_order_id(){
|
||||
function gdk_order_id(){
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
$order_id = 'E' . date("YmdHis") . mt_rand(10000, 99999);
|
||||
return $order_id;
|
||||
|
@ -974,7 +974,7 @@ function get_Yunluo_Notice(){
|
|||
}
|
||||
|
||||
//获取页面id,并且不可重用
|
||||
function git_page_id( $pagephp ) {
|
||||
function gdk_page_id( $pagephp ) {
|
||||
global $wpdb;
|
||||
$pagephp = esc_sql($pagephp);
|
||||
$pageid = $wpdb->get_row("SELECT `post_id` FROM `{$wpdb->postmeta}` WHERE `meta_value` = 'pages/{$pagephp}.php'", ARRAY_A) ['post_id'];
|
||||
|
@ -982,7 +982,7 @@ function git_page_id( $pagephp ) {
|
|||
}
|
||||
|
||||
//根据订单描述金币数据,d=订单号 u=用户id
|
||||
function git_check( $d , $u = null) {
|
||||
function gdk_check( $d , $u = null) {
|
||||
global $wpdb;
|
||||
$des = " WHERE `description` = '" . $d . "'";
|
||||
$userid = "";
|
||||
|
@ -1008,7 +1008,7 @@ function get_the_link_items($id = null) {
|
|||
}
|
||||
|
||||
function get_link_items() {
|
||||
$linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude=' . git_get_option('git_linkpage_cat'));
|
||||
$linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude=' . gdk_option('gdk_linkpage_cat'));
|
||||
if (!empty($linkcats)) {
|
||||
foreach ($linkcats as $linkcat) {
|
||||
$result.= '<h2 class="link_title">' . $linkcat->name . '</h2>';
|
||||
|
|
|
@ -143,20 +143,6 @@ function gdk_cdn_water($content) {
|
|||
}
|
||||
|
||||
|
||||
//自动替换媒体库图片的域名
|
||||
if (is_admin() && gdk_option('gdk_cdn')) {
|
||||
function attachment_replace($text) {
|
||||
$replace = array(
|
||||
home_url() => gdk_option('gdk_cdn')
|
||||
);
|
||||
$text = str_replace(array_keys($replace) , $replace, $text);
|
||||
return $text;
|
||||
}
|
||||
add_filter('wp_get_attachment_url', 'attachment_replace');
|
||||
}
|
||||
|
||||
|
||||
|
||||
//压缩html代码
|
||||
if (gdk_option('gdk_compress')) {
|
||||
function gdk_compress_html(){
|
||||
|
@ -206,7 +192,7 @@ if (gdk_option('gdk_compress')) {
|
|||
}
|
||||
|
||||
//只搜索文章标题
|
||||
function git_search_by_title($search, $wp_query) {
|
||||
function gdk_search_by_title($search, $wp_query) {
|
||||
if (!empty($search) && !empty($wp_query->query_vars['search_terms'])) {
|
||||
global $wpdb;
|
||||
$q = $wp_query->query_vars;
|
||||
|
@ -222,13 +208,13 @@ function git_search_by_title($search, $wp_query) {
|
|||
}
|
||||
return $search;
|
||||
}
|
||||
add_filter('posts_search', 'git_search_by_title', 10, 2);
|
||||
add_filter('posts_search', 'gdk_search_by_title', 10, 2);
|
||||
|
||||
//评论地址更换
|
||||
function git_comment_author( $query_vars ) {
|
||||
function gdk_comment_author( $query_vars ) {
|
||||
if ( array_key_exists( 'author_name', $query_vars ) ) {
|
||||
global $wpdb;
|
||||
$author_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key='first_name' AND meta_value = %s", $query_vars['author_name'] ) );
|
||||
$author_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'first_name' AND meta_value = %s", $query_vars['author_name'] ) );
|
||||
if ( $author_id ) {
|
||||
$query_vars['author'] = $author_id;
|
||||
unset( $query_vars['author_name'] );
|
||||
|
@ -236,19 +222,19 @@ function git_comment_author( $query_vars ) {
|
|||
}
|
||||
return $query_vars;
|
||||
}
|
||||
add_filter( 'request', 'git_comment_author' );
|
||||
add_filter( 'request', 'gdk_comment_author' );
|
||||
|
||||
function git_comment_author_link( $link, $author_id, $author_nicename ) {
|
||||
function gdk_comment_author_link( $link, $author_id, $author_nicename ) {
|
||||
$my_name = get_user_meta( $author_id, 'first_name', true );
|
||||
if ( $my_name ) {
|
||||
$link = str_replace( $author_nicename, $my_name, $link );
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
add_filter( 'author_link', 'git_comment_author_link', 10, 3 );
|
||||
add_filter( 'author_link', 'gdk_comment_author_link', 10, 3 );
|
||||
|
||||
//文章目录,来自露兜,云落修改
|
||||
if (git_get_option('git_article_list')) {
|
||||
if (gdk_option('gdk_article_list')) {
|
||||
function article_index($content) {
|
||||
$matches = array();
|
||||
$ul_li = '';
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
|
||||
//SMTP邮箱设置
|
||||
/*
|
||||
if (git_get_option('git_mailsmtp_b')) {
|
||||
if (gdk_option('gdk_mailsmtp_b')) {
|
||||
function googlo_mail_smtp($phpmailer) {
|
||||
$phpmailer->From = git_get_option('git_maildizhi_b'); //发件人地址
|
||||
$phpmailer->FromName = git_get_option('git_mailnichen_b'); //发件人昵称
|
||||
$phpmailer->Host = git_get_option('git_mailsmtp_b'); //SMTP服务器地址
|
||||
$phpmailer->Port = git_get_option('git_mailport_b'); //SMTP邮件发送端口
|
||||
if (git_get_option('git_smtpssl_b')) {
|
||||
$phpmailer->From = gdk_option('gdk_maildizhi_b'); //发件人地址
|
||||
$phpmailer->FromName = gdk_option('gdk_mailnichen_b'); //发件人昵称
|
||||
$phpmailer->Host = gdk_option('gdk_mailsmtp_b'); //SMTP服务器地址
|
||||
$phpmailer->Port = gdk_option('gdk_mailport_b'); //SMTP邮件发送端口
|
||||
if (gdk_option('gdk_smtpssl_b')) {
|
||||
$phpmailer->SMTPSecure = 'ssl';
|
||||
} else {
|
||||
$phpmailer->SMTPSecure = '';
|
||||
} //SMTP加密方式(SSL/TLS)没有为空即可
|
||||
$phpmailer->Username = git_get_option('git_mailuser_b'); //邮箱帐号
|
||||
$phpmailer->Password = git_get_option('git_mailpass_b'); //邮箱密码
|
||||
$phpmailer->Username = gdk_option('gdk_mailuser_b'); //邮箱帐号
|
||||
$phpmailer->Password = gdk_option('gdk_mailpass_b'); //邮箱密码
|
||||
$phpmailer->IsSMTP();
|
||||
$phpmailer->SMTPAuth = true; //启用SMTPAuth服务
|
||||
|
||||
|
@ -61,17 +61,17 @@ function comment_mail_notify($comment_id) {
|
|||
add_action('comment_post', 'comment_mail_notify');
|
||||
|
||||
//站长评论邮件添加评论链接
|
||||
function git_notify_postauthor($notify_message,$comment_ID) {
|
||||
function gdk_notify_postauthor($notify_message,$comment_ID) {
|
||||
$notify = $notify_message;
|
||||
$notify.= '快速回复此评论: ' . admin_url("edit-comments.php").'#comment-'.$comment_ID;
|
||||
return $notify;
|
||||
}
|
||||
add_filter('comment_notification_text', 'git_notify_postauthor', 10, 2);
|
||||
add_filter('comment_notification_text', 'gdk_notify_postauthor', 10, 2);
|
||||
|
||||
|
||||
//欢迎新用户邮件
|
||||
|
||||
function git_register_mail($user_id) {
|
||||
function gdk_register_mail($user_id) {
|
||||
$user = get_user_by('id', $user_id);
|
||||
$user_pass = $_POST['password'];
|
||||
$blogname = get_option('blogname');
|
||||
|
@ -79,13 +79,13 @@ add_filter('comment_notification_text', 'git_notify_postauthor', 10, 2);
|
|||
$headers = "Content-Type:text/html;charset=UTF-8\n";
|
||||
wp_mail($user->user_email, '[' . $blogname . ']欢迎注册' . $blogname, $message, $headers);
|
||||
}
|
||||
add_action('user_register', 'git_register_mail');
|
||||
add_action('user_register', 'gdk_register_mail');
|
||||
|
||||
|
||||
|
||||
//登录失败提醒
|
||||
|
||||
function git_login_failed_notify() {
|
||||
function gdk_login_failed_notify() {
|
||||
date_default_timezone_set('PRC');
|
||||
$admin_email = get_bloginfo('admin_email');
|
||||
$to = $admin_email;
|
||||
|
@ -96,4 +96,4 @@ add_filter('comment_notification_text', 'git_notify_postauthor', 10, 2);
|
|||
$headers = "$from\nContent-Type: text/html; charset=" . get_option('blog_charset') . "\n";
|
||||
wp_mail($to, $subject, $message, $headers);
|
||||
}
|
||||
add_action('wp_login_failed', 'git_login_failed_notify');
|
||||
add_action('wp_login_failed', 'gdk_login_failed_notify');
|
||||
|
|
|
@ -647,13 +647,13 @@ function gdk_add_last_login($value, $column_name, $user_id) {
|
|||
add_action('manage_users_custom_column', 'gdk_add_last_login', 10, 3);
|
||||
|
||||
// 评论添加@,来自:http://www.ludou.org/wordpress-comment-reply-add-at.html
|
||||
function git_comment_add_at($comment_text, $comment = '') {
|
||||
function gdk_comment_add_at($comment_text, $comment = '') {
|
||||
if ($comment->comment_parent > 0) {
|
||||
$comment_text = '@<a href="#comment-' . $comment->comment_parent . '">' . get_comment_author($comment->comment_parent) . '</a> ' . $comment_text;
|
||||
}
|
||||
return $comment_text;
|
||||
}
|
||||
add_filter('comment_text', 'git_comment_add_at', 20, 2);
|
||||
add_filter('comment_text', 'gdk_comment_add_at', 20, 2);
|
||||
|
||||
//搜索结果排除所有页面
|
||||
function search_filter_page($query) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
//百度收录提示
|
||||
if (git_get_option('git_baidurecord_b') && function_exists('curl_init')) {
|
||||
if (gdk_option('gdk_baidurecord_b') && function_exists('curl_init')) {
|
||||
function baidu_check($url, $post_id){
|
||||
$baidu_record = get_post_meta($post_id, 'baidu_record', true);
|
||||
if ($baidu_record != 1) {
|
||||
|
@ -44,11 +44,11 @@ if (git_get_option('git_baidurecord_b') && function_exists('curl_init')) {
|
|||
|
||||
|
||||
//百度主动推送
|
||||
if (git_get_option('git_sitemap_api')) {
|
||||
if (gdk_option('gdk_sitemap_api')) {
|
||||
function Git_Baidu_Submit($post_ID) {
|
||||
if (get_post_meta($post_ID, 'git_baidu_submit', true) == 1) return;
|
||||
if (get_post_meta($post_ID, 'gdk_baidu_submit', true) == 1) return;
|
||||
$url = get_permalink($post_ID);
|
||||
$api = git_get_option('git_sitemap_api');
|
||||
$api = gdk_option('gdk_sitemap_api');
|
||||
$request = new WP_Http;
|
||||
$result = $request->request($api, array(
|
||||
'method' => 'POST',
|
||||
|
@ -60,7 +60,7 @@ if (git_get_option('git_sitemap_api')) {
|
|||
$result = json_decode($result['body'], true);
|
||||
}
|
||||
if (array_key_exists('success', $result)) {
|
||||
add_post_meta($post_ID, 'git_baidu_submit', 1, true);
|
||||
add_post_meta($post_ID, 'gdk_baidu_submit', 1, true);
|
||||
}
|
||||
}
|
||||
add_action('publish_post', 'Git_Baidu_Submit', 0);
|
||||
|
@ -68,7 +68,7 @@ if (git_get_option('git_sitemap_api')) {
|
|||
|
||||
//强制微信登录
|
||||
function force_weauth_login_url( $login_url, $redirect, $force_reauth ){
|
||||
$login_url = get_permalink(git_page_id('weauth'));
|
||||
$login_url = get_permalink(gdk_page_id('weauth'));
|
||||
if ( ! empty( $redirect ) ) {
|
||||
$login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
|
||||
}
|
||||
|
@ -76,19 +76,19 @@ function force_weauth_login_url( $login_url, $redirect, $force_reauth ){
|
|||
$login_url = add_query_arg( 'reauth', '1', $login_url );
|
||||
}
|
||||
return $login_url;
|
||||
}if(git_get_option('git_weauth_oauth') && git_get_option('git_weauth_oauth_force')){
|
||||
}if(gdk_option('gdk_weauth_oauth') && gdk_option('gdk_weauth_oauth_force')){
|
||||
add_filter( 'login_url', 'force_weauth_login_url', 10, 3 );
|
||||
}
|
||||
|
||||
//在登录框添加额外的微信登录
|
||||
function weixin_login_button() {
|
||||
echo '<p><a class="button button-large" href="'.get_permalink(git_page_id('weauth')).'">微信登录</a></p><br>';
|
||||
}if(git_get_option('git_weauth_oauth')){
|
||||
echo '<p><a class="button button-large" href="'.get_permalink(gdk_page_id('weauth')).'">微信登录</a></p><br>';
|
||||
}if(gdk_option('gdk_weauth_oauth')){
|
||||
add_action('login_form', 'weixin_login_button');
|
||||
}
|
||||
|
||||
//评论微信推送
|
||||
if (git_get_option('git_Server') && !is_admin()) {
|
||||
if (gdk_option('gdk_Server') && !is_admin()) {
|
||||
function sc_send($comment_id) {
|
||||
$text = '网站上有新的评论,请及时查看'; //微信推送信息标题
|
||||
$comment = get_comment($comment_id);
|
||||
|
@ -99,7 +99,7 @@ if (git_get_option('git_Server') && !is_admin()) {
|
|||
* 文章标题 :' . get_the_title() . '
|
||||
* 文章链接 :' . get_the_permalink($comment->comment_post_ID) . '
|
||||
'; //微信推送内容正文
|
||||
$key = git_get_option('git_Server_key');
|
||||
$key = gdk_option('gdk_Server_key');
|
||||
$postdata = http_build_query(array(
|
||||
'text' => $text,
|
||||
'desp' => $desp
|
||||
|
@ -120,7 +120,7 @@ if (git_get_option('git_Server') && !is_admin()) {
|
|||
//增加B站视频
|
||||
wp_embed_unregister_handler('bili');
|
||||
function wp_bili($matches, $attr, $url, $rawattr) {
|
||||
if (git_is_mobile()) {
|
||||
if (gdk_is_mobile()) {
|
||||
$height = 200;
|
||||
} else {
|
||||
$height = 480;
|
||||
|
@ -132,8 +132,8 @@ wp_embed_register_handler('bili_iframe', '#https://www.bilibili.com/video/av(.*?
|
|||
|
||||
//bing美图自定义登录页面背景
|
||||
function custom_login_head() {
|
||||
if (git_get_option('git_loginbg')) {
|
||||
$imgurl = git_get_option('git_loginbg');
|
||||
if (gdk_option('gdk_loginbg')) {
|
||||
$imgurl = gdk_option('gdk_loginbg');
|
||||
} else {
|
||||
$imgurl = get_transient('Bing_img');
|
||||
if(false === $imgurl){
|
||||
|
@ -151,7 +151,7 @@ add_action('login_head', 'custom_login_head');
|
|||
|
||||
// add youku using iframe
|
||||
function wp_iframe_handler_youku($matches, $attr, $url, $rawattr) {
|
||||
if (git_is_mobile()) {
|
||||
if (gdk_is_mobile()) {
|
||||
$height = 200;
|
||||
} else {
|
||||
$height = 485;
|
||||
|
|
|
@ -136,19 +136,19 @@ function ton($atts, $content = null) {
|
|||
"filesize" => '',
|
||||
"filedown" => ''
|
||||
) , $atts));
|
||||
return '<a class="lhb" id="showdiv" href="#fancydlbox" >文件下载</a><div id="fancydlbox" style="cursor:default;display:none;width:800px;"><div class="part" style="padding:20px 0;"><h2>下载声明:</h2> <div class="fancydlads" align="left"><p>' . git_get_option('git_fancydlcp') . '</p></div></div><div class="part" style="padding:20px 0;"><h2>文件信息:</h2> <div class="dlnotice" align="left"><p>文件名称:' . $filename . '<br />文件大小:' . $filesize . '<br />发布日期:' . get_the_modified_time('Y年n月j日') . '</p></div></div><div class="part" id="download_button_part"><a id="download_button" target="_blank" href="' . $href . '"><span></span>' . $filedown . '</a> </div><div class="part" style="padding:20px 0;"><div class="moredl" style="text-align:center;">[更多地址] : ' . $content . '</div></div><div class="dlfooter">' . git_get_option('git_fancydlad') . '</div></div>';
|
||||
return '<a class="lhb" id="showdiv" href="#fancydlbox" >文件下载</a><div id="fancydlbox" style="cursor:default;display:none;width:800px;"><div class="part" style="padding:20px 0;"><h2>下载声明:</h2> <div class="fancydlads" align="left"><p>' . gdk_option('gdk_fancydlcp') . '</p></div></div><div class="part" style="padding:20px 0;"><h2>文件信息:</h2> <div class="dlnotice" align="left"><p>文件名称:' . $filename . '<br />文件大小:' . $filesize . '<br />发布日期:' . get_the_modified_time('Y年n月j日') . '</p></div></div><div class="part" id="download_button_part"><a id="download_button" target="_blank" href="' . $href . '"><span></span>' . $filedown . '</a> </div><div class="part" style="padding:20px 0;"><div class="moredl" style="text-align:center;">[更多地址] : ' . $content . '</div></div><div class="dlfooter">' . gdk_option('gdk_fancydlad') . '</div></div>';
|
||||
}
|
||||
add_shortcode('fanctdl', 'ton');
|
||||
//代码演示短代码
|
||||
function git_demo($atts, $content = null) {
|
||||
return '<a class="lhb" href="' . get_permalink(git_page_id('demo')) . '?pid=' . get_the_ID() . '" target="_blank" rel="nofollow">' . $content . '</a>';
|
||||
function gdk_demo($atts, $content = null) {
|
||||
return '<a class="lhb" href="' . get_permalink(gdk_page_id('demo')) . '?pid=' . get_the_ID() . '" target="_blank" rel="nofollow">' . $content . '</a>';
|
||||
}
|
||||
add_shortcode('demo', 'git_demo');
|
||||
add_shortcode('demo', 'gdk_demo');
|
||||
//下载单页短代码
|
||||
function git_download($atts, $content = null) {
|
||||
return '<a class="lhb" href="' . get_permalink(git_page_id('download')) . '?pid=' . get_the_ID() . '" target="_blank" rel="nofollow">' . $content . '</a>';
|
||||
function gdk_download($atts, $content = null) {
|
||||
return '<a class="lhb" href="' . get_permalink(gdk_page_id('download')) . '?pid=' . get_the_ID() . '" target="_blank" rel="nofollow">' . $content . '</a>';
|
||||
}
|
||||
add_shortcode('download', 'git_download');
|
||||
add_shortcode('download', 'gdk_download');
|
||||
|
||||
//为WordPress添加展开收缩功能
|
||||
function xcollapse($atts, $content = null) {
|
||||
|
@ -164,7 +164,7 @@ function xdltable($atts, $content = null) {
|
|||
"file" => "",
|
||||
"size" => ""
|
||||
) , $atts));
|
||||
return '<table class="dltable"><tbody><tr><td style="background-color:#F9F9F9;" rowspan="3"><p>文件下载</p></td><td><i class="fa fa-list-alt"></i> 文件名称:' . $file . '</td><td><i class="fa fa-th-large"></i> 文件大小:' . $size . '</td></tr><tr><td colspan="2"><i class="fa fa-volume-up"></i> 下载声明:' . git_get_option('git_dltable_b') . '</td></tr><tr><td colspan="2"><i class="fa fa-download"></i> 下载地址:' . $content . '</td></tr></tbody></table>';
|
||||
return '<table class="dltable"><tbody><tr><td style="background-color:#F9F9F9;" rowspan="3"><p>文件下载</p></td><td><i class="fa fa-list-alt"></i> 文件名称:' . $file . '</td><td><i class="fa fa-th-large"></i> 文件大小:' . $size . '</td></tr><tr><td colspan="2"><i class="fa fa-volume-up"></i> 下载声明:' . gdk_option('gdk_dltable_b') . '</td></tr><tr><td colspan="2"><i class="fa fa-download"></i> 下载地址:' . $content . '</td></tr></tbody></table>';
|
||||
}
|
||||
add_shortcode('dltable', 'xdltable');
|
||||
//网易云音乐
|
||||
|
@ -247,7 +247,7 @@ function gdk_insert_temp($atts, $content = null) {
|
|||
add_shortcode('temp', 'gdk_insert_temp');
|
||||
|
||||
//快速插入列表
|
||||
function git_list_shortcode_handler($atts, $content = '') {
|
||||
function gdk_list_shortcode_handler($atts, $content = '') {
|
||||
$lists = explode("\n", $content);
|
||||
$ouput = '';
|
||||
foreach ($lists as $li) {
|
||||
|
@ -258,7 +258,7 @@ function git_list_shortcode_handler($atts, $content = '') {
|
|||
$output .= "<ul>" . $output . "</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
add_shortcode('list', 'git_list_shortcode_handler');
|
||||
add_shortcode('list', 'gdk_list_shortcode_handler');
|
||||
|
||||
//表格短代码
|
||||
function table_shortcode_handler( $atts, $content='' ) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
//添加后台个人信息
|
||||
function git_add_contact_fields($contactmethods) {
|
||||
function gdk_add_contact_fields($contactmethods) {
|
||||
$contactmethods['qq'] = 'QQ';
|
||||
$contactmethods['sina_weibo'] = '新浪微博';
|
||||
$contactmethods['baidu'] = '百度ID';
|
||||
|
@ -12,11 +12,11 @@ function git_add_contact_fields($contactmethods) {
|
|||
unset($contactmethods['jabber']);
|
||||
return $contactmethods;
|
||||
}
|
||||
add_filter('user_contactmethods', 'git_add_contact_fields');
|
||||
add_filter('user_contactmethods', 'gdk_add_contact_fields');
|
||||
|
||||
if (!defined('UM_DIR')) { /*判断是否按照UM插件*/
|
||||
//注册表单
|
||||
function git_show_extra_register_fields() {
|
||||
function gdk_show_extra_register_fields() {
|
||||
?>
|
||||
<p>
|
||||
<label for="password">密码<br/>
|
||||
|
@ -30,11 +30,11 @@ if (!defined('UM_DIR')) { /*判断是否按照UM插件*/
|
|||
</p>
|
||||
<?php
|
||||
}
|
||||
add_action('register_form', 'git_show_extra_register_fields');
|
||||
add_action('register_form', 'gdk_show_extra_register_fields');
|
||||
/*
|
||||
* Check the form for errors
|
||||
*/
|
||||
function git_check_extra_register_fields($login, $email, $errors) {
|
||||
function gdk_check_extra_register_fields($login, $email, $errors) {
|
||||
if ($_POST['password'] !== $_POST['repeat_password']) {
|
||||
$errors->add('passwords_not_matched', "<strong>错误提示</strong>: 两次填写密码不一致");
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ if (!defined('UM_DIR')) { /*判断是否按照UM插件*/
|
|||
$errors->add('password_too_short', "<strong>错误提示</strong>: 密码必须大于8个字符");
|
||||
}
|
||||
}
|
||||
add_action('register_post', 'git_check_extra_register_fields', 10, 3);
|
||||
add_action('register_post', 'gdk_check_extra_register_fields', 10, 3);
|
||||
/*
|
||||
* 提交用户密码进数据库
|
||||
*/
|
||||
function git_register_extra_fields($user_id) {
|
||||
function gdk_register_extra_fields($user_id) {
|
||||
$userdata = array();
|
||||
$userdata['ID'] = $user_id;
|
||||
if ($_POST['password'] !== '') {
|
||||
|
@ -58,27 +58,27 @@ if (!defined('UM_DIR')) { /*判断是否按照UM插件*/
|
|||
}
|
||||
$new_user_id = wp_update_user($userdata);
|
||||
}
|
||||
add_action('user_register', 'git_register_extra_fields', 100);
|
||||
add_action('user_register', 'gdk_register_extra_fields', 100);
|
||||
}
|
||||
//注册之后跳转
|
||||
if (git_get_option('git_register_redirect_ok')) {
|
||||
function git_registration_redirect() {
|
||||
if (git_get_option('git_redirect_choise') == 'git_redirect_home') {
|
||||
if (gdk_option('gdk_register_redirect_ok')) {
|
||||
function gdk_registration_redirect() {
|
||||
if (gdk_option('gdk_redirect_choise') == 'gdk_redirect_home') {
|
||||
$redirect_url = home_url();
|
||||
} elseif (git_get_option('git_redirect_choise') == 'git_redirect_author') {
|
||||
} elseif (gdk_option('gdk_redirect_choise') == 'gdk_redirect_author') {
|
||||
$redirect_url = get_author_posts_url($user_id);
|
||||
} elseif (git_get_option('git_redirect_choise') == 'git_redirect_profile') {
|
||||
} elseif (gdk_option('gdk_redirect_choise') == 'gdk_redirect_profile') {
|
||||
$redirect_url = admin_url('wp-admin/profile.php');
|
||||
} elseif (git_get_option('git_redirect_choise') == 'git_redirect_profile' && git_get_option('git_register_redirect_url')) {
|
||||
$redirect_url = git_get_option('git_register_redirect_url');
|
||||
} elseif (gdk_option('gdk_redirect_choise') == 'gdk_redirect_profile' && gdk_option('gdk_register_redirect_url')) {
|
||||
$redirect_url = gdk_option('gdk_register_redirect_url');
|
||||
}
|
||||
return $redirect_url;
|
||||
}
|
||||
add_filter('registration_redirect', 'git_registration_redirect');
|
||||
add_filter('registration_redirect', 'gdk_registration_redirect');
|
||||
}
|
||||
|
||||
//支持中文名注册,来自肚兜
|
||||
function git_sanitize_user($username, $raw_username, $strict) {
|
||||
function gdk_sanitize_user($username, $raw_username, $strict) {
|
||||
$username = wp_strip_all_tags($raw_username);
|
||||
$username = remove_accents($username);
|
||||
$username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
|
||||
|
@ -90,10 +90,10 @@ function git_sanitize_user($username, $raw_username, $strict) {
|
|||
$username = preg_replace('|\s+|', ' ', $username);
|
||||
return $username;
|
||||
}
|
||||
add_filter('sanitize_user', 'git_sanitize_user', 10, 3);
|
||||
add_filter('sanitize_user', 'gdk_sanitize_user', 10, 3);
|
||||
|
||||
//修复 WordPress 找回密码提示“抱歉,该key似乎无效”
|
||||
function git_reset_password_message($message, $key) {
|
||||
function gdk_reset_password_message($message, $key) {
|
||||
if (strpos($_POST['user_login'], '@')) {
|
||||
$user_data = get_user_by('email', trim($_POST['user_login']));
|
||||
} else {
|
||||
|
@ -109,7 +109,7 @@ function git_reset_password_message($message, $key) {
|
|||
$msg.= wp_login_url() . "?action=rp&key=$key&login=" . rawurlencode($user_login);
|
||||
return $msg;
|
||||
}
|
||||
add_filter('retrieve_password_message', 'git_reset_password_message', null, 2);
|
||||
add_filter('retrieve_password_message', 'gdk_reset_password_message', null, 2);
|
||||
|
||||
//仅显示作者自己的文章
|
||||
function mypo_query_useronly($wp_query) {
|
||||
|
@ -171,12 +171,12 @@ function output_my_users_columns($value, $column_name, $user_id) {
|
|||
}
|
||||
add_action('manage_users_custom_column', 'output_my_users_columns', 10, 3);
|
||||
//本地头像
|
||||
function git_user_avatar($column_headers) {
|
||||
function gdk_user_avatar($column_headers) {
|
||||
$column_headers['local_avatar'] = '本地头像';
|
||||
return $column_headers;
|
||||
}
|
||||
add_filter('manage_users_columns', 'git_user_avatar');
|
||||
function git_ripms_user_avatar($value, $column_name, $user_id) {
|
||||
add_filter('manage_users_columns', 'gdk_user_avatar');
|
||||
function gdk_ripms_user_avatar($value, $column_name, $user_id) {
|
||||
if ($column_name == 'local_avatar') {
|
||||
$localavatar = get_user_meta($user_id, 'simple_local_avatar', true);
|
||||
if (empty($localavatar)) {
|
||||
|
@ -189,14 +189,14 @@ function git_ripms_user_avatar($value, $column_name, $user_id) {
|
|||
}
|
||||
return $value;
|
||||
}
|
||||
add_action('manage_users_custom_column', 'git_ripms_user_avatar', 10, 3);
|
||||
add_action('manage_users_custom_column', 'gdk_ripms_user_avatar', 10, 3);
|
||||
//用户增加评论数量
|
||||
function git_users_comments($columns) {
|
||||
function gdk_users_comments($columns) {
|
||||
$columns['comments'] = '评论';
|
||||
return $columns;
|
||||
}
|
||||
add_filter('manage_users_columns', 'git_users_comments');
|
||||
function git_show_users_comments($value, $column_name, $user_id) {
|
||||
add_filter('manage_users_columns', 'gdk_users_comments');
|
||||
function gdk_show_users_comments($value, $column_name, $user_id) {
|
||||
if ($column_name == 'comments') {
|
||||
$comments_counts = get_comments(array(
|
||||
'status' => '1',
|
||||
|
@ -213,20 +213,20 @@ function git_show_users_comments($value, $column_name, $user_id) {
|
|||
}
|
||||
return $value;
|
||||
}
|
||||
add_action('manage_users_custom_column', 'git_show_users_comments', 10, 3);
|
||||
add_action('manage_users_custom_column', 'gdk_show_users_comments', 10, 3);
|
||||
// 添加一个字段保存IP地址
|
||||
function git_log_ip($user_id) {
|
||||
function gdk_log_ip($user_id) {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
update_user_meta($user_id, 'signup_ip', $ip);
|
||||
}
|
||||
add_action('user_register', 'git_log_ip');
|
||||
add_action('user_register', 'gdk_log_ip');
|
||||
// 添加“IP地址”这个栏目
|
||||
function git_signup_ip($column_headers) {
|
||||
function gdk_signup_ip($column_headers) {
|
||||
$column_headers['signup_ip'] = 'IP地址';
|
||||
return $column_headers;
|
||||
}
|
||||
add_filter('manage_users_columns', 'git_signup_ip');
|
||||
function git_ripms_columns($value, $column_name, $user_id) {
|
||||
add_filter('manage_users_columns', 'gdk_signup_ip');
|
||||
function gdk_ripms_columns($value, $column_name, $user_id) {
|
||||
if ($column_name == 'signup_ip') {
|
||||
$ip = get_user_meta($user_id, 'signup_ip', true);
|
||||
if ($ip != "") {
|
||||
|
@ -239,22 +239,22 @@ function git_ripms_columns($value, $column_name, $user_id) {
|
|||
}
|
||||
return $value;
|
||||
}
|
||||
add_action('manage_users_custom_column', 'git_ripms_columns', 10, 3);
|
||||
add_action('manage_users_custom_column', 'gdk_ripms_columns', 10, 3);
|
||||
// 创建一个新字段存储用户登录时间
|
||||
function git_insert_last_login($login) {
|
||||
function gdk_insert_last_login($login) {
|
||||
$user = get_user_by('login', $login);
|
||||
update_user_meta($user->ID, 'last_login', current_time('mysql'));
|
||||
}
|
||||
add_action('wp_login', 'git_insert_last_login');
|
||||
add_action('wp_login', 'gdk_insert_last_login');
|
||||
// 添加一个新栏目“上次登录”
|
||||
function git_add_last_login_column($columns) {
|
||||
function gdk_add_last_login_column($columns) {
|
||||
$columns['last_login'] = '上次登录';
|
||||
unset($columns['name']);
|
||||
return $columns;
|
||||
}
|
||||
add_filter('manage_users_columns', 'git_add_last_login_column');
|
||||
add_filter('manage_users_columns', 'gdk_add_last_login_column');
|
||||
// 显示登录时间到新增栏目
|
||||
function git_add_last_login_column_value($value, $column_name, $user_id) {
|
||||
function gdk_add_last_login_column_value($value, $column_name, $user_id) {
|
||||
if ($column_name == 'last_login') {
|
||||
$login = get_user_meta($user_id, 'last_login', true);
|
||||
if ($login != "") {
|
||||
|
@ -267,18 +267,18 @@ function git_add_last_login_column_value($value, $column_name, $user_id) {
|
|||
}
|
||||
return $value;
|
||||
}
|
||||
add_action('manage_users_custom_column', 'git_add_last_login_column_value', 10, 3);
|
||||
add_action('manage_users_custom_column', 'gdk_add_last_login_column_value', 10, 3);
|
||||
|
||||
//后台登陆数学验证码
|
||||
if (git_get_option('git_admin_captcha')) {
|
||||
function git_add_login_fields(){
|
||||
if (gdk_option('gdk_admin_captcha')) {
|
||||
function gdk_add_login_fields(){
|
||||
$num1 = mt_rand(0, 20);
|
||||
$num2 = mt_rand(0, 20);
|
||||
echo "<p><label for='sum'> {$num1} + {$num2} = ?<br /><input type='text' name='sum' class='input' value='' size='25' tabindex='4'>" . "<input type='hidden' name='num1' value='{$num1}'>" . "<input type='hidden' name='num2' value='{$num2}'></label></p>";
|
||||
}
|
||||
add_action('login_form', 'git_add_login_fields');
|
||||
add_action('register_form', 'git_add_login_fields');
|
||||
function git_login_val(){
|
||||
add_action('login_form', 'gdk_add_login_fields');
|
||||
add_action('register_form', 'gdk_add_login_fields');
|
||||
function gdk_login_val(){
|
||||
$sum = $_POST['sum'];
|
||||
switch ($sum) {
|
||||
case $_POST['num1'] + $_POST['num2']:
|
||||
|
@ -290,14 +290,14 @@ if (git_get_option('git_admin_captcha')) {
|
|||
wp_die('错误: 验证码错误,请重试 <a href="javascript:;" onclick="javascript:history.back();">返回上页</a>');
|
||||
}
|
||||
}
|
||||
add_action('login_form_login', 'git_login_val');
|
||||
add_action('register_post', 'git_login_val');
|
||||
add_action('login_form_login', 'gdk_login_val');
|
||||
add_action('register_post', 'gdk_login_val');
|
||||
}
|
||||
//限制每个ip的注册数量
|
||||
if (git_get_option('git_regist_ips')) {
|
||||
if (gdk_option('gdk_regist_ips')) {
|
||||
function validate_reg_ips(){
|
||||
global $err_msg;
|
||||
$allow_time = git_get_option('git_regist_ips_num');
|
||||
$allow_time = gdk_option('gdk_regist_ips_num');
|
||||
//每个IP允许注册的用户数
|
||||
$allowed = true;
|
||||
$ipsfile = ABSPATH . '/ips.txt';
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
require( '../../../../wp-load.php' );
|
||||
|
||||
/* Payjs支付通知开始 */
|
||||
if(git_get_option('git_pay_way')=='git_payjs_ok'){
|
||||
if(gdk_option('gdk_pay_way')=='gdk_payjs_ok'){
|
||||
// 配置通信参数
|
||||
$config = [
|
||||
'mchid' => git_get_option('git_payjs_id'), // 配置商户号
|
||||
'key' => git_get_option('git_payjs_secret'), // 配置通信密钥
|
||||
'mchid' => gdk_option('gdk_payjs_id'), // 配置商户号
|
||||
'key' => gdk_option('gdk_payjs_secret'), // 配置通信密钥
|
||||
];
|
||||
$payjs = new Payjs($config);
|
||||
$data = $payjs->notify();//
|
||||
|
@ -29,12 +29,12 @@ if(strpos($data['attach'],'P') !== false){//免登陆支付
|
|||
exit;
|
||||
}
|
||||
|
||||
if(git_check($data['out_trade_no']) != 0) exit('Repeat push');
|
||||
if(gdk_check($data['out_trade_no']) != 0) exit('Repeat push');
|
||||
/* payjs支付通知结束 */
|
||||
|
||||
if( empty($userid) || empty($amount) )exit('数据为空');//阻止某些极少数空值的
|
||||
$user = get_user_by( 'id', $userid );
|
||||
$point_number = $amount * git_get_option('git_chongzhi_dh');
|
||||
$point_number = $amount * gdk_option('gdk_chongzhi_dh');
|
||||
$message = '<div class="emailcontent" style="width:100%;max-width:720px;text-align:left;margin:0 auto;padding-top:80px;padding-bottom:20px"><div class="emailtitle"><h1 style="color:#fff;background:#51a0e3;line-height:70px;font-size:24px;font-weight:400;padding-left:40px;margin:0">充值到账通知</h1><div class="emailtext" style="background:#fff;padding:20px 32px 40px"><div style="padding:0;font-weight:700;color:#6e6e6e;font-size:16px">尊敬的'.$user->display_name.',您好!</div><p style="color:#6e6e6e;font-size:13px;line-height:24px">您的金币充值已成功到账,请查收!</p><table cellpadding="0" cellspacing="0" border="0" style="width:100%;border-top:1px solid #eee;border-left:1px solid #eee;color:#6e6e6e;font-size:16px;font-weight:normal"><thead><tr><th colspan="2" style="padding:10px 0;border-right:1px solid #eee;border-bottom:1px solid #eee;text-align:center;background:#f8f8f8">您的金币详细情况</th></tr></thead><tbody><tr><td style="padding:10px 0;border-right:1px solid #eee;border-bottom:1px solid #eee;text-align:center;width:100px">用户名</td><td style="padding:10px 20px 10px 30px;border-right:1px solid #eee;border-bottom:1px solid #eee;line-height:30px">'.$user->display_name.'</td></tr><tr><td style="padding:10px 0;border-right:1px solid #eee;border-bottom:1px solid #eee;text-align:center">充值金币</td><td style="padding:10px 20px 10px 30px;border-right:1px solid #eee;border-bottom:1px solid #eee;line-height:30px">'.$point_number.'</td></tr><tr><td style="padding:10px 0;border-right:1px solid #eee;border-bottom:1px solid #eee;text-align:center">金币总额</td><td style="padding:10px 20px 10px 30px;border-right:1px solid #eee;border-bottom:1px solid #eee;line-height:30px">'.Points::get_user_total_points($userid, POINTS_STATUS_ACCEPTED ).'</td></tr></tbody></table><p style="color:#6e6e6e;font-size:13px;line-height:24px">如果您的金币金额有异常,请您在第一时间和我们取得联系哦,联系邮箱:'.get_bloginfo('admin_email').'</p></div><div class="emailad" style="margin-top:4px"><a href="'.home_url().'"><img src="http://reg.163.com/images/secmail/adv.png" style="margin:auto;width:100%;max-width:700px;height:auto"></a></div></div></div>';
|
||||
$headers = "Content-Type:text/html;charset=UTF-8\n";
|
||||
Points::set_points($point_number, $userid, array('description' => $YZid , 'status' => 'accepted'));//增加金币金币
|
||||
|
|
Loading…
Reference in a new issue