function widget($args, $instance) { extract($args); ?> <?php echo $before_widget; ?> <?php if ($instance['title']) { echo $before_title . $instance['title'] . $after_title; } ?> <?php $limit = $instance['ranks_num']; $creditsranks = tin_credits_rank($limit); echo '<div class="tincreditsrank"><ul>'; foreach ($creditsranks as $creditsrank) { $user_name = get_user_meta($creditsrank->user_id, 'nickname', true); $avatar = tin_get_avatar($creditsrank->user_id, '40', tin_get_avatar_type($creditsrank->user_id)); echo '<li class="tincreditsrank-list"><span class="rank-avatar">' . $avatar . '</span><span class="creditsrank-name"><a href="' . get_author_posts_url($creditsrank->user_id) . '" target="_blank" title="' . $user_name . '">' . $user_name . '</a></span><span class="creditsrank-ranking">' . $creditsrank->meta_value . '' . __(' 积分', 'tinection') . '</span></li>'; } echo '</ul></div>'; ?> <?php echo $after_widget; ?> <?php }
function tin_user_profile_widget() { if (is_user_logged_in()) { $current_user = wp_get_current_user(); $li_output = ''; $li_output .= '<li style="line-height:36px;clear: both;">' . tin_get_avatar($current_user->ID, '36', tin_get_avatar_type($current_user->ID), false) . sprintf(__('登录者 <a href="%1$s">%2$s</a>', 'tinection'), get_edit_profile_url($current_user->ID), $current_user->display_name) . '<a href="' . wp_logout_url(tin_get_current_page_url()) . '" title="' . esc_attr__('登出本帐号') . '">' . __('登出 »') . '</a></li>'; if (!filter_var($current_user->user_email, FILTER_VALIDATE_EMAIL)) { $li_output .= '<li><a href="' . tin_get_user_url('profile') . '#pass">' . __('【重要】请添加正确的邮箱以保证账户安全', 'tinection') . '</a></li>'; } $shorcut_links[] = array('title' => __('个人主页', 'tinection'), 'url' => get_author_posts_url($current_user->ID)); if (current_user_can('manage_options')) { $shorcut_links[] = array('title' => __('管理后台', 'tinection'), 'url' => admin_url()); } $can_post_cat = ot_get_option('tin_can_post_cat'); if (count($can_post_cat)) { $shorcut_links[] = array('title' => __('文章投稿', 'tinection'), 'url' => add_query_arg('action', 'new', tin_get_user_url('post'))); } $shorcut_html = '<li class="active">'; foreach ($shorcut_links as $shorcut) { $shorcut_html .= '<a href="' . $shorcut['url'] . '">' . $shorcut['title'] . ' »</a>'; } $shorcut_html .= '</li>'; $credit = intval(get_user_meta($current_user->ID, 'tin_credit', true)); $credit_void = intval(get_user_meta($current_user->ID, 'tin_credit_void', true)); $unread_count = intval(get_tin_message($current_user->ID, 'count', "( msg_type='unread' OR msg_type='unrepm' )")); $collects = get_user_meta($current_user->ID, 'tin_collect', true) ? get_user_meta($current_user->ID, 'tin_collect', true) : 0; $collects_array = explode(',', $collects); $collects_count = $collects != 0 ? count($collects_array) : 0; $info_array = array(array('title' => __('文章', 'tinection'), 'url' => tin_get_user_url('post'), 'count' => count_user_posts($current_user->ID)), array('title' => __('评论', 'tinection'), 'url' => tin_get_user_url('comment'), 'count' => get_comments(array('status' => '1', 'user_id' => $current_user->ID, 'count' => true))), array('title' => __('收藏', 'tinection'), 'url' => tin_get_user_url('collect'), 'count' => intval($collects_count))); if ($unread_count) { $info_array[] = array('title' => __('未读', 'tinection'), 'url' => tin_get_user_url('message'), 'count' => $unread_count); } $info_array[] = array('title' => __('积分', 'tinection'), 'url' => tin_get_user_url('credit'), 'count' => $credit); $info_html = '<li>'; foreach ($info_array as $info) { $info_html .= $info['title'] . '<a href="' . $info['url'] . '"> ' . $info['count'] . '</a>'; } $info_html .= tin_whether_signed($current_user->ID); $info_html .= '</li>'; $friend_html = ' <li> <div class="input-group"> <span class="input-group-addon">' . __('本页推广链接', 'tinection') . '</span> <input class="tin_aff_url form-control" type="text" class="form-control" value="' . add_query_arg('aff', $current_user->ID, tin_canonical_url()) . '"> </div> </li> '; return $li_output . $shorcut_html . $info_html . $friend_html; } else { $html = '<li><span class="local-account"><a data-sign="0" class="btn btn-primary user-login"><i class="fa fa-wordpress"></i>' . __('本地帐号', 'tinection') . '</a></span>'; if (ot_get_option('tin_open_qq') == 'on') { $html .= '<span class="other-sign"><a class="qqlogin btn" href="' . home_url('/?connect=qq&action=login&redirect=' . urlencode(tin_get_redirect_uri())) . '"><i class="fa fa-qq"></i><span>' . __('QQ 登 录', 'tinection') . '</span></a></span>'; } if (ot_get_option('tin_open_weibo') == 'on') { $html .= '<span class="other-sign"><a class="weibologin btn" href="' . home_url('/?connect=weibo&action=login&redirect=' . urlencode(tin_get_redirect_uri())) . '"><i class="fa fa-weibo"></i><span>' . __('微博登录', 'tinection') . '</span></a></span>'; } $html .= '</li>'; return $html; } }
<div class="author"> <div id="real-avatar"> <?php if (isset($_COOKIE['comment_author_email_' . COOKIEHASH])) { ?> <?php $uid = get_user_by_email($comment_author_email)->ID; echo tin_get_avatar($uid, 40, tin_get_avatar_type($uid)); ?> <?php } else { ?> <?php global $user_email; $uid = get_user_by_email($comment_author_email)->ID; echo tin_get_avatar($uid, 40, tin_get_avatar_type($uid)); ?> <?php } ?> </div> <div id="welcome"><?php printf(__('欢迎回来 <strong style="color: #f00;">%s</strong>', 'tinection'), $comment_author); ?> <a href="javascript:toggleCommentAuthorInfo();" id="toggle-comment-author-info"><?php _e('更改', 'tinection'); ?> </a></div> </div> <script type="text/javascript" charset="utf-8"> var changeMsg = "<?php
public function widget($args, $instance) { extract($args); $instance['title'] ? NULL : ($instance['title'] = ''); $title = apply_filters('widget_title', $instance['title']); $output = $before_widget . "\n"; if ($title) { $output .= $before_title . $title . $after_title; } ob_start(); /* Set tabs-nav order & output it /* ------------------------------------ */ $titles = array('recent' => $instance['title_latestpost'], 'popular' => $instance['title_hotpost'], 'comments' => $instance['title_comment']); $tabs = array(); $count = 0; $order = array('recent' => $instance['order_recent'], 'popular' => $instance['order_popular'], 'comments' => $instance['order_comments']); asort($order); foreach ($order as $key => $value) { if ($instance[$key . '_enable']) { $tabs[] = $key; $count++; } } if ($tabs && $count > 1) { $output .= $this->_create_tabs($titles, $tabs, $count); } ?> <?php if (ot_get_option('lazy_load_img') == 'on') { $lazy = 'class="box-hide" src="' . THEME_URI . '/images/image-pending.gif" data-original'; } else { $lazy = 'src'; } ?> <div class="tin-tabs-container"> <?php if ($instance['recent_enable']) { // Recent posts enabled? ?> <?php $recent = new WP_Query(); ?> <?php $recent->query('showposts=' . $instance["recent_num"] . '&cat=' . $instance["recent_cat_id"] . '&ignore_sticky_posts=1'); ?> <ul id="tab-recent" class="tin-tab group <?php if ($instance['recent_thumbs']) { echo 'thumbs-enabled'; } else { echo 'no-pic'; } ?> "> <?php while ($recent->have_posts()) { $recent->the_post(); ?> <?php $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); ?> <li> <?php if ($instance['recent_thumbs']) { // Thumbnails enabled? ?> <div class="tab-item-thumbnail"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php if (has_post_thumbnail()) { ?> <div class="thumb-img"> <img <?php echo $lazy; ?> ="<?php echo tin_thumb_source($large_image_url[0], 125, 78, false); ?> " alt="<?php the_title(); ?> " /> <span><?php the_article_icon(); ?> </span> </div> <?php } else { ?> <div class="thumb-img"> <img <?php echo $lazy; ?> ="<?php $img = catch_first_image(); echo tin_thumb_source($img, 125, 78, false); ?> " alt="<?php the_title(); ?> " /> <span><?php the_article_icon(); ?> </span> </div> <?php } ?> </a> </div> <?php } ?> <div class="tab-item-inner group"> <p class="tab-item-title"><a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><?php the_title(); ?> </a></p> <?php if ($instance['tabs_date']) { ?> <span class="tab-item-date"><?php the_time('Y-m-j'); ?> </span><?php } ?> <?php if ($instance['tabs_category']) { ?> <span class="tab-item-category"><?php the_category(' / '); ?> </span><?php } ?> </div> </li> <?php } ?> </ul><!--/.tin-tab--> <?php } ?> <?php if ($instance['popular_enable']) { // Popular posts enabled? ?> <?php $popular = new WP_Query(array('post_type' => array('post'), 'showposts' => $instance['popular_num'], 'cat' => $instance['popular_cat_id'], 'ignore_sticky_posts' => true, 'orderby' => 'comment_count', 'order' => 'dsc', 'date_query' => array(array('after' => $instance['popular_time'])))); ?> <ul id="tab-popular" class="tin-tab group <?php if ($instance['popular_thumbs']) { echo 'thumbs-enabled'; } else { echo 'no-pic'; } ?> "> <?php while ($popular->have_posts()) { $popular->the_post(); ?> <?php $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); ?> <li> <?php if ($instance['popular_thumbs']) { // Thumbnails enabled? ?> <div class="tab-item-thumbnail"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php if (has_post_thumbnail()) { ?> <div class="thumb-img"> <img <?php echo $lazy; ?> ="<?php echo tin_thumb_source($large_image_url[0], 125, 78, false); ?> " alt="<?php the_title(); ?> " /> <span><?php the_article_icon(); ?> </span> </div> <?php } else { ?> <div class="thumb-img"> <img <?php echo $lazy; ?> ="<?php $img = catch_first_image(); echo tin_thumb_source($img, 125, 78, false); ?> " alt="<?php the_title(); ?> " /> <span><?php the_article_icon(); ?> </span> </div> <?php } ?> </a> </div> <?php } ?> <div class="tab-item-inner group"> <p class="tab-item-title"><a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><?php the_title(); ?> </a></p> <?php if ($instance['tabs_date']) { ?> <span class="tab-item-date"><?php the_time('Y-m-j'); ?> </span><?php } ?> <?php if ($instance['tabs_category']) { ?> <span class="tab-item-category"><?php the_category(' / '); ?> </span><?php } ?> </div> </li> <?php } ?> </ul><!--/.tin-tab--> <?php } ?> <?php if ($instance['comments_enable']) { // Recent comments enabled? ?> <?php $args = array('number' => $instance["comments_num"], 'status' => 'approve', 'post_status' => 'publish'); if (isset($instance['comment_order']) && $instance['comment_order'] == 'vote') { $args['orderby'] = 'meta_value_num'; $args['meta_key'] = 'tin_comment_voteyes'; } $comments = get_comments($args); ?> <ul id="tab-comments" class="tin-tab group <?php if ($instance['comments_avatars']) { echo 'avatars-enabled'; } else { echo 'no-avatar'; } ?> "> <?php foreach ($comments as $comment) { ?> <li> <?php if ($instance['comments_avatars']) { // Avatars enabled? ?> <div class="tab-item-avatar"> <?php echo tin_get_avatar($comment->user_id, '96', tin_get_avatar_type($comment->user_id)); ?> </div> <?php } ?> <div class="tab-item-inner group"> <?php $comment_excerpt = preg_replace("'\\[private](.*?)\\[\\/private]'", '***该评论仅父级评论者及管理员可见***', get_comment_excerpt($comment->comment_ID)); $str = explode(' ', $comment_excerpt); $comment_excerpt = implode(' ', array_slice($str, 0, 11)); if (count($str) > 11 && substr($comment_excerpt, -1) != '.') { $comment_excerpt .= '...'; } ?> <div class="tab-item-comment"><span class="arrow-poptop"></span><a href="<?php echo esc_url(get_permalink($comment->comment_post_ID)); ?> "><i><?php echo $comment->comment_author; ?> </i><?php _e('说: ', 'xiapistudio'); echo $comment_excerpt; ?> </a><div class="tab-cmt-votes"><span class="cmt-vote"> <?php $c_name = 'tin_comment_vote_' . $comment->comment_ID; $cookie = isset($_COOKIE[$c_name]) ? $_COOKIE[$c_name] : ''; ?> <i class="fa fa-thumbs-o-up <?php if ($cookie == 1) { echo 'voted'; } ?> " title="<?php _e('顶', 'xiapistudio'); ?> " data="<?php echo $comment->comment_ID; ?> " data-type="1" data-num="<?php echo (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteyes', true); ?> "><?php echo ' [' . (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteyes', true) . ']'; ?> </i> <i class="fa fa-thumbs-o-down <?php if ($cookie == 2) { echo 'voted'; } ?> " title="<?php _e('踩', 'xiapistudio'); ?> " data="<?php echo $comment->comment_ID; ?> " data-type="2" data-num="<?php echo (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteno', true); ?> "><?php echo ' [' . (int) get_comment_meta($comment->comment_ID, 'tin_comment_voteno', true) . ']'; ?> </i> </span></div></div> </div> </li> <?php } ?> </ul><!--/.tin-tab--> <?php } ?> </div> <?php $output .= ob_get_clean(); $output .= $after_widget . "\n"; echo $output; }
<span data-sign="1" id="user-reg" class="user-reg ie_pie"><?php _e('注册', 'tinection'); ?> </span><?php } ?> </div> <?php } else { global $current_user; get_currentuserinfo(); ?> <div class="login-yet-click"> <div class="login-yet-click-inner"> <?php echo tin_get_avatar($current_user->ID, '35', tin_get_avatar_type($current_user->ID)); ?> <a href="<?php bloginfo('url'); ?> /wp-admin/profile.php" title="<?php _e('用户管理', 'tinection'); ?> "><?php echo $current_user->display_name; ?> </a> <?php $unread = intval(get_tin_message($current_user->ID, 'count', "msg_type='unread' OR msg_type='unrepm'")); if ($unread > 0) { ?>
/** * Includes of Tinection WordPress Theme * * @package Tinection * @version 1.1.8 * @date 2015.6.1 * @author Zhiyan <*****@*****.**> * @site Zhiyanblog <www.zhiyanblog.com> * @copyright Copyright (c) 2014-2015, Zhiyan * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later * @link http://www.zhiyanblog.com/tinection.html **/ ?> <div class="sg-author clr"> <div class="img"><?php echo tin_get_avatar(get_the_author_meta('ID'), '100', tin_get_avatar_type(get_the_author_meta('ID'))); ?> </div> <div class="sg-author-info"> <div class="word"> <div class="wordname"><?php _e('关于', 'tinection'); the_author_posts_link(); ?> </div> <div class="authordes"><?php the_author_meta('description'); ?> </div> <div class="authorsocial"> <?php
function tin_open_profile_fields($user) { $qq = tin_is_open_qq(); $weibo = tin_is_open_weibo(); $weixin = tin_is_open_weixin(); if ($qq || $weibo || $weixin) { ?> <table class="form-table"> <?php if ($qq) { ?> <tr> <th scope="row">QQ登录</th> <td> <?php if (tin_is_open_qq($user->ID)) { ?> <p><?php _e('已绑定', 'tinection'); ?> <a href="<?php echo home_url('/?connect=qq&action=logout'); ?> "><?php _e('点击解绑', 'tinection'); ?> </a></p> <?php echo tin_get_avatar($user->ID, '100', 'qq'); ?> <?php } else { ?> <a class="button button-primary" href="<?php echo home_url('/?connect=qq&action=login'); ?> ">绑定QQ账号</a> <?php } ?> </td> </tr> <?php } ?> <?php if ($weibo) { ?> <tr> <th scope="row">微博登录</th> <td> <?php if (tin_is_open_weibo($user->ID)) { ?> <p><?php _e('已绑定', 'tinection'); ?> <a href="<?php echo home_url('/?connect=weibo&action=logout'); ?> "><?php _e('点击解绑', 'tinection'); ?> </a></p> <?php echo tin_get_avatar($user->ID, '100', 'weibo'); ?> <?php } else { ?> <a class="button button-primary" href="<?php echo home_url('/?connect=weibo&action=login'); ?> ">绑定微博账号</a> <?php } ?> </td> </tr> <?php } ?> <?php if ($weixin) { ?> <tr> <th scope="row">微信登录</th> <td> <?php if (tin_is_open_weixin($user->ID)) { ?> <p><?php _e('已绑定', 'tinection'); ?> <a href="<?php echo home_url('/?connect=weixin&action=logout'); ?> "><?php _e('点击解绑', 'tinection'); ?> </a></p> <?php echo tin_get_avatar($user->ID, '100', 'weixin'); ?> <?php } else { ?> <a class="button button-primary" href="<?php echo home_url('/?connect=weixino&action=login'); ?> ">绑定微信账号</a> <?php } ?> </td> </tr> <?php } ?> </table> <?php } }
function tin_comment_quote($comment, $args, $depth) { $GLOBALS['comment'] = $comment; global $commentcount_quote, $wpdb, $post; if (!$commentcount_quote) { $cnt = $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments} WHERE comment_post_ID = {$post->ID} AND (comment_type = 'trackback' OR comment_type = 'pingback') AND comment_approved = '1' AND !comment_parent"); $page = get_query_var('cpage'); $cpp = get_option('comments_per_page'); if (ceil($cnt / $cpp) == 1 || $page > 1 && $page == ceil($cnt / $cpp)) { $commentcount_quote = $cnt + 1; } else { $commentcount_quote = $cpp * $page + 1; } } ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?> "> <div id="div-comment-<?php comment_ID(); ?> " class="comment-body"> <?php $add_below = 'div-comment'; ?> <div class="comment-author"><?php $uid = get_user_by_email($comment->comment_author_email)->ID; echo tin_get_avatar($uid, 40, tin_get_avatar_type($uid)); ?> <div style="float:right"> <span class="datetime"> <?php comment_date('Y-m-d'); comment_time(); ?> </span> </div> <span class="comment_author_link"><?php if ($comment->user_id != 0) { echo '<a href="' . get_author_posts_url($comment->user_id) . '" class="name">' . $comment->comment_author . '</a>'; } else { comment_author_link(); } ?> </span><span class="comment_author_ip"><?php _e('[ 来自 ', 'tinection'); ?> <span><?php echo convertip(get_comment_author_ip()); ?> </span> ] </span> </div> <?php if ($comment->comment_approved == '0') { ?> <span style="color:#C00; font-style:inherit; margin-top:5px; line-height:25px;"><?php $cpid = $comment->comment_parent; if ($cpid != 0) { echo '@'; } comment_author_link($cpid); _e('您的评论正在等待审核中...', 'tinection'); ?> </span> <br /> <?php } ?> <?php if ($comment->comment_approved == '1') { ?> <?php comment_text(); ?> <?php } ?> </div> <div class="clear"></div> <?php }
<div class="col-sm-9"> <?php if (tin_is_open_weibo($user_info->ID)) { ?> <span class="help-block"><?php _e('已绑定', 'tin'); ?> <a href="<?php echo home_url('/?connect=weibo&action=logout'); ?> "><?php _e('点击解绑', 'tin'); ?> </a></span> <?php echo tin_get_avatar($user_info->ID, '100', 'weibo'); ?> <?php } else { ?> <a class="btn btn-danger" href="<?php echo home_url('/?connect=weibo&action=login&redirect=' . urlencode(get_edit_profile_url())); ?> "><?php _e('绑定微博账号', 'tin'); ?> </a> <?php } ?> </div>