1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-05-12 19:26:51 +02:00

修改一些不兼容

This commit is contained in:
云落 2020-01-29 14:46:05 +08:00
parent 1f4d6a6e81
commit 011964ba43
9 changed files with 30 additions and 30 deletions

View file

@ -1,6 +1,6 @@
<?php
class Payjs
class GDK_Payjs
{
private $mchid;
private $key;

View file

@ -452,7 +452,7 @@ $gdk_options = [
[
'name' => 'CDN水印',
'desc' => '启用【如果启用请在七牛又拍OSS等CDN中设置自定义样式名字为<span class="key_word">water.jpg</span>,分隔符为<span class="key_word">!</span> 】',
'id' => 'git_cdn_water',
'id' => 'gdk_cdn_water',
'type' => 'checkbox'
],
[

View file

@ -347,7 +347,7 @@ function gdk_is_mobile() {
}
if (function_exists('curl_init')) {
function curl_post($url, $postfields = '', $headers = '', $timeout = 20, $file = 0) {
function gdk_curl($url, $postfields = '', $headers = '', $timeout = 20, $file = 0) {
$ch = curl_init();
$options = array(
CURLOPT_URL => $url,

View file

@ -4,7 +4,7 @@ if (gdk_option('gdk_cdn')) add_action('wp_loaded', 'gdk_cdn_sta
if (gdk_option('gdk_link_go')) add_filter('the_content','gdk_link_go',999);// 外链GO跳转
if (gdk_option('gdk_smtp')) add_action('phpmailer_init', 'gdk_smtp');//SMTP
if (gdk_option('git_cdn_water')) add_filter('the_content', 'cdn_water');//CDN水印
if (gdk_option('gdk_cdn_water')) add_filter('the_content', 'gdk_cdn_water');//CDN水印
@ -37,13 +37,13 @@ add_filter('get_avatar', 'gdk_switch_get_avatar');
//fancybox图片灯箱效果
function fancybox($content) {
function gdk_fancybox($content) {
$pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png|swf)('|\")(.*?)>(.*?)<\\/a>/i";
$replacement = '<a$1href=$2$3.$4$5 data-fancybox="gallery" rel="box" class="fancybox"$6>$7</a>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
add_filter('the_content', 'fancybox');
add_filter('the_content', 'gdk_fancybox');
function gdk_link_go($content) {
@ -99,7 +99,7 @@ function gdk_cdn_replace($html) {
//CDN水印
function cdn_water($content) {
function gdk_cdn_water($content) {
if (get_post_type() == 'post') {
$pattern = "/<img(.*?)src=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replacement = '<img$1src=$2$3.$4!water.jpg$5$6>';

View file

@ -9,6 +9,6 @@ include( 'security.php' );//安全功能
include( 'shortcode.php' );//短代码
//include( 'shortcode.php' );//短代码
include( 'seo.php' );//seo功能

View file

@ -20,24 +20,24 @@ remove_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );
add_filter('user_can_richedit','__return_false');
//禁用响应式图片
function msiw(){
function gdk_disable_srcset_img(){
return 1;
}
add_filter('max_srcset_image_width', 'msiw');
add_filter('max_srcset_image_width', 'gdk_disable_srcset_img');
//移除默认的图片宽度以及高度
function remove_wps_width($html) {
function gdk_remove_img_width($html) {
$html = preg_replace('/(width|height)=\"\d*\"\s/', "", $html);
return $html;
}
add_filter('post_thumbnail_html', 'remove_wps_width', 10);
add_filter('image_send_to_editor', 'remove_wps_width', 10);
add_filter('post_thumbnail_html', 'gdk_remove_img_width', 10);
add_filter('image_send_to_editor', 'gdk_remove_img_width', 10);
//取消后台登陆错误的抖动提示
function git_wps_login_error() {
function gdk_wps_login_error() {
remove_action('login_head', 'wp_shake_js', 12);
}
add_action('login_head', 'git_wps_login_error');
add_action('login_head', 'gdk_wps_login_error');
// 友情链接扩展
@ -113,28 +113,28 @@ function remove_dns_prefetch( $hints, $relation_type ) {
add_filter( 'wp_resource_hints', 'remove_dns_prefetch', 10, 2 );
//强制阻止WordPress代码转义
function git_esc_html($content) {
function gdk_esc_html($content) {
$regex = '/(<pre\s+[^>]*?class\s*?=\s*?[",\'].*?prettyprint.*?[",\'].*?>)(.*?)(<\/pre>)/sim';
return preg_replace_callback($regex, 'git_esc_callback', $content);
return preg_replace_callback($regex, 'gdk_esc_callback', $content);
}
function git_esc_callback($matches) {
function gdk_esc_callback($matches) {
$tag_open = $matches[1];
$content = $matches[2];
$tag_close = $matches[3];
$content = esc_html($content);
return $tag_open . $content . $tag_close;
}
add_filter('the_content', 'git_esc_html', 2);
add_filter('comment_text', 'git_esc_html', 2);
add_filter('the_content', 'gdk_esc_html', 2);
add_filter('comment_text', 'gdk_esc_html', 2);
//强制兼容<pre>
function git_prettify_replace($text) {
function gdk_prettify_replace($text) {
$replace = array(
'<pre>' => '<pre class="prettyprint linenums" >'
);
$text = str_replace(array_keys($replace) , $replace, $text);
return $text;
}
add_filter('the_content', 'git_prettify_replace');
add_filter('the_content', 'gdk_prettify_replace');

View file

@ -1,6 +1,6 @@
<?php
define('DISALLOW_FILE_MODS',true);
//define('DISALLOW_FILE_MODS',true);
//阻止乱七八糟的请求
if(gdk_option('gdk_block_requst')) add_action( 'wp', 'gdk_prevent_script_injection' );

View file

@ -308,7 +308,7 @@ if(gdk_option('gdk_seo_img')) {
//关键字
function deel_keywords() {
function gdk_deel_keywords() {
global $s, $post;
$keywords = '';
if (is_single()) {
@ -334,10 +334,10 @@ function deel_keywords() {
}
add_action('wp_head', 'deel_keywords');
add_action('wp_head', 'gdk_deel_keywords');
//网站描述
function deel_description() {
function gdk_deel_description() {
global $s, $post;
$description = '';
$blog_name = get_bloginfo('name');
@ -373,7 +373,7 @@ function deel_description() {
echo "<meta name=\"description\" content=\"$description\">\n";
}
add_action('wp_head', 'deel_description');
add_action('wp_head', 'gdk_deel_description');
@ -401,7 +401,7 @@ function deel_description() {
//评论分页的seo处理
function canonical_for_git(){
function gdk_canonical(){
global $post;
if (get_query_var('paged') > 1) {
echo "\n";
@ -411,4 +411,4 @@ function canonical_for_git(){
echo "<meta name=\"robots\" content=\"noindex,follow\">";
}
}
add_action('wp_head', 'canonical_for_git');
add_action('wp_head', 'gdk_canonical');

View file

@ -27,6 +27,6 @@ define('GDK_ROOT_PATH', plugin_dir_path( __FILE__ ) );//插件目录路径
//加载各种资源
include('class/class_load.php');//加载各种类
include('framework/frame_load');//加载后台框架
include('framework/frame_load.php');//加载后台框架
include('functions/func_load.php');//加载函数
include('assets/assets_load.php');//加载静态资源