1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-05-05 07:53:34 +02:00

优化程序

This commit is contained in:
云落 2020-04-03 19:11:11 +08:00
parent 459a723d25
commit c6507fbec8
5 changed files with 38 additions and 31 deletions

View file

@ -317,6 +317,12 @@ $gdk_options = [
'type' => 'number',
'std' => 60,
],
[
'name' => '登录失败邮件通知',
'desc' => '启用 【开启后,将所有登陆失败信息发邮件通知管理员】',
'id' => 'gdk_login_email',
'type' => 'checkbox',
],
[
'name' => '登陆数学验证',
'desc' => '启用 【开启后,将会登陆页面增加数学验证码】',
@ -338,17 +344,6 @@ $gdk_options = [
],
'std' => '1',
],
[
'name' => '我的网站评论方式',
'desc' => '拦截垃圾评论需要区分是否是Ajax评论,Ajax评论就是<span class="key_word">无刷新直接显示评论内容的</span>,传统有刷新评论是需要浏览器刷新之后才能看到评论内容的,目前国内很多基本都是Ajax评论,所以默认为Ajax评论',
'id' => 'gdk_ajax',
'type' => 'radio',
'options' => [
'1' => '我的是Ajax无刷新评论',
'0' => '我的是传统有刷新评论',
],
'std' => '1',
],
],
'高级设置' => [
[
@ -548,20 +543,6 @@ $gdk_options = [
'type' => 'text',
'std' => '',
],
[
'name' => '微信验证码',
'desc' => '请输入您的微信验证码,这里的必须要要和微信里面回复的保持一致。',
'id' => 'gdk_mp_code',
'type' => 'text',
'std' => '2233',
],
[
'name' => '微信可见提示信息可用html代码',
'desc' => '在本输入框内输入您的微信公众号描述信息支持html代码字数合适就行不能太多',
'id' => 'gdk_mp_tips',
'type' => 'textarea',
'std' => '请关注极客公园官方微信公众号,关注并订阅<span class="key_word">云落极客公园</span>获取验证码。在微信里搜索<span class="key_word">云落极客公园</span>或者微信扫描二维码都可以关注极客公园官方微信公众号。',
],
[
'title' => 'HTML5 桌面推送',
'type' => 'title',

View file

@ -38,7 +38,7 @@ function nc_comment_add_at($comment_text, $comment = '')
return $comment_text;
}
function nc_record_visitors()
function gdk_record_visitors()
{
if (is_singular()) {
global $post;
@ -391,12 +391,12 @@ function gdk_die($ErrMsg)
//面包屑导航
function gdk_breadcrumbs($delimiter = '»', $hometitle = 'Home')
{
$before = '<span class="current">';
$before = '<span class="current active">';
// 在当前链接前插入
$after = '</span>';
// 在当前链接后插入
if (!is_home() && !is_front_page() || is_paged()) {
echo '<div itemscope itemtype="http://schema.org/WebPage" id="crumbs">' . __('You are here:', 'cmp');
echo '<div itemscope itemtype="http://schema.org/WebPage" id="crumbs" class="cm-breadcrumb">';
global $post;
$homeLink = home_url();
echo ' <a itemprop="breadcrumb" href="' . $homeLink . '">' . $hometitle . '</a> ' . $delimiter . ' ';
@ -824,6 +824,28 @@ function gdk_term_meta($term, $meta, $id)
return $result;
}
//CDN 缩略图处理样式
function gdk_thumb_color()
{
switch (gdk_option('gdk_cdn_serves')) {
case '1':
case '3':
return '?imageAve';
break;
case '2':
return '!/exformat/hex';
break;
case '4':
return '?x-oss-process=image/average-hue';
break;
case '5':
return '?x-image-process=image/average-hue';
break;
default:
return false;
}
}
//CDN 缩略图处理样式
function gdk_thumb_style($width, $height)
{
@ -838,10 +860,10 @@ function gdk_thumb_style($width, $height)
return '?imageMogr2/thumbnail/' . $width . 'x' . $height . '!';
break;
case '4':
return '?x-oss-process=image/resize,m_fixed,h_' . $height . ',w_' . $width . ',limit_0';
return '?x-oss-process=image/resize,m_fill,h_' . $height . ',w_' . $width . ',limit_0';
break;
case '5':
return '?x-image-process=image/resize,m_fixed,h_' . $height . ',w_' . $width . ',limit_0';
return '?x-image-process=image/resize,m_fill,h_' . $height . ',w_' . $width . ',limit_0';
break;
default:
return false;

View file

@ -21,7 +21,7 @@ if (gdk_option('gdk_cdn_water')) {
//文章首尾添加自定义内容
function gdk_add_content($content)
{
$before = gdk_option('gdk_artical_top');
$after = gdk_option('gdk_artical_bottom');
if (empty($before) && empty($after) && !is_single()) {

View file

@ -11,6 +11,8 @@ add_action('do_feed_rss', 'gdk_feed_disabled', 1);
add_action('do_feed_rss2', 'gdk_feed_disabled', 1);
add_action('do_feed_atom', 'gdk_feed_disabled', 1);
add_action('wp_head', 'gdk_record_visitors');
//禁用新版编辑器
if (gdk_option('gdk_diasble_gutenberg')) {
add_filter('use_block_editor_for_post', '__return_false');

View file

@ -311,7 +311,9 @@ if (gdk_option('gdk_hide_user_name')) {
}
//记录登陆失败发邮件
if (gdk_option('gdk_login_email')) {
add_action('wp_authenticate', 'log_login', 10, 2);
}
function log_login($username, $password)
{