Example #1
0
#fans" target="_blank"><span><?php 
        xt_the_user_fanscount();
        ?>
</span></a>粉丝
                        <a style="margin-left:10px;" href="<?php 
        echo $url;
        ?>
#share" target="_blank"><span><?php 
        xt_the_user_sharecount();
        ?>
</span></a>分享
                        <a style="margin-left:10px;" href="<?php 
        echo $url;
        ?>
#like" target="_blank"><span><?php 
        xt_the_user_fav_sharecount();
        ?>
</span></a>喜欢
                    </p>
                </div>     
            </div>
            <div class="xt-userdesc clearfix"><?php 
        echo wp_trim_words(xt_get_the_user_description(), 20);
        ?>
</div>
            <?php 
        if (!xt_is_self(xt_get_the_user_id())) {
            ?>
                <div class="xt-toolbar clearfix">

                    <div class="xt-user-follow clearfix">
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $covers = isset($instance['covers']) ? $instance['covers'] : array();
        $_covers = array();
        if (!empty($covers)) {
            foreach ($covers as $cover) {
                if (!empty($cover)) {
                    $_covers[] = $cover;
                }
            }
        }
        if (empty($_covers)) {
            $_covers = array(XT_CORE_IMAGES_URL . '/475b3d56jw1dwq73nfyfrj.jpg');
        }
        echo $before_widget;
        global $xt_user, $xt_user_follow, $xt_pageuser_follows, $wp_query;
        $xt_pageuser_follows = get_user_meta(intval($xt_user->ID), XT_USER_FOLLOW, true);
        $_user = wp_get_current_user();
        if ($_user->exists()) {
            if (empty($xt_user_follow)) {
                $xt_user_follow = get_user_meta($_user->ID, XT_USER_FOLLOW, true);
            }
            if (empty($xt_user_follow)) {
                $xt_user_follow = array($_user->ID);
            }
        }
        $_user_id = $wp_query->query_vars['xt_param'];
        $xt_share_param = array('page' => 1, 'share_per_page' => 40, 'isHome' => 1, 'isFavorite' => 0, 'isShare' => 0, 'user_id' => $_user_id);
        $xt_album_param = array('page' => 1, 'album_per_page' => 40, 'isFavorite' => 1, 'isShare' => 0, 'user_id' => $_user_id);
        $xt_user_param = array('page' => 1, 'user_per_page' => 21, 's' => '', 'follow' => $_user_id, 'fans' => $_user_id);
        ?>
        <div id="X_User-Content" style="background-color:#FAFAFA;">
            <div class="clearfix">
                <div class="xt-user-profile-cover" style="background-image:url(<?php 
        echo $_covers[array_rand($_covers)];
        ?>
);"></div>
                <div class="xt-user-profile-header">
                    <div id="X_User-Profile-Header" class="" style="position:relative;">
                        <div class="xt-user-profile-info" style="padding-left:225px;">
                            <div class="xt-user-profile-name"><h2><?php 
        xt_the_user_title();
        ?>
</h2></div>
                            <div class="xt-user-profile-desc"><span>简介:<?php 
        echo wp_trim_words(xt_get_the_user_description(), 50);
        ?>
</span></div>
                            <div class="xt-user-profile-action">
                                <?php 
        if (!xt_is_self(xt_get_the_user_id())) {
            ?>
                                    <?php 
            if (!empty($xt_user_follow) && in_array((int) xt_get_the_user_id(), $xt_user_follow)) {
                ?>
                                        <div><div class="xt-user-profile-btn"><span><em class="xt-user-profile-icon xt-user-profile-icon-one"></em>已关注<em class="xt-line">|</em><a class="xt-unfollow" data-userid="<?php 
                xt_the_user_id();
                ?>
" href="javascript:void(0);">取消</a></span></div></div>
                                    <?php 
            } else {
                ?>
                                        <div><a class="xt-user-profile-btn xt-follow" data-userid="<?php 
                xt_the_user_id();
                ?>
" title="加关注" href="javascript:void(0);"><span><em class="xt-user-profile-btn-icon">+</em>关注</span></a></div>
                                    <?php 
            }
            ?>
                                <?php 
        }
        ?>
                            </div>
                        </div>
                        <div class="xt-user-profile-photo">
                            <div class="xt-user-profile-pic"><img src="<?php 
        xt_the_user_pic('', 0, 180);
        ?>
" alt="<?php 
        xt_the_user_title();
        ?>
"></div>
                            <ul class="clearfix">
                                <li><a id="X_User-Follow-A" href="#follow" class="xt-nav"><strong><?php 
        echo xt_the_user_followcount();
        ?>
</strong><span>关注</span></a></li>
                                <li><a id="X_User-Fans-A" href="#fans" class="xt-nav"><strong><?php 
        echo xt_the_user_fanscount();
        ?>
</strong><span>粉丝</span></a></li>
                                <li class="xt-last"><a id="X_User-Favorite-A" href="#like" class="xt-nav"><strong><?php 
        echo xt_the_user_fav_sharecount();
        ?>
</strong><span>喜欢</span></a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div id="X_Share-UserNav" class="">
                    <ul class="nav nav-tabs" style="padding:0 15px;">
                        <li class="xt-user-center xt-first  active"><a id="X_User-Home-A" href="#home" class="xt-nav"> <i></i> <span>个人首页</span></a></li>
                        <li class="xt-user-share"><a id="X_User-Share-A" href="#share" class="xt-nav"> <i></i> <span>分享</span></a></li>
                        <li class="xt-user-album"><a id="X_User-Share-Album-A" href="#album" class="xt-nav"> <i></i> <span>专辑</span></a></li>
                        <li class="xt-user-like xt-last"><a id="X_User-Favorite-A" href="#like" class="xt-nav"> <i></i> <span>喜欢</span></a></li>
                    </ul>
                </div>
            </div>
            <?php 
        if (empty($xt_pageuser_follows)) {
            query_shares(array_merge(array('no_found_rows' => 1), $xt_share_param));
        } else {
            query_shares($xt_share_param);
        }
        echo "<script type='text/javascript'>var XT_SHARE_PARAMS=" . json_encode($xt_share_param) . ";</script>";
        echo "<script type='text/javascript'>var XT_ALBUM_PARAMS=" . json_encode($xt_album_param) . ";</script>";
        echo "<script type='text/javascript'>var XT_USER_PARAMS=" . json_encode($xt_user_param) . ";</script>";
        get_the_share_container($xt_share_param, false, false, false);
        echo '</div>';
        echo $after_widget;
    }