pull/128/head
mashiro 2019-11-13 20:32:10 +08:00
parent cacd4efc13
commit c3a0d671ed
2 changed files with 20 additions and 13 deletions

View File

@ -233,6 +233,7 @@ require get_template_directory() . '/inc/categories-images.php';
//Comment Location Start
function convertip($ip) {
error_reporting(E_ALL ^ E_NOTICE);
$dat_path = dirname(__FILE__).'/inc/QQWry.Dat';
if(!$fd = @fopen($dat_path, 'rb')){
return 'IP date file not exists or access denied';
@ -468,7 +469,7 @@ function set_post_views() {
$post_id = intval($post->ID);
$count_key = 'views';
$views = get_post_custom($post_id);
$views = intval($views['views'][0]);
$views = array_key_exists("views",$views) ? intval($views['views'][0]) : 0;
if(is_single() || is_page()) {
if(!update_post_meta($post_id, 'views', ($views + 1))) {
add_post_meta($post_id, 'views', 1, true);
@ -487,7 +488,7 @@ function get_post_views($post_id) {
} else {
$count_key = 'views';
$views = get_post_custom($post_id);
$views = intval($views['views'][0]);
$views = array_key_exists("views",$views) ? intval($views['views'][0]) : 0;
$post_views = intval(post_custom('views'));
if($views == '') {
return 0;
@ -1286,7 +1287,7 @@ function memory_archives_list() {
/* Remove the "Dashboard" from the admin menu for non-admin users */
function remove_dashboard () {
global $current_user, $menu, $submenu;
get_currentuserinfo();
wp_get_current_user();
if( ! in_array( 'administrator', $current_user->roles ) ) {
reset( $menu );
@ -1603,13 +1604,17 @@ function output_comments_qq_columns( $column_name, $comment_id ){
*/
add_filter( 'get_avatar', 'change_avatar', 10, 3 );
function change_avatar($avatar){
global $comment;
if( get_comment_meta( $comment->comment_ID, 'new_field_qq', true ) ){
$qq_number = get_comment_meta( $comment->comment_ID, 'new_field_qq', true );
return '<img src="https://q2.qlogo.cn/headimg_dl?dst_uin='.$qq_number.'&spec=100" data-src="'.stripslashes($m[1]).'" class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
}else{
return $avatar ;
}
global $comment;
if ($comment) {
if( get_comment_meta( $comment->comment_ID, 'new_field_qq', true )){
$qq_number = get_comment_meta( $comment->comment_ID, 'new_field_qq', true );
return '<img src="https://q2.qlogo.cn/headimg_dl?dst_uin='.$qq_number.'&spec=100" data-src="'.stripslashes($m[1]).'" class="lazyload avatar avatar-24 photo" alt="😀" width="24" height="24" onerror="imgError(this,1)">';
}else{
return $avatar ;
}
} else{
return $avatar ;
}
}
// default feature image

View File

@ -260,7 +260,7 @@ function Exuser_center(){ ?>
// 登录成功
function login_ok(){
global $current_user;
get_currentuserinfo();
wp_get_current_user();
?>
<p class="ex-login-avatar"><a href="http://cn.gravatar.com/" title="<?php _e('Change avatar','sakura')/*更换头像*/?>" target="_blank" rel="nofollow"><?php echo get_avatar( $current_user->user_email, '110' ); ?></a></p>
<p class="ex-login-username"><?php _e('Hello, ','sakura')/*你好,*/?><strong><?php echo $current_user->display_name; ?></strong></p>
@ -464,7 +464,7 @@ function the_video_headPattern_normal(){
* 导航栏用户菜单
*/
function header_user_menu(){
global $current_user;get_currentuserinfo();
global $current_user;wp_get_current_user();
if(is_user_logged_in()){
$ava = akina_option('focus_logo') ? akina_option('focus_logo') : get_avatar_url( $current_user->user_email );
?>
@ -510,7 +510,9 @@ function header_user_menu(){
// 上一篇
function get_prev_thumbnail_url() {
$prev_post = get_previous_post();
if ( has_post_thumbnail($prev_post->ID) ) {
if (!$prev_post) {
return get_random_bg_url(); // 首页图
} else if ( has_post_thumbnail($prev_post->ID) ) {
$img_src = wp_get_attachment_image_src( get_post_thumbnail_id( $prev_post->ID ), 'large');
return $img_src[0]; // 特色图
}