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

密码回复可见Ajax操作OK

This commit is contained in:
云落 2020-02-04 02:12:24 +08:00
parent cbe9723c47
commit 8786de6340
11 changed files with 250 additions and 75 deletions

View file

@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
function gdk_admin_script() {
?>
<style>.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;}</style>
<style>.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>
<script>
jQuery(function($) {
/* bengin */
@ -37,8 +37,7 @@ if($hook_suffix == 'post.php'|| $hook_suffix == 'post-new.php'){
wp_localize_script('paste-upload-image', 'pui_vars', array('pui_nonce' => wp_create_nonce('pui-nonce')));
}
wp_register_script('sweetalert','https://cdn.jsdelivr.net/npm/sweetalert@2.0.0/dist/sweetalert.min.js', [], GDK_PLUGIN_VER, true);
wp_enqueue_script('sweetalert');
}
add_action('admin_enqueue_scripts', 'gdk_admin_enqueue_script');
@ -49,10 +48,19 @@ function gdk_enqueue_script_frontend() {
wp_register_script('code_prettify_js', GDK_BASE_URL.'assets/js/prettify.min.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_register_script('fancybox_js', GDK_BASE_URL.'assets/js/fancybox.min.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_register_script('lazyload_js', GDK_BASE_URL.'assets/js/lazyload.min.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_register_script('sweetalert','https://cdn.jsdelivr.net/npm/sweetalert@2.0.0/dist/sweetalert.min.js', [], GDK_PLUGIN_VER, true);
wp_register_script('gdk_js', GDK_BASE_URL.'assets/js/gdk.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_enqueue_style( 'gdk_css' );
wp_enqueue_script('code_prettify_js');
wp_enqueue_script('lazyload_js');
wp_enqueue_script('fancybox_js');
wp_enqueue_script('lazyload_js');
wp_enqueue_script('sweetalert');
wp_enqueue_script('gdk_js');
wp_localize_script('gdk_js', 'ajax', [
'url'=> admin_url('admin-ajax.php'),
'pass_nonce' => wp_create_nonce('pass_nonce')
]);
}
}

File diff suppressed because one or more lines are too long

54
assets/js/gdk.js Normal file
View file

@ -0,0 +1,54 @@
jQuery(function($) {
$("#start_view").click(function(){
var ajax_data = {
action: 'gdk_pass_view',
pass_nonce: ajax.pass_nonce,
id: $('#start_view').data('id'),
pass: $('#pass_view').val()
};
$.post(ajax.url, ajax_data,
function(c) {
c = c.replace(/\s/g,'');
if(c != '0') {
$(".pass_viewbox").hide();
$(".pass_viewbox").after("<div class='content-hide-tips'><span class='rate label label-warning'>隐藏内容:</span><p>" + c + "</p></div>");
localStorage.setItem('pass_'+ajax_data['id'],ajax_data['pass']);
}else{
swal("查看失败", "您的密码错误,请重试", "error");
}
});
});
});

View file

@ -6,7 +6,5 @@ include( 'local_avatars.php' );//本地头像
include( 'updates.php' );//在线更新
include( 'widget_cache.php' );//小工具缓存
if(gdk_option('gdk_payjs')){
include( 'Payjs.php' );//支付功能
include( 'points/points.php' );//积分功能
}
include( 'Payjs.php' );//支付功能
include( 'points/points.php' );//积分功能

View file

@ -3,14 +3,21 @@
* Theme Update Checker Library 1.2
* http://w-shadow.com/
*/
/*
json数据格式:
{
"version" : "12.3",
"details_url" : "https://u.xxoo.net/api/detial.txt",
"download_url" : "http://a.xxoo.net/Git-alpha.zip"
}
*/
if ( !class_exists('ThemeUpdateChecker') ):
class ThemeUpdateChecker {
public $theme = 'Git-alpha'; //待检查更新的主题名
public $metadataUrl = 'https://cdn.jsdelivr.net/gh/yunluo/GitCafeApi/info.json'; //元数据文件的路径
public $theme = ''; //待检查更新的主题名
public $metadataUrl = ''; //元数据文件的路径
public $enableAutomaticChecking = true; //是否启用自动更新
protected $optionName = ''; //更新时候的文字信息
protected $optionName = ''; //更新信息的参数信息
protected $automaticCheckDone = false;
protected static $filterPrefix = 'tuc_request_update_';

View file

@ -277,6 +277,12 @@ $gdk_options = [
'id' => 'gdk_maintenance_mode',
'type' => 'checkbox'
],
[
'name' => '禁用REST API功能',
'desc' => '禁用 【启用后REST API功能将关闭,如果没不使用该功能的话,建议关闭】',
'id' => 'gdk_disable_restapi',
'type' => 'checkbox'
],
[
'name' => '保护用户暴露用户名',
'desc' => '开启 【启用后,将隐藏掉用户的登录名,起到保护作用】',

View file

@ -18,8 +18,7 @@ add_action('wp_ajax_gdk_test_email', 'gdk_test_email');
//粘贴上传图片
function gdk_pasteup_imag() {
if( !isset( $_POST['pui_nonce'] ) || !wp_verify_nonce($_POST['pui_nonce'], 'pui-nonce') )
exit('Permissions check failed');
if( !isset( $_POST['pui_nonce'] ) || !wp_verify_nonce($_POST['pui_nonce'], 'pui-nonce') ) exit('Permissions check failed');
if($_FILES) {
global $post;
$post_ID = $post->ID;
@ -59,4 +58,21 @@ function gdk_pasteup_imag() {
}
}
add_action('wp_ajax_nopriv_gdk_pasteup_imag', 'gdk_pasteup_imag');
add_action('wp_ajax_gdk_pasteup_imag', 'gdk_pasteup_imag');
add_action('wp_ajax_gdk_pasteup_imag', 'gdk_pasteup_imag');
function gdk_pass_view() {
if( !isset( $_POST['pass_nonce'] ) || !wp_verify_nonce($_POST['pass_nonce'], 'pass_nonce') ) return;
$action = $_POST['action'];
$post_id = $_POST['id'];
$pass = $_POST['pass'];
if(!isset( $action ) || !isset( $post_id ) || !isset( $pass ) ) return;
if($pass == '2233') {
$pass_content = get_post_meta($post_id, '_pass_content')[0];
exit($pass_content);
}else{
exit('0');
}
}
add_action('wp_ajax_nopriv_gdk_pass_view', 'gdk_pass_view');
add_action('wp_ajax_gdk_pass_view', 'gdk_pass_view');

View file

@ -360,6 +360,14 @@ function in_string($text,$find) {
}
}
//判断是否是微信
function gdk_is_weixin(){
if(in_string($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')){
return true;
}else{
return false;
}
}
//获取浏览器信息
function getBrowser() {
$u_agent = $_SERVER['HTTP_USER_AGENT'];

View file

@ -100,7 +100,11 @@ function gdk_after_init_theme() {
update_option( 'medium_large_size_w', '0' );//关闭默认缩略图
update_option( 'medium_size_h', '0' );//关闭默认缩略图
update_option( 'medium_size_w', '0' );//关闭默认缩略图
if(get_option('permalink_structure') == ''){//如果是默认连接格式
update_option( 'thumbnail_size_w', '0' );//关闭默认缩略图
update_option( 'thumbnail_size_h', '0' );//关闭默认缩略图
update_option( 'default_ping_status', 'closed' );//关闭默认ping状态
update_option( 'comment_order', 'desc' );//关闭默认评论显示顺序
if(get_option('permalink_structure') == ''|| define( 'GDK_HTML_LINK', true ) ){//如果是默认连接格式或者主题声明 define( 'GDK_HTML_LINK', true );
update_option( 'permalink_structure', '/archives/%post_id%.html' );//固定链接格式
}
update_option( 'posts_per_page', '30' );//每页文章数目
@ -150,6 +154,17 @@ add_filter( 'nav_menu_css_class', function ( $var ) {
}
, 100, 1 );
//移除前台加载jquery-migrate
function dequeue_jquery_migrate( $scripts ) {
if ( ! is_admin() && ! empty( $scripts->registered['jquery'] ) ) {
$scripts->registered['jquery']->deps = array_diff(
$scripts->registered['jquery']->deps,
[ 'jquery-migrate' ]
);
}
}
add_action( 'wp_default_scripts', 'dequeue_jquery_migrate' );
//移除 WordPress 标记
add_filter( 'the_generator', function () { return '';});
@ -200,6 +215,21 @@ function gdk_remove_open_sans() {
}
add_action( 'init', 'gdk_remove_open_sans' );
//WordPress 彻底移除后台“隐私”设置功能
add_filter( 'map_meta_cap', 'ds_disable_core_privacy_tools', 10, 2 );
remove_action( 'init', 'wp_schedule_delete_old_privacy_export_files' );
remove_action( 'wp_privacy_delete_old_export_files', 'wp_privacy_delete_old_export_files' );
function ds_disable_core_privacy_tools( $caps, $cap ) {
switch ( $cap ) {
case 'export_others_personal_data':
case 'erase_others_personal_data':
case 'manage_privacy_options':
$caps[] = 'do_not_allow';
break;
}
return $caps;
}
// 禁止dns-prefetch
function gdk_remove_dns( $hints, $relation_type ) {
if ( 'dns-prefetch' === $relation_type ) {
@ -209,6 +239,18 @@ function gdk_remove_dns( $hints, $relation_type ) {
}
add_filter( 'wp_resource_hints', 'gdk_remove_dns', 10, 2 );
//强制兼容<pre>
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', 'gdk_prettify_replace');
//强制阻止WordPress代码转义
function gdk_esc_html($content) {
$regex = '/(<pre\s+[^>]*?class\s*?=\s*?[",\'].*?prettyprint.*?[",\'].*?>)(.*?)(<\/pre>)/sim';
@ -224,16 +266,6 @@ function gdk_esc_callback($matches) {
add_filter('the_content', 'gdk_esc_html', 2);
add_filter('comment_text', 'gdk_esc_html', 2);
//强制兼容<pre>
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', 'gdk_prettify_replace');
//禁用emoji功能
if (gdk_option('gdk_disable_emojis')) {
function gdk_disable_emojis_link() {
@ -431,16 +463,16 @@ if ( ! function_exists( 'security_stop_user_enumeration' ) ) {
//禁用REST API功能
if(gdk_option('gdk_disable_restapi')) {
add_action( 'rest_pre_dispatch', 'deactivate_rest_api' );
add_action( 'rest_authentication_errors', 'deactivate_rest_api' );
function deactivate_rest_api() {
status_header( 405 );
die( '{"code":"rest_api_disabled","message":"REST API services are disabled on this site.","data":{"status":405}}' );
wp_die( '{"code":"rest_api_disabled","message":"REST API services are disabled on this site.","data":{"status":405}}' );
}
// Remove the REST API endpoint.
remove_action( 'rest_api_init', 'wp_oembed_register_route' );
}
//记录登陆失败发邮件
add_action( 'wp_authenticate', 'log_login', 10, 2 );
@ -516,27 +548,17 @@ add_filter('login_headertext', function (){
});
function gdk_custom_head_code() {
$gdk_custom_head_code = gdk_option('gdk_custom_head_code');
echo $gdk_custom_head_code;
}
add_action('wp_head', 'gdk_custom_head_code');
function gdk_custom_head_code() {
$gdk_option = get_option('gdk_option');
$site = $gdk_option['site'];
echo $site['custom_head_code'];
}
add_action('wp_head', 'gdk_custom_head_code');
function gdk_custom_footer_code() {
$gdk_option = get_option('gdk_option');
$site = $gdk_option['site'];
echo $site['custom_footer_code'];
}
add_action('wp_footer', 'gdk_custom_footer_code');
function gdk_custom_footer_code() {
$gdk_custom_footer_code = gdk_option('gdk_custom_foot_code');
echo $gdk_custom_footer_code;
}
add_action('wp_footer', 'gdk_custom_footer_code',400);
if(gdk_option('gdk_no_category')){
if (!function_exists('gdk_no_category_base_refresh_rules')):

View file

@ -186,29 +186,19 @@ function login_to_read($atts, $content = null) {
return $notice;
}
add_shortcode('vip', 'login_to_read');
// 部分内容输入密码可见
function e_secret($atts, $content = null) {
if (!isset($_COOKIE['weixin_fensi']) && isset($_POST['e_secret_key']) && $_POST['e_secret_key'] == git_get_option('git_mp_code')) {
setcookie('weixin_fensi', 10086, time() + 2592000, COOKIEPATH, COOKIE_DOMAIN, false); //30天时间
return '<script type="text/javascript">window.location = document.referrer;</script>';
}
extract(shortcode_atts(array(
'wx' => null
) , $atts));
if ($_COOKIE['weixin_fensi'] == '10086' || strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
return '<div class="e-secret"><fieldset><legend>隐藏的内容</legend>
' . $content . '<div class="clear"></div></fieldset></div>';
} else {
if ($wx == '1') {
return '<div class="wxbox"><img class="wxpic" src="' . git_get_option('git_mp_qr') . '" alt="' . git_get_option('git_mp_name') . '" title="' . git_get_option('git_mp_name') . '" align="right"><form method="post" name="e-secret" action="' . $_SERVER["REQUEST_URI"] . '"><span class="yzts" style="font-size:18px;">验证码:</span><input name="e_secret_key" id="verifycode" value="" type="text"><input id="verifybtn" name="" value="提交查看" type="submit"></form><div class="wxtips">' . git_get_option('git_mp_tips') . '</div><div class="cl"></div></div>';
} else {
return '<form class="e-secret" method="post" name="e-secret" action="' . $_SERVER["REQUEST_URI"] . '"><label>输入密码查看加密内容:</label><input type="password" name="e_secret_key" class="euc-y-i" maxlength="50"><input type="submit" class="euc-y-s" value="确定"><div class="euc-clear"></div></form>';
}
}
extract(shortcode_atts(array('wx' => null) , $atts));
$pid = get_the_ID();
add_post_meta($pid, '_pass_content', $content, true) or update_post_meta($pid, '_pass_content', $content);
if ( current_user_can( 'administrator' ) || gdk_is_weixin()) { return $content; }//admin show
return '<div class="pass_viewbox"><input id="pass_view" type="text"> <input id="start_view" data-action="gdk_pass_view" data-id="'.$pid.'" type="button" value="提交"></div>';
}
add_shortcode('secret', 'e_secret');
// 支持文章和页面运行PHP代码
// 支持文章和页面运行PHP代码id
function php_include($attr) {
$file = $attr['file'];
$upload_dir = wp_upload_dir();
@ -245,7 +235,6 @@ function gdk_insert_posts($atts, $content = null) {
}
add_shortcode('neilian', 'gdk_insert_posts');
//给文章加内链短代码
function gdk_insert_temp($atts, $content = null) {
extract(shortcode_atts(array( 'id' => '' ) , $atts));
@ -255,7 +244,6 @@ function gdk_insert_temp($atts, $content = null) {
}
add_shortcode('temp', 'gdk_insert_temp');
//快速插入列表
function git_list_shortcode_handler($atts, $content = '') {
$lists = explode("\n", $content);
@ -270,7 +258,6 @@ function git_list_shortcode_handler($atts, $content = '') {
}
add_shortcode('list', 'git_list_shortcode_handler');
//表格短代码
function table_shortcode_handler( $atts, $content='' ) {
extract( shortcode_atts( ['width' => '100%'], $atts ) );
@ -281,6 +268,7 @@ function table_shortcode_handler( $atts, $content='' ) {
$output .= '<thead><tr>';
//var_dump($ths);
foreach($ths as $th){
$th = trim($th);
$output .= '<th>'.$th.'</th>';
}
$output .= '</tr></thead>';
@ -308,6 +296,70 @@ function table_shortcode_handler( $atts, $content='' ) {
}
add_shortcode( 'table', 'table_shortcode_handler' );
add_shortcode('youku', function( $atts, $content='') {
extract( shortcode_atts( array(
'width' => '510',
'height' => '498'
), $atts ) );
$width = (isset($_GET['width']) && intval($_GET['width']))?intval($_GET['width']):$width; // 用于 JSON 接口
$height = round($width/4*3);
if(preg_match('#http://v.youku.com/v_show/id_(.*?).html#i',$content,$matches)){
return '<iframe class="wpjam_video" height='.esc_attr($height).' width='.esc_attr($width).' src="http://player.youku.com/embed/'.esc_attr($matches[1]).'" frameborder=0 allowfullscreen></iframe>';
}
});
add_shortcode('qqv', function($atts, $content='') {
extract( shortcode_atts( array(
'width' => '510',
'height' => '498'
), $atts ) );
$width = (isset($_GET['width']) && intval($_GET['width']))?intval($_GET['width']):$width; // 用于 JSON 接口
$height = round($width/4*3);
if(preg_match('#//v.qq.com/iframe/player.html\?vid=(.+)#i',$content,$matches)){
//var_dump($matches);exit();
return '<iframe class="wpjam_video" height='.esc_attr($height).' width='.esc_attr($width).' src="http://v.qq.com/iframe/player.html?vid='.esc_attr($matches[1]).'" frameborder=0 allowfullscreen></iframe>';
}elseif(preg_match('#//v.qq.com/iframe/preview.html\?vid=(.+)#i',$content,$matches)){
//var_dump($matches);exit();
return '<iframe class="wpjam_video" height='.esc_attr($height).' width='.esc_attr($width).' src="http://v.qq.com/iframe/player.html?vid='.esc_attr($matches[1]).'" frameborder=0 allowfullscreen></iframe>';
}
});
add_shortcode('tudou', function($atts, $content=''){
extract( shortcode_atts( array(
'width' => '480',
'height' => '400'
), $atts ) );
$width = (isset($_GET['width']) && intval($_GET['width']))?intval($_GET['width']):$width; // 用于 JSON 接口
$height = round($width/4*3);
if(preg_match('#http://www.tudou.com/programs/view/(.*?)#i',$content, $matches)){
return '<iframe class="wpjam_video" width='. esc_attr($width) .' height='. esc_attr($height) .' src="http://www.tudou.com/programs/view/html5embed.action?code='. esc_attr($matches[1]) .'" frameborder=0 allowfullscreen></iframe>';
}
});
add_shortcode('sohutv', function($atts, $content=''){
extract( shortcode_atts( array(
'width' => '510',
'height' => '498'
), $atts ) );
$width = (isset($_GET['width']) && intval($_GET['width']))?intval($_GET['width']):$width; // 用于 JSON 接口
$height = round($width/4*3);
if(preg_match('#http://tv.sohu.com/upload/static/share/share_play.html\#(.+)#i',$content,$matches)){
//var_dump($matches);exit();
return '<iframe class="wpjam_video" height='.esc_attr($height).' width='.esc_attr($width).' src="http://tv.sohu.com/upload/static/share/share_play.html#'.esc_attr($matches[1]).'" frameborder=0 allowfullscreen></iframe>';
}
});
//WordPress 段代码按钮集合
function gdk_shortcode_list() {
$wpshortcodes = [

View file

@ -9,12 +9,19 @@ Author URI: https://gitcafe.net/
Compatible:5.3.2
*/
//万能的开头
if ( ! defined( 'ABSPATH' ) ) { exit; }
//版本和兼容检查
function deactivate_myself() {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die('启动失败GDK插件需要运行在 PHP 7.2 版本及更高的环境下。');
wp_die('启动失败GDK插件不兼容Git主题且需要运行在 PHP 7.2 版本及更高的环境下。');
}
if (defined('GIT_URL')) {
add_action('update_option_active_plugins', 'deactivate_myself');
}
if (!version_compare(PHP_VERSION, '7.2', '>=')) {
add_action('update_option_active_plugins', 'deactivate_myself');
}