*/ $general_setting = $GLOBALS['dmeng_general_setting']; $header_profile_display = intval($general_setting['header_profile']); $header_content = ''; $custom_header = dmeng_custom_header(); if ($custom_header) { $header_content = '<div class="container header-content"><div class="row">'; $header_content .= '<div class="' . ($header_profile_display ? 'col-lg-8 col-md-7 col-sm-6 col-xs-12' : 'col-lg-12 col-md-12 col-sm-12 col-xs-12') . '">' . $custom_header . '</div>'; if ($header_profile_display) { $profile_li = ''; $current_user = wp_get_current_user(); if ($current_user->exists()) { $author_url = get_edit_profile_url($current_user->ID); $avatar_url = dmeng_get_avatar($current_user->ID, '54', dmeng_get_avatar_type($current_user->ID), false); $profile_li .= '<li class="clearfix">' . sprintf(__('<a href="%1$s" class="name" title="%2$s">%2$s</a>,你好!', 'dmeng'), get_edit_profile_url($current_user->ID), $current_user->display_name) . '<a href="' . wp_logout_url(dmeng_get_current_page_url()) . '" title="' . esc_attr__('Log out of this account') . '" data-no-instant>' . __('Log out »') . '</a></li>'; $unread_count = intval(get_dmeng_message($current_user->ID, 'count', "( msg_type='unread' OR msg_type='unrepm' )")); $unread_count = $unread_count ? sprintf(__('(%s)', 'dmeng'), $unread_count) : ''; $profile_tabs = array('message' => __('消息', 'dmeng') . $unread_count); $profile_tabs_output = ''; foreach ($profile_tabs as $tab_key => $tab_title) { $tab_attr_title = sprintf(__('查看我的%s', 'dmeng'), $tab_title); $profile_tabs_output .= sprintf('<a href="%1$s" title="%2$s">%3$s</a>', dmeng_get_user_url($tab_key), $tab_attr_title, $tab_title); } $profile_tabs_output .= sprintf('<a href="%1$s" title="%2$s">%3$s</a>', get_edit_profile_url($current_user->ID), '修改个人资料', '修改个人资料'); $profile_li .= '<li class="tabs">' . $profile_tabs_output . '</li>'; } else { $weekname = date('l', current_time('timestamp', 0)); $weekarray = array('Monday' => __('星期一', 'dmeng'), 'Tuesday' => __('星期二', 'dmeng'), 'Wednesday' => __('星期三', 'dmeng'), 'Thursday' => __('星期四', 'dmeng'), 'Friday' => __('星期五', 'dmeng'), 'Saturday' => __('星期六', 'dmeng'), 'Sunday' => __('星期天', 'dmeng')); $profile_li .= '<li class="date">' . sprintf(__('今天是%1$s,%2$s', 'dmeng'), date(__(' Y 年 m 月 d 日', 'dmeng'), current_time('timestamp', 0)), $weekarray[$weekname]) . '</li>'; $author_url = 'javascript:;'; $avatar_url = '';
</form> <script> (function($){ $(document).on("click","#empty_message",function(){ $('#emptyform').toggle(); }); })(jQuery); </script> <?php $all_sql = "( msg_type='read' OR msg_type='unread' OR msg_type='repm' OR msg_type='unrepm' )"; $all = get_dmeng_message($curauth->ID, 'count', $all_sql); $pages = ceil($all / $number); $unread = intval(get_dmeng_message($curauth->ID, 'count', "msg_type='unread'")); $mLog = get_dmeng_message($curauth->ID, '', $all_sql, $number, $offset); if ($mLog) { $item_html = '<li class="tip">' . sprintf(__('共有 %1$s 条消息,其中 %2$s 条是新消息(绿色标注)。', 'dmeng'), $all, $unread) . '<button type="button" id="empty_message" class="close hide" title="' . __('清空全部已读消息(不包括私信)', 'dmeng') . '" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button></li>'; foreach ($mLog as $log) { $unread_tip = $unread_class = ''; if (in_array($log->msg_type, array('unread', 'unrepm'))) { $unread_tip = '<span class="tag">' . __('新!', 'dmeng') . '</span>'; $unread_class = ' unread'; update_dmeng_message_type($log->msg_id, $curauth->ID, ltrim($log->msg_type, 'un')); } $msg_title = $log->msg_title; if (in_array($log->msg_type, array('repm', 'unrepm'))) { $msg_title_data = json_decode($log->msg_title); $msg_title = get_the_author_meta('display_name', intval($msg_title_data->from)); $msg_title = sprintf(__('%s发来的私信', 'dmeng'), $msg_title) . ' <a href="' . add_query_arg('tab', 'message', get_author_posts_url(intval($msg_title_data->from))) . '#' . $log->msg_id . '">' . __('查看对话', 'dmeng') . '</a>'; }