<?php
//**切换暗黑风格
function tap_dark()
{
session_start();
$is_ripro_dark = !empty($_POST['is_ripro_dark']) ? intval($_POST['is_ripro_dark']) : 0;
$_SESSION['is_ripro_dark'] = $is_ripro_dark;
echo $_SESSION['is_ripro_dark'];
exit();
}
add_action('wp_ajax_tap_dark', 'tap_dark');
add_action('wp_ajax_nopriv_tap_dark', 'tap_dark');
//**切换博客模式
function blog_style()
{
session_start();
$is_blog_style = ($_POST['is_blog_style'] == '0') ? 1 : 0;
$_SESSION['is_blog_style'] = $is_blog_style;
echo $_SESSION['is_blog_style'];
exit();
}
add_action('wp_ajax_blog_style', 'blog_style');
add_action('wp_ajax_nopriv_blog_style', 'blog_style');
/**
* [ajax_getcat_post 分类文章获取]
* @Author Dadong2g
* @DateTime 2020-03-05T19:56:17+0800
* @return [type] [html str]
*/
function ajax_getcat_post()
{
global $wp_query;
header('Content-type:application/html; Charset=utf-8');
// $paged = !empty($_POST['paged']) ? esc_sql($_POST['paged']) : 1;
$cat = !empty($_POST['cat']) ? esc_sql($_POST['cat']) : '';
/////////////
$is_cao_site_list_blog = is_cao_site_list_blog();
if ($is_cao_site_list_blog) {
$latest_layout = 'bloglist';
}else{
$latest_layout = _cao( 'latest_layout', 'grid' );
}
/////////////
$args = array(
'cat' => $cat,
'post_status' => 'publish',
);
$data = new WP_Query($args);
if ($data->have_posts()) {
while ( $data->have_posts() ) : $data->the_post();
get_template_part( 'parts/template-parts/content', $latest_layout );
endwhile;
}else{
get_template_part( 'parts/template-parts/content', 'none' );
}
wp_reset_postdata();
exit();
}
add_action('wp_ajax_ajax_getcat_post', 'ajax_getcat_post');
add_action('wp_ajax_nopriv_ajax_getcat_post', 'ajax_getcat_post');
/**
* [ajax_search AJAX搜索]
* @Author Dadong2g
* @DateTime 2019-08-21T23:35:34+0800
* @return [type] [JSON Arr]
*/
function ajax_search()
{
global $wp_query;
header('Content-type:application/json; Charset=utf-8');
$text = !empty($_POST['text']) ? esc_sql($_POST['text']) : null;
$args = array('s' => $text,'posts_per_page' => 5);
$array_posts = array ();
$data = new WP_Query($args);
while ( $data->have_posts() ) : $data->the_post();
array_push($array_posts, array("title"=>get_the_title(),"url"=>get_permalink(),"img"=>_get_post_timthumb_src() ));
endwhile;
echo json_encode($array_posts);
exit();
}
add_action('wp_ajax_ajax_search', 'ajax_search');
add_action('wp_ajax_nopriv_ajax_search', 'ajax_search');
function get_mpweixin_qr()
{
header('Content-type:application/json; Charset=utf-8');
session_start();
$wxConfig = _cao('oauth_mpweixin');
$CaoMpWeixin = new CaoMpWeixin($wxConfig);
echo json_encode($CaoMpWeixin->getLoginQr());exit;
}
add_action('wp_ajax_get_mpweixin_qr', 'get_mpweixin_qr');
add_action('wp_ajax_nopriv_get_mpweixin_qr', 'get_mpweixin_qr');
function check_mpweixin_qr()
{
header('Content-type:application/json; Charset=utf-8');
$scene_id = !empty($_POST['scene_id']) ? esc_sql($_POST['scene_id']) : null;
global $current_user;
$current_user_id =$current_user->ID;
// 查询数据库
global $wpdb, $mpwx_log_table_name;
$res = $wpdb->get_row($wpdb->prepare("SELECT * FROM $mpwx_log_table_name WHERE scene_id = %s ", esc_sql($scene_id)));
if (($res->create_time+180)<time()) {
echo json_encode(array('status' => 0));exit;
//180秒内有效
}
// 查询openid
$_prefix = 'mpweixin';
$_openid_meta_key = 'open_' . $_prefix . '_openid';
$user_exist = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key=%s AND meta_value=%s", $_openid_meta_key, $res->openid));
if (!$current_user_id && !empty($res) && $res->scene_id == $scene_id && !empty($res->openid)) {
if(!empty($user_exist)){
wp_set_auth_cookie($user_exist, true, false);
$user = get_user_by('id', $user_exist);
do_action('wp_login', $user->user_login, $user); // 保证挂载的action执行
}
$status = 1;
}else{
$status = 0;
}
echo json_encode(array('status' => $status));exit;
}
add_action('wp_ajax_check_mpweixin_qr', 'check_mpweixin_qr');
add_action('wp_ajax_nopriv_check_mpweixin_qr', 'check_mpweixin_qr');
/**
* [user_login 用户登录]
* @Author Dadong2g
* @DateTime 2019-06-02T15:34:38+0800
* @return [type] [description]
*/
function user_login()
{
session_start();
header('Content-type:application/json; Charset=utf-8');
$username = !empty($_POST['username']) ? esc_sql($_POST['username']) : null;
$password = !empty($_POST['password']) ? esc_sql($_POST['password']) : null;
$rememberme = !empty($_POST['rememberme']) ? esc_sql($_POST['rememberme']) : null;
if (_cao('is_close_wplogin')) {
echo json_encode(array('status' => '0', 'msg' => '仅开放社交账号登录'));exit;
}
$login_data = array();
$login_data['user_login'] = $username;
$login_data['user_password'] = $password;
$login_data['remember'] = false;
if (isset($rememberme) && $rememberme == '1') {
$login_data['remember'] = true;
}
if (!$username || !$password) {
echo json_encode(array('status' => '0', 'msg' => '请输入登录账号/密码'));exit;
}
//是否腾讯验证
if (_cao('is_captcha_qq','0') && @$_SESSION['is_tencentcaptcha'] == 0) {
$_SESSION['is_tencentcaptcha'] = 0;
echo json_encode(array('status' => '0', 'msg' => '安全验证失败'));exit;
}
$user_verify = wp_signon($login_data, false);
if (is_wp_error($user_verify)) {
echo json_encode(array('status' => '0', 'msg' => '用户名或密码错误'));exit;
} else {
echo json_encode(array('status' => '1', 'msg' => '登录成功'));exit;
}
exit();
}
add_action('wp_ajax_user_login', 'user_login');
add_action('wp_ajax_nopriv_user_login', 'user_login');
/**
* [user_register 注册新用户]
* @Author Dadong2g
* @DateTime 2019-06-02T15:34:30+0800
* @return [type] [description]
*/
function user_register()
{
session_start();
header('Content-type:application/json; Charset=utf-8');
$user_name = !empty($_POST['user_name']) ? sanitize_user($_POST['user_name']) : null;
$user_email = !empty($_POST['user_email']) ? apply_filters('user_registration_email', $_POST['user_email']) : null;
$user_pass = !empty($_POST['user_pass']) ? esc_sql($_POST['user_pass']) : null;
if (!$user_name || !$user_email || !$user_pass) {
echo json_encode(array('status' => '0', 'msg' => '注册信息错误'));exit;
}
if (_cao('is_close_wpreg')) {
echo json_encode(array('status' => '0', 'msg' => '仅开放社交账号注册'));exit;
}
if (!validate_username($user_name)) {
echo json_encode(array('status' => '0', 'msg' => '用户名包含无效字符'));exit;
}
if (username_exists($user_name)) {
echo json_encode(array('status' => '0', 'msg' => '该用户名已被注册'));exit;
}
if (!is_email($user_email)) {
echo json_encode(array('status' => '0', 'msg' => '邮箱地址错误'));exit;
}
if (email_exists($user_email)) {
echo json_encode(array('status' => '0', 'msg' => '邮箱已经被注册'));exit;
}
if (strlen($user_pass) < 6) {
echo json_encode(array('status' => '0', 'msg' => '密码长度不得小于6位'));exit;
}
// 是否需要邮箱验证
if (_cao('is_email_reg_cap')) {
if (empty($_POST
没有合适的资源?快使用搜索试试~ 我知道了~
LaySNS模板仿RiPro日主题素材源码资源下载响应式CMS模板
共49个文件
html:19个
js:8个
svg:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 160 浏览量
2024-07-02
19:43:06
上传
评论
收藏 904KB ZIP 举报
温馨提示
该主题是网上泛滥的RiPro主题仿制而成的laysns模板,原主题是很强大的, 全站功能是通过ajax响应实现的,但本人技术有限,只会仿,不会移植,(主要ajax这里不知道怎么弄)。 另外就是网上流传得比较多的是美化版,我仿时不知道, 于是现在弄出来的是官网的那样版本,总之我会在下个版本更新成美化版的。 主要说明:付费/回复下载功能的,需要安装后台附件插件(其他下载类插件别问我,我没用过),否则无法使用。 更新如下: 1、修复下载弹窗获取链接功能,统计下载数量; 2、增加文章限制内容,下载附件支持添加演示链接; 3、优化并添加美化版下载页面模块; 4、增加全站统计功能; 5、重新优化修复文章/下载列表付费/免费/评论/热度排序功能; 6、增加首页顶部大图轮播功能; 7、首页更新列表支持博客模式切换; 8、重新优化夜间模式功能; 9、增加首页、列表页文章一键收藏功能。 10、优化文章发布页描述词自定义功能; 默认免费下载需要登录。网站AJAX响应式跳转,网站图片懒加载, 文章图片自动添加alt ,日夜模式切换,多种排序列表,无刷新加载下一页。 公告功能
资源推荐
资源详情
资源评论
收起资源包目录
68395c_RIpro.zip (49个子文件)
c_RIpro
说明.html 3KB
config.php 245B
js
app.js 55KB
instantclick.min.js 6KB
jquery.fancybox.min.js 60KB
sweetalert2.min.js 37KB
highlight.pack.js 42KB
home.js 2KB
jquery-2.2.4.min.js 84KB
plugins.js 118KB
api
core-ajax.php 105KB
css
pure-highlight.css 108B
default.css 952B
external.css 121KB
app.css 197KB
jquery.fancybox.min.css 14KB
sweetalert2.min.css 21KB
html
index_index.html 25KB
index_base.html 5KB
articles_edit.html 10KB
.htaccess 79B
articles_softlist.html 6KB
index_article.html 10KB
articles_articlelist.html 9KB
index_footer.html 14KB
articles_lists.html 14KB
index_sign.html 4KB
index_soft.html 10KB
index_header.html 5KB
articles_choice.html 6KB
index_comment.html 5KB
index_search.html 5KB
index_tips.html 2KB
index_superlinks.html 5KB
articles_add.html 10KB
images
说明.html 3KB
svg
rings.svg 2KB
xiangmu.svg 1KB
shoucang.svg 1KB
xiazai.svg 1KB
anquan.svg 2KB
dingdan.svg 2KB
rings.svg 2KB
fonts
materialdesignicons-webfont.woff2 110KB
materialdesignicons-webfont.woff 145KB
materialdesignicons-webfont.ttf 296KB
fontawesome-webfont.woff 88KB
fontawesome-webfont.woff2 70KB
fontawesome-webfont.ttf 149KB
共 49 条
- 1
资源评论
希希分享
- 粉丝: 5952
- 资源: 3542
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功