1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-06-05 15:22:20 +02:00

提交更新

This commit is contained in:
云落 2020-02-20 18:59:26 +08:00
parent afa048a4b8
commit 4c90935f30
9 changed files with 87 additions and 200 deletions

View file

@ -16,17 +16,18 @@ add_action('admin_enqueue_scripts', 'gdk_admin_enqueue_script');
function gdk_enqueue_script_frontend() { function gdk_enqueue_script_frontend() {
if (!is_admin()) { if (!is_admin()) {
wp_enqueue_style( 'pure_css', 'https://cdn.jsdelivr.net/npm/css-mint@2.0.7/build/css-mint.min.css', false, GDK_PLUGIN_VER, 'all' ); wp_enqueue_style( 'pure_css', 'https://cdn.jsdelivr.net/npm/css-mint@2.0.7/build/css-mint.min.css', false, GDK_PLUGIN_VER, 'all' );
wp_enqueue_style( 'font-awesome', GDK_BASE_URL.'assets/css/font-awesome.min.css', false, GDK_PLUGIN_VER, 'all' );
//wp_enqueue_style( 'milligram_css', GDK_BASE_URL.'assets/css/milligram.min.css', false, GDK_PLUGIN_VER, 'all' ); //wp_enqueue_style( 'milligram_css', GDK_BASE_URL.'assets/css/milligram.min.css', false, GDK_PLUGIN_VER, 'all' );
wp_enqueue_style( 'gdk_css', GDK_BASE_URL.'assets/css/gdk.css', false, GDK_PLUGIN_VER, 'all' ); wp_enqueue_style( 'gdk_css', GDK_BASE_URL.'assets/css/gdk.css', false, GDK_PLUGIN_VER, 'all' );
wp_deregister_script('jquery'); wp_deregister_script('jquery');
wp_enqueue_script('jquery', GDK_BASE_URL.'assets/js/jQuery.min.js', false, GDK_PLUGIN_VER, true);//加载自定义jQuery2.0.3 wp_enqueue_script('jquery', 'https://cdn.jsdelivr.net/npm/jquery@2.1.0/dist/jquery.min.js', false, GDK_PLUGIN_VER, true);//加载自定义jQuery2.0.3
wp_enqueue_script('code_prettify_js', GDK_BASE_URL.'assets/js/prettify.min.js', array('jquery'), GDK_PLUGIN_VER, true); wp_enqueue_script('code_prettify_js', GDK_BASE_URL.'assets/js/prettify.min.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_enqueue_script('fancybox_js', GDK_BASE_URL.'assets/js/fancybox.min.js', array('jquery'), GDK_PLUGIN_VER, true); wp_enqueue_script('fancybox_js', GDK_BASE_URL.'assets/js/fancybox.min.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_enqueue_script('lazyload_js', GDK_BASE_URL.'assets/js/lazyload.min.js', array('jquery'), GDK_PLUGIN_VER, true); wp_enqueue_script('lazyload_js', GDK_BASE_URL.'assets/js/lazyload.min.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_enqueue_script('sweetalert_js','https://cdn.jsdelivr.net/combine/npm/sweetalert@2.0.0,npm/qrious@4.0.2', [], GDK_PLUGIN_VER, true); wp_enqueue_script('sweetalert_js','https://cdn.jsdelivr.net/combine/npm/sweetalert@2.0.0,npm/qrious@4.0.2', [], GDK_PLUGIN_VER, true);
wp_enqueue_script('gdk_js', GDK_BASE_URL.'assets/js/gdk.js', array('jquery'), GDK_PLUGIN_VER, true); wp_enqueue_script('gdk_js', GDK_BASE_URL.'assets/js/gdk.js', array('jquery'), GDK_PLUGIN_VER, true);
wp_localize_script('gdk_js', 'ajax', [ wp_localize_script('gdk_js', 'ajax', [
'url'=> admin_url('admin-ajax.php'), 'url'=> admin_url('admin-ajax.php'),
'pass_nonce' => wp_create_nonce('pass_nonce'), 'pass_nonce' => wp_create_nonce('pass_nonce'),
'pay_points' => wp_create_nonce('pay_points'), 'pay_points' => wp_create_nonce('pay_points'),
'check_pay_points' => wp_create_nonce('check_pay_points'), 'check_pay_points' => wp_create_nonce('check_pay_points'),
@ -59,7 +60,7 @@ jQuery(function($) {
} }
}); });
$(".add-shortcode").click(function() { $(".add-shortcode").click(function() {
send_to_editor(" " + $(this).data("shortcodes") + " "); send_to_editor("" + $(this).data("shortcodes") + "");
$(".shortcodes-wrap").removeClass("is-active"); $(".shortcodes-wrap").removeClass("is-active");
return false return false
}); });
@ -73,18 +74,18 @@ if ($("#replysubmit").length > 0) {
} }
}); });
} }
/**end**/ /**end**/
}); });
</script> </script>
<?php <?php
} }
add_action('admin_footer','gdk_admin_script'); add_action('admin_footer','gdk_admin_script');

