mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-26 00:38:12 +08:00
bug fix
This commit is contained in:
parent
cacd4efc13
commit
c3a0d671ed
@ -233,6 +233,7 @@ require get_template_directory() . '/inc/categories-images.php';
|
|||||||
|
|
||||||
//Comment Location Start
|
//Comment Location Start
|
||||||
function convertip($ip) {
|
function convertip($ip) {
|
||||||
|
error_reporting(E_ALL ^ E_NOTICE);
|
||||||
$dat_path = dirname(__FILE__).'/inc/QQWry.Dat';
|
$dat_path = dirname(__FILE__).'/inc/QQWry.Dat';
|
||||||
if(!$fd = @fopen($dat_path, 'rb')){
|
if(!$fd = @fopen($dat_path, 'rb')){
|
||||||
return 'IP date file not exists or access denied';
|
return 'IP date file not exists or access denied';
|
||||||
@ -468,7 +469,7 @@ function set_post_views() {
|
|||||||
$post_id = intval($post->ID);
|
$post_id = intval($post->ID);
|
||||||
$count_key = 'views';
|
$count_key = 'views';
|
||||||
$views = get_post_custom($post_id);
|
$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(is_single() || is_page()) {
|
||||||
if(!update_post_meta($post_id, 'views', ($views + 1))) {
|
if(!update_post_meta($post_id, 'views', ($views + 1))) {
|
||||||
add_post_meta($post_id, 'views', 1, true);
|
add_post_meta($post_id, 'views', 1, true);
|
||||||
@ -487,7 +488,7 @@ function get_post_views($post_id) {
|
|||||||
} else {
|
} else {
|
||||||
$count_key = 'views';
|
$count_key = 'views';
|
||||||
$views = get_post_custom($post_id);
|
$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'));
|
$post_views = intval(post_custom('views'));
|
||||||
if($views == '') {
|
if($views == '') {
|
||||||
return 0;
|
return 0;
|
||||||
@ -1286,7 +1287,7 @@ function memory_archives_list() {
|
|||||||
/* Remove the "Dashboard" from the admin menu for non-admin users */
|
/* Remove the "Dashboard" from the admin menu for non-admin users */
|
||||||
function remove_dashboard () {
|
function remove_dashboard () {
|
||||||
global $current_user, $menu, $submenu;
|
global $current_user, $menu, $submenu;
|
||||||
get_currentuserinfo();
|
wp_get_current_user();
|
||||||
|
|
||||||
if( ! in_array( 'administrator', $current_user->roles ) ) {
|
if( ! in_array( 'administrator', $current_user->roles ) ) {
|
||||||
reset( $menu );
|
reset( $menu );
|
||||||
@ -1603,13 +1604,17 @@ function output_comments_qq_columns( $column_name, $comment_id ){
|
|||||||
*/
|
*/
|
||||||
add_filter( 'get_avatar', 'change_avatar', 10, 3 );
|
add_filter( 'get_avatar', 'change_avatar', 10, 3 );
|
||||||
function change_avatar($avatar){
|
function change_avatar($avatar){
|
||||||
global $comment;
|
global $comment;
|
||||||
if( get_comment_meta( $comment->comment_ID, 'new_field_qq', true ) ){
|
if ($comment) {
|
||||||
$qq_number = get_comment_meta( $comment->comment_ID, 'new_field_qq', true );
|
if( 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)">';
|
$qq_number = get_comment_meta( $comment->comment_ID, 'new_field_qq', true );
|
||||||
}else{
|
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)">';
|
||||||
return $avatar ;
|
}else{
|
||||||
}
|
return $avatar ;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
return $avatar ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// default feature image
|
// default feature image
|
||||||
|
@ -260,7 +260,7 @@ function Exuser_center(){ ?>
|
|||||||
// 登录成功
|
// 登录成功
|
||||||
function login_ok(){
|
function login_ok(){
|
||||||
global $current_user;
|
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-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>
|
<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(){
|
function header_user_menu(){
|
||||||
global $current_user;get_currentuserinfo();
|
global $current_user;wp_get_current_user();
|
||||||
if(is_user_logged_in()){
|
if(is_user_logged_in()){
|
||||||
$ava = akina_option('focus_logo') ? akina_option('focus_logo') : get_avatar_url( $current_user->user_email );
|
$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() {
|
function get_prev_thumbnail_url() {
|
||||||
$prev_post = get_previous_post();
|
$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');
|
$img_src = wp_get_attachment_image_src( get_post_thumbnail_id( $prev_post->ID ), 'large');
|
||||||
return $img_src[0]; // 特色图
|
return $img_src[0]; // 特色图
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user