* 注释和代码同样重要~ * @author 多梦 @email chihyu@aliyun.com */ $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>';
<div class="col-sm-9"> <?php if (dmeng_is_open_weibo($user_info->ID)) { ?> <span class="help-block"><?php _e('已绑定', 'dmeng'); ?> <a href="<?php echo dmeng_get_open_login_url('weibo', 'logout', get_edit_profile_url()); ?> " data-no-instant><?php _e('点击解绑', 'dmeng'); ?> </a></span> <?php echo dmeng_get_avatar($user_info->ID, '100', 'weibo'); ?> <?php } else { ?> <a class="btn btn-danger" href="<?php echo dmeng_get_open_login_url('weibo', 'login', get_edit_profile_url()); ?> " data-no-instant><?php _e('绑定微博账号', 'dmeng'); ?> </a> <?php } ?> </div>