View file

@ -10,14 +10,14 @@ body.compensate-for-scrollbar{overflow:hidden}.fancybox-active{height:auto}.fanc
/*短代码表格样式*/.gdk-table th{background:#7a57d1;border:1px solid #fff;color:#fff;font-weight:700;font-size:1.2pc}.gdk-table tr:nth-child(odd){background:#f4ebf7}.gdk-table td,.gdk-table th{vertical-align:middle;text-align:center}.gdk-table td{border:1px solid #e8daee} /*短代码表格样式*/.gdk-table th{background:#7a57d1;border:1px solid #fff;color:#fff;font-weight:700;font-size:1.2pc}.gdk-table tr:nth-child(odd){background:#f4ebf7}.gdk-table td,.gdk-table th{vertical-align:middle;text-align:center}.gdk-table td{border:1px solid #e8daee}
/**millgram mod begin*/ /**millgram mod begin*/
/*提示框*/.alert{clear:both;clear:none;overflow:hidden;color:#333;box-sizing:border-box;margin-top:5px;margin-bottom:20px;margin-left:-20px;padding:20px 30px;max-width:42rem;background-color:#eee;font-size:15px;border-left-width:5px;border-left-style:solid} /*提示框*/.alert{clear:both;clear:none;overflow:hidden;color:#333;box-sizing:border-box;margin-top:5px;margin-bottom:20px;margin-left:-15px;padding:20px 30px;background-color:#eee;font-size:15px;border-left:5px solid #2196f3}
.cm-badge{padding:8px;font-size:.8em;background-color:#dadada;border-radius:3px;text-align:center;margin-bottom:15px} .cm-badge{padding:8px;font-size:.8em;background-color:#dadada;border-radius:3px;text-align:center;margin-bottom:15px}
.cm-coin{padding:4px 18px;border:1px solid #f0ad4e;border-radius:20px;background-color:#fff;color:#f0ad4e} .cm-coin{padding:4px 18px;border:1px solid #f0ad4e;border-radius:20px;background-color:#fff;color:#f0ad4e}
.cm-round{width:30px;height:30px;border-radius:50%;} .cm-round{width:30px;height:30px;border-radius:50%;}
.warning{background-color:#fdd867;border-color:#f6b73c} .alert-warning,.warning{background-color:#fdd867;border-color:#f6b73c;}
.info{background-color:#7db1f1;border-color:#3d7e9a} .alert-info,.info{background-color:#7db1f1;border-color:#3d7e9a;color:#fff;}
.success{background-color:#68d58c;border-color:#4d9f0c} .alert-success,.success{background-color:#68d58c;border-color:#4d9f0c;color:#fff;}
.error{background-color:#f17783;border-color:#e66465} .alert-error,.error{background-color:#f17783;border-color:#e66465;color:#fff;}
.red{color:#f6003c}.purple{color:#6b48ff}.black{color:#060608}.pink{color:#FF5F5F} .red{color:#f6003c}.purple{color:#6b48ff}.black{color:#060608}.pink{color:#FF5F5F}
.pull-center,.fieldset p{text-align:center;} .pull-center,.fieldset p{text-align:center;}

View file

@ -366,7 +366,7 @@ jQuery(function ($) { /**声明加载jQuery */
content: "input", content: "input",
button: "验证提取码" button: "验证提取码"
}).then((code) => { }).then((code) => {
check_code(a, `$ {code}`); /**文章id, 提取码 */ check_code(a, `${code}`); /**文章id, 提取码 */
}); });
} else { /* 未支付,选择支付方式*/ } else { /* 未支付,选择支付方式*/
pay_way(a, b, c); pay_way(a, b, c);

View file

@ -238,8 +238,6 @@ class WeChat
define("TOKEN", 'wxcaptcha'); //TOKEN值
define("WX_WELCOME", '欢迎关注极客公园'); //欢迎词 define("WX_WELCOME", '欢迎关注极客公园'); //欢迎词
define("POSTNUM", '5'); //文章数量 define("POSTNUM", '5'); //文章数量
define("DEFAULT_THUMB", '');//封面 define("DEFAULT_THUMB", '');//封面
@ -255,9 +253,10 @@ add_action('pre_get_posts', 'wm_preprocess', 4);
function wm_preprocess($wp_query) function wm_preprocess($wp_query)
{ {
global $object; global $object;
$wx_token = trim(gdk_option('gdk_wxmp_token'));
if (!isset($object)) { if (!isset($object)) {
//创建一个WeChat类的实例, 回调函数名称为"onMessage",即消息处理函数 //创建一个WeChat类的实例, 回调函数名称为"onMessage",即消息处理函数
$object = new WeChat(TOKEN, "onMessage"); $object = new WeChat($wx_token, "onMessage");
$object->process(); //处理消息 $object->process(); //处理消息
return; return;
} }

View file

@ -525,6 +525,13 @@ $gdk_options = [
'id' => 'gdk_Server', 'id' => 'gdk_Server',
'type' => 'checkbox' 'type' => 'checkbox'
], ],
[
'name' => '微信公众号TOKEN',
'desc' => '请输入您的微信公众号TOKEN,微信公众号后台获取',
'id' => 'gdk_wxmp_token',
'type' => 'text',
'std' => ''
],
[ [
'name' => '微信推送KEY', 'name' => '微信推送KEY',
'desc' => '请输入您的微信推送KEY', 'desc' => '请输入您的微信推送KEY',

View file

@ -353,6 +353,8 @@ jQuery(function ($) {
}); });
</script> </script>
<?php <?php

View file

@ -1,47 +1,15 @@
<?php <?php
/**
* 字符串截取,支持中文和其他编码
*
* @param string $str 需要转换的字符串
* @param string $start 开始位置
* @param string $length 截取长度
* @param string $charset 编码格式
* @param string $suffix 截断字符串后缀
* @return string
*/
function nc_substr_ext($str, $start = 0, $length = 0, $charset = 'utf-8', $suffix = '')
{
if (function_exists("mb_substr")) {
return mb_substr($str, $start, $length, $charset).$suffix;
} elseif (function_exists('iconv_substr')) {
return iconv_substr($str, $start, $length, $charset).$suffix;
}
$re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
$re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/";
$re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/";
$re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/";
preg_match_all($re[$charset], $str, $match);
$slice = join("", array_slice($match[0], $start, $length));
return $slice.$suffix;
}
function nc_reverse_strrchr($haystack, $needle, $trail)
{
$length = (strrpos($haystack, $needle) + $trail);
return strrpos($haystack, $needle) ? substr($haystack, 0, $length) : false;
}
/** /**
* 获取完整的句子 * 获取摘要
*/ */
function gdk_print_excerpt($length, $post = null, $echo = true) function gdk_print_excerpt($length, $post = null, $echo = true, $more = '...')
{ {
global $post; $text = get_the_excerpt($post);//自带的摘要
$text = $post->post_excerpt;
if ('' == $text) { if ('' == $text) {
$text = get_the_content(); $text = get_the_content();//获取文字
$text = strip_shortcodes($text);
$text = apply_filters('the_content', $text); $text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text); $text = str_replace(']]>', ']]>', $text);
} }
@ -49,13 +17,10 @@ function gdk_print_excerpt($length, $post = null, $echo = true)
$text = strip_shortcodes($text); $text = strip_shortcodes($text);
$text = strip_tags($text); $text = strip_tags($text);
$text = nc_substr_ext($text, 0, $length); $excerpt = wp_trim_words( $text, $length, $more );
$excerpt = nc_reverse_strrchr($text, '。', 3);
if ($excerpt) { if ($excerpt) {
$result = strip_tags(apply_filters('the_excerpt', $excerpt)).'...'; $result = $excerpt;
} else {
$result = strip_tags(apply_filters('the_excerpt', $text)).'...';
} }
if ($echo == true) { if ($echo == true) {
echo $result; echo $result;
@ -121,109 +86,6 @@ function nc_get_template_part_with_vars($slug, array $params = array(), $output
} }
} }
function nc_ajax_comment_callback()
{
global $wpdb;
$comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0;
$post = get_post($comment_post_ID);
$post_author = $post->post_author;
if (empty($post->comment_status)) {
do_action('comment_id_not_found', $comment_post_ID);
nc_ajax_comment_err('Invalid comment status.');
}
$status = get_post_status($post);
$status_obj = get_post_status_object($status);
if (!comments_open($comment_post_ID)) {
do_action('comment_closed', $comment_post_ID);
nc_ajax_comment_err(__('Sorry, comments are closed.', 'jimu'));
} elseif ('trash' == $status) {
do_action('comment_on_trash', $comment_post_ID);
nc_ajax_comment_err(__('Unknown error.', 'jimu'));
} elseif (!$status_obj->public && !$status_obj->private) {
do_action('comment_on_draft', $comment_post_ID);
nc_ajax_comment_err(__('Unknown error.', 'jimu'));
} elseif (post_password_required($comment_post_ID)) {
do_action('comment_on_password_protected', $comment_post_ID);
nc_ajax_comment_err(__('Password protected.', 'jimu'));
} else {
do_action('pre_comment_on_post', $comment_post_ID);
}
$comment_author = (isset($_POST['author'])) ? trim(strip_tags($_POST['author'])) : null;
$comment_author_email = (isset($_POST['email'])) ? trim($_POST['email']) : null;
$comment_author_url = (isset($_POST['url'])) ? trim($_POST['url']) : null;
$comment_content = (isset($_POST['comment'])) ? trim($_POST['comment']) : null;
$user = wp_get_current_user();
$user_id = $user->ID;
if ($user->exists()) {
if (empty($user->display_name)) {
$user->display_name=$user->user_login;
}
$comment_author = esc_sql($user->display_name);
$comment_author_email = esc_sql($user->user_email);
$comment_author_url = esc_sql($user->user_url);
$user_id = esc_sql($user->ID);
} else {
if (get_option('comment_registration') || 'private' == $status) {
nc_ajax_comment_err('<p>'.__('Sorry, you must be logged in to leave a comment', 'jimu').'</p>');
} // 抱歉,您必须登录后才能发表评论。
}
$comment_type = '';
if (get_option('require_name_email') && !$user->exists()) {
if (6 > strlen($comment_author_email) || '' == $comment_author) {
nc_ajax_comment_err('<p>'.__('Please fill in the required options (Name, Email).', 'jimu').'</p>');
} // 错误:请填写必须的选项(姓名,电子邮件)。
elseif (!is_email($comment_author_email)) {
nc_ajax_comment_err('<p>'.__('Please input a valid email address.', 'jimu').'</p>');
} // 错误:请输入有效的电子邮件地址。
}
if ('' == $comment_content) {
nc_ajax_comment_err('<p>'.__('Say something...', 'jimu').'</p>');
} // 说点什么吧
$dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$comment_author' ";
if ($comment_author_email) {
$dupe .= "OR comment_author_email = '$comment_author_email' ";
}
$dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
if ($wpdb->get_var($dupe)) {
nc_ajax_comment_err('<p>'.__('Please do not repeat your comments. :)', 'jimu').'</p>'); // Do not repeat comments aha~似乎说过这句话了
}
if ($lasttime = $wpdb->get_var($wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author = %s ORDER BY comment_date DESC LIMIT 1", $comment_author))) {
$time_lastcomment = mysql2date('U', $lasttime, false);
$time_newcomment = mysql2date('U', current_time('mysql', 1), false);
$flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
if ($flood_die) {
nc_ajax_comment_err('<p>'.__('You reply too fast. Take it easy.', 'jimu').'</p>'); // 你回复太快啦。慢慢来。
}
}
$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
$comment_id = wp_new_comment($commentdata);
$comment = get_comment($comment_id);
do_action('set_comment_cookies', $comment, $user, true);
$comment_depth = 1;
$tmp_c = $comment;
while ($tmp_c->comment_parent != 0) {
$comment_depth++;
$tmp_c = get_comment($tmp_c->comment_parent);
}
$GLOBALS['comment'] = $comment;
get_template_part('comment'); ?>
<?php
die();
}
function nc_ajax_comment_err($a)
{
header('HTTP/1.0 500 Internal Server Error');
header('Content-Type: text/plain;charset=UTF-8');
echo $a;
exit;
}
function nc_ajax_load_comments() function nc_ajax_load_comments()
{ {
@ -505,13 +367,9 @@ function gdk_validate_ip( $ip) {
//Ajax报错方式 //Ajax报错方式
function gdk_die($ErrMsg) { function gdk_die($ErrMsg) {
if(gdk_option('gdk_ajax') || GDK_IAM_AJAX ){//define( 'GDK_IAM_AJAX', true ); 由主题插入functiom 自己声明是Ajax,防止用户搞错
header('HTTP/1.1 405 Method Not Allowed'); header('HTTP/1.1 405 Method Not Allowed');
header('Content-Type: text/plain;charset=UTF-8'); header('Content-Type: text/plain;charset=UTF-8');
exit($ErrMsg); exit($ErrMsg);
}else{
wp_die($ErrMsg);
}
} }
//面包屑导航 //面包屑导航
@ -972,7 +830,7 @@ function gdk_thumb_img($way,$width,$height,$style = '',$atrr = 'class="thumb_img
}elseif ($way === 3) { }elseif ($way === 3) {
$src = aq_resize( $url, $width , $height , true); $src = aq_resize( $url, $width , $height , true);
if(empty($src)){ if(empty($src)){
$src = GDK_BASE_URL . 'public/timthumb.php?src='.$url.'&h='.$height.'&w='.$width.'&q=90&zc=1&ct=1'; $src = GDK_BASE_URL . 'public/timthumb.php?src='.$url.'&h='.$height.'&w='.$width.'&q=90&zc=1&ct=1';
} }
}else{ }else{
return false; return false;
@ -1226,7 +1084,7 @@ function create_user_id( $userdata ){
) )
); );
if (is_wp_error($weauth_user) || !count($weauth_user)) { if (is_wp_error($weauth_user) || !count($weauth_user)) {
$user_info = array( $user_info = array(
'user_login' => $login_name, 'user_login' => $login_name,
'display_name' => $nickname, 'display_name' => $nickname,
@ -1303,15 +1161,17 @@ function wx_captcha(){
$min = floor(date("i")/2); $min = floor(date("i")/2);
$day = date("d"); $day = date("d");
$day = ltrim($day,0); $day = ltrim($day,0);
$url = home_url(); $home = home_url();
$captcha = sha1($min.$url); $wx_token = trim(gdk_option('gdk_wxmp_token'));
$captcha = sha1($min.$home.$wx_token);
$captcha = substr($captcha , $day , 6); $captcha = substr($captcha , $day , 6);
return $captcha; return $captcha;
} }
function gdk_post_dropdown(){ function gdk_post_dropdown(){
/* Option list of all post */ /* Option list of all post */
$gdk_options_posts = []; $gdk_options_posts = [];
$gdk_options_posts_obj = get_posts('posts_per_page=-1'); $gdk_options_posts_obj = get_posts('posts_per_page=-1');
$gdk_options_posts[''] = '选择文章'; $gdk_options_posts[''] = '选择文章';
@ -1331,7 +1191,7 @@ function gdk_categories_dropdown(){
'hide_empty' => 1, 'hide_empty' => 1,
'hierarchical' => 1, 'hierarchical' => 1,
'taxonomy' => 'category' 'taxonomy' => 'category'
); );
$gdk_option_categories = []; $gdk_option_categories = [];
$gdk_category_lists = get_categories( $gdk_args ); $gdk_category_lists = get_categories( $gdk_args );
$gdk_option_categories[''] = '选择分类'; $gdk_option_categories[''] = '选择分类';
@ -1350,7 +1210,7 @@ function gdk_tag_dropdown(){
'hide_empty' => 1, 'hide_empty' => 1,
'hierarchical' => 1, 'hierarchical' => 1,
'taxonomy' => 'tag' 'taxonomy' => 'tag'
); );
$gdk_option_tags = []; $gdk_option_tags = [];
$gdk_tag_lists = get_tags( $gdk_args ); $gdk_tag_lists = get_tags( $gdk_args );
$gdk_option_tags[''] = '选择标签'; $gdk_option_tags[''] = '选择标签';

View file

@ -79,41 +79,37 @@ add_shortcode('reply', 'gdk_reply_to_read');
//绿色提醒框 //绿色提醒框
function gdk_toz($atts, $content = null) { function gdk_toz($atts, $content = null) {
return '<div id="sc_notice">' . $content . '</div>'; return '<div class="alert success">' . $content . '</div>';
} }
add_shortcode('v_notice', 'gdk_toz'); add_shortcode('v_notice', 'gdk_toz');
//红色提醒框 //红色提醒框
function gdk_toa($atts, $content = null) { function gdk_toa($atts, $content = null) {
return '<div id="sc_error">' . $content . '</div>'; return '<div class="alert error">' . $content . '</div>';
} }
add_shortcode('v_error', 'gdk_toa'); add_shortcode('v_error', 'gdk_toa');
//黄色提醒框 //黄色提醒框
function gdk_toc($atts, $content = null) { function gdk_toc($atts, $content = null) {
return '<div id="sc_warn">' . $content . '</div>'; return '<div class="alert warning">' . $content . '</div>';
} }
add_shortcode('v_warn', 'gdk_toc'); add_shortcode('v_warn', 'gdk_toc');
//灰色提醒框
function gdk_tob($atts, $content = null) {
return '<div id="sc_tips">' . $content . '</div>';
}
add_shortcode('v_tips', 'gdk_tob');
//蓝色提醒框 //蓝色提醒框
function gdk_tod($atts, $content = null) { function gdk_tod($atts, $content = null) {
return '<div id="sc_blue">' . $content . '</div>'; return '<div class="alert primary">' . $content . '</div>';
} }
add_shortcode('v_blue', 'gdk_tod'); add_shortcode('v_blue', 'gdk_tod');
//蓝边文本框 //蓝边文本框
function gdk_toe($atts, $content = null) { function gdk_toe($atts, $content = null) {
return '<div class="sc_act">' . $content . '</div>'; return '<div class="alert">' . $content . '</div>';
} }
add_shortcode('v_act', 'gdk_toe'); add_shortcode('v_tips', 'gdk_toe');
//灵魂按钮 //灵魂按钮
function gdk_tom($atts, $content = null) { function gdk_tom($atts, $content = null) {
extract(shortcode_atts(array( extract(shortcode_atts(array(
"href" => 'http://' "href" => 'http://'
) , $atts)); ) , $atts));
return '<a class="lhb" href="' . $href . '" target="_blank" rel="nofollow">' . $content . '</a>'; return '<a class="cm-btn success" href="' . $href . '" target="_blank" rel="nofollow">' . $content . '</a>';
} }
add_shortcode('lhb', 'gdk_tom'); add_shortcode('lhb', 'gdk_tom');
//添加视频按钮 //添加视频按钮
@ -254,7 +250,7 @@ function gdk_insert_posts($atts, $content = null) {
$content.= '</a><p class="note">'; $content.= '</a><p class="note">';
$content.= get_the_excerpt(); $content.= get_the_excerpt();
$content.= '</p></div><div class="frr"><a target="_blank" href="' . get_permalink() . '"><img src='; $content.= '</p></div><div class="frr"><a target="_blank" href="' . get_permalink() . '"><img src=';
$content.= link_the_thumbnail_src(); $content.= gdk_thumbnail_src();
$content.= ' class="neilian-thumb"></a></div></div>'; $content.= ' class="neilian-thumb"></a></div></div>';
} }
wp_reset_postdata(); wp_reset_postdata();
@ -418,23 +414,45 @@ function gdk_shortcode_list() {
'透明按钮'=>'[lhb href=] [/lhb]', '透明按钮'=>'[lhb href=] [/lhb]',
'视频按钮'=>'[video play=0] [/video]', '视频按钮'=>'[video play=0] [/video]',
'音频按钮'=>'[audio play=0] [/audio]', '音频按钮'=>'[audio play=0] [/audio]',
'绿色通知'=>'[v_notice] [/v_notice]', '绿色通知'=>'[v_notice]
'红色警告'=>'[v_error] [/v_error]',
'黄色错误'=>'[v_warn] [/v_warn]', [/v_notice]',
'灰色提示'=>'[v_tips] [/v_tips]', '红色警告'=>'[v_error]
'蓝边提示'=>'[v_act] [/v_act]',
'隐藏收缩'=>'[collapse title=\'\'] [/collapse]', [/v_error]',
'回复可见'=>'[reply] [/reply]', '黄色错误'=>'[v_warn]
'登陆可见'=>'[vip] [/vip]',
'密码可见'=>'[secret wx=0] [/secret]', [/v_warn]',
'蓝色提示'=>'[v_blue]
[/v_blue]',
'默认提示'=>'[v_tips]
[/v_tips]',
'隐藏收缩'=>'[collapse title=\'\']
[/collapse]',
'回复可见'=>'[reply]
[/reply]',
'登陆可见'=>'[vip]
[/vip]',
'微信验证码可见'=>'[wxcaptcha]
[/wxcaptcha]',
'积分购买可见'=>'[pay point=\'10\']这里是需要付费的内容[/pay]', '积分购买可见'=>'[pay point=\'10\']这里是需要付费的内容[/pay]',
'游客付费可见'=>'[pax money=1]', '游客付费可见'=>'[pax money=1]',
'弹窗下载'=>'[fanctdl filename=\'这里填写文件名\' filepass=\'这里填写文件密码什么的\' href=\'这里填写的主下载链接\' filedown=\'这里填写的是文件的主下载名称\']这里填写的文件的辅助下载链接,可写多个,空格间隔[/fanctdl]', '弹窗下载'=>'[fanctdl filename=\'这里填写文件名\' filepass=\'这里填写文件密码什么的\' href=\'这里填写的主下载链接\' filedown=\'这里填写的是文件的主下载名称\']这里填写的文件的辅助下载链接,可写多个,空格间隔[/fanctdl]',
'面板下载'=>'[dltable file=\'在此处写下文件名称\' pass=\'在这里写下文件密码\']这里填写的文件的辅助下载链接,可写多个,空格间隔[/dltable]', '面板下载'=>'[dltable file=\'在此处写下文件名称\' pass=\'在这里写下文件密码\']这里填写的文件的辅助下载链接,可写多个,空格间隔[/dltable]',
'单页下载'=>'[pdownload title=]', '单页下载'=>'[pdownload title=]',
'文章内链'=>'[neilian ids=]', '文章内链'=>'[neilian ids=]',
'无序列表'=>'[list] [/list]', '无序列表'=>'[list]
'表格简码'=>'[table] [/table]'
[/list]',
'表格简码'=>'[table]
[/table]'
]; ];
$output = ''; $output = '';
foreach ($wpshortcodes as $name => $alt) { foreach ($wpshortcodes as $name => $alt) {

File diff suppressed because one or more lines are too long