1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-05-11 10:46:52 +02:00
This commit is contained in:
云落 2020-02-13 08:53:12 +08:00
parent 97a1b68577
commit 38c616cac8
6 changed files with 103 additions and 13 deletions

View file

@ -374,6 +374,12 @@ $gdk_options = [
],
'std' => '1'
],
[
'name' => '友情链接分类ID',
'desc' => '请选择专门用来存放友链的链接分类ID',
'id' => 'gdk_link_id',
'type' => 'number'
],
[
'name' => 'HTML代码压缩',
'desc' => '启用 【开启后将压缩网页HTML代码可读性会降低但是性能略有提升】',

View file

@ -951,6 +951,30 @@ function gdk_thumbnail_src() {
}
/**
* 获取略缩图输出img标签代码
* @param [init] $way 缩略图方案代码1=cdn2=timthumb3=aq_resize
* @param [string] $url 缩略图原图链接调用gdk_thumbnail_src()
* @param [init] $width 缩略图宽度
* @param [init] $height 缩略图高度
* @param [string] $style 图片样式cdn方案时有效
* @param [string] $atrr img标签的属性
* @return [string] img标签的图片代码
*/
function gdk_thumb_img($way,$url,$width,$height,$style,$atrr = 'class="thumb_img"'){
if ($way === 1) {//cdn
$src = $url.'!'.$style;
}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) {
$src = aq_resize( $url, $width , $height , true);
}else{
return false;
}
echo '<img '.$atrr.' src="'.$src.'">';
}
//生成订单号编码
function gdk_order_id(){
date_default_timezone_set('Asia/Shanghai');
@ -1007,7 +1031,7 @@ function gdk_get_the_link_items($id = null) {
}
function gdk_get_link_items() {
$linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude=7');
$linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude='.gdk_option('gdk_link_id'));
$result = '';
foreach ($linkcats as $linkcat) {
$result.= '<a id="' . $linkcat->term_id . '"></a><div class="panel">
@ -1153,12 +1177,11 @@ function gdk_weauth_token(){
$qr64 = [];
$qr64['key'] = gdk_weauth_token();
$qr64['qrcode'] = gdk_http_request('https://wa.isdot.net/qrcode?str='.$qr64['key'])['qrcode'];
// https://api.goauth.jysafe.cn/
//$qr64['qrcode'] = gdk_http_request('https://api.goauth.jysafe.cn/qrcode?str='.$qr64['key'])['qrcode'];//预备使用,备胎
return $qr64;
}
/**
* 微信登陆按钮
*/

View file

@ -13,4 +13,4 @@ include( 'user.php' );//用户功能
include(GDK_ROOT_PATH.'public/download.php');//单页下载
include(GDK_ROOT_PATH.'public/go.php');//跳转中间页
include(GDK_ROOT_PATH.'public/daohang.php');//跳转中间页
include(GDK_ROOT_PATH.'public/daohang.php');//导航页面

View file

@ -328,4 +328,68 @@ function log_login( $username, $password ) {
}
}
}
}
//ban yonghu
function gdk_edit_user_profile( $user ) {
if ( ! current_user_can( 'edit_users' ) ) return;
if ( get_current_user_id() == $user->ID ) return;
?>
<table class="form-table">
<tr>
<th scope="row">封禁用户</th>
<td>
<label for="gdk_ban">
<input name="gdk_ban" type="checkbox" id="gdk_ban" <?php
checked( gdk_is_user_banned( $user->ID ), TRUE )?> value="1">
封禁此用户</label>
</td>
</tr>
</table>
<?php
}
function gdk_edit_user_profile_update( $user_id ) {
if ( ! current_user_can( 'edit_users' ) ) return;
if ( get_current_user_id() == $user_id ) return;
if ( empty( $_POST['gdk_ban'] ) ) {
gdk_unban_user( $user_id );
} else {
gdk_ban_user( $user_id );
}
}
function gdk_ban_user( $user_id ) {
if ( ! gdk_is_user_banned( $user_id ) ) {
update_user_option( $user_id, 'gdk_banned', TRUE, FALSE );
}
}
function gdk_unban_user( $user_id ) {
if ( gdk_is_user_banned( $user_id ) ) {
update_user_option( $user_id, 'gdk_banned', FALSE, FALSE );
}
}
function gdk_is_user_banned( $user_id ) {
return get_user_option( 'gdk_banned', $user_id );
}
function gdk_authenticate_user( $user, $password ) {
if ( is_wp_error( $user ) ) return $user;
if ( get_user_option( 'gdk_banned', $user->ID, FALSE ) ) {
return new WP_Error(
'gdk_banned','<strong>ERROR</strong>: 此账号已被封禁.'
);
}
return $user;
}
add_action( 'edit_user_profile', 'gdk_edit_user_profile' );
add_action( 'edit_user_profile_update', 'gdk_edit_user_profile_update' );
add_filter( 'wp_authenticate_user', 'gdk_authenticate_user', 10, 2 );

View file

@ -22,7 +22,6 @@ function gdk_reset_password_message($message, $key) {
add_filter('retrieve_password_message', 'gdk_reset_password_message', null, 2);
if (!defined('UM_DIR')) { /*判断是否按照UM插件*/
//注册表单
function gdk_show_extra_register_fields() {
@ -126,7 +125,6 @@ function gdk_show_myupload_library($wp_query) {
}
add_filter('parse_query', 'gdk_show_myupload_library');
//添加后台个人信息
function gdk_contact_fields($contactmethods) {
$contactmethods['qq'] = 'QQ';
@ -166,10 +164,9 @@ function gdk_userid_value($value, $column_name, $id) {
return $value;
}
add_filter('manage_users_custom_column', 'gdk_userid_value', 30, 3);
/**
* WordPress 后台用户列表显示用户昵称
* https://www.wpdaxue.com/add-user-nickname-column.html
*/
//WordPress 后台用户列表显示用户昵称
add_filter('manage_users_columns', 'gdk_add_user_nickname');
function gdk_add_user_nickname($columns) {
$columns['user_nickname'] = '昵称';

View file

@ -2,7 +2,7 @@
/**
* 支付推送服务消息接收文件
*/
require( '../../../../wp-load.php' );
require( '../../../../wp-load.php' );//此路径位于根目录
/* Payjs支付通知开始 */
$data = payjs_notify();//获取payjs支付成功的信息
@ -22,7 +22,7 @@ if(in_string($userid,'PP')){//免登陆支付,插入缓存,然后直接停止推
if(gdk_check($data['out_trade_no']) !== 0) exit('Repeat push');//在入库前,数据库不应该有同样的订单号
if( empty($userid) || empty($money) )exit('data null');//阻止某些极少数空值的
if( empty($userid) || empty($money) ) exit('data null');//阻止某些极少数空值的
/* Payjs支付通知结束 */