Exemplo n.º 1
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('xt_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        $logo = $instance['logo'];
        $isLogo = false;
        if (!empty($logo)) {
            $_pic = strrchr($logo, '.');
            if (in_array($_pic, array('.png', '.gif', '.jpg'))) {
                $isLogo = true;
            }
        }
        $_site = esc_html(get_bloginfo('name', 'display'));
        echo $before_widget;
        ?>
        <div id="X_Header" class="xt-headerlove-box row-fluid">
            <div class="span6">
                <h1 <?php 
        echo $isLogo ? 'class="xt-logo"' : 'class="xt-nologo"';
        ?>
>
                    <a href="<?php 
        echo home_url('/');
        ?>
" target="_top">
                        <?php 
        echo !empty($logo) ? '<img src="' . $logo . '" alt="' . $_site . '">' : $_site;
        ?>
                    </a>
                </h1>
            </div>
            <div class="span6">
                <div class="xt-headerlove-box-right">
                    <?php 
        global $wpdb;
        $user = wp_get_current_user();
        if ($user->exists()) {
            if (empty($user->display_name)) {
                $user->display_name = $user->user_login;
            }
            $user_name = $wpdb->escape($user->display_name);
            ?>
                        <div class="xt-headerlove-userbox clearfix">
                            <a href="<?php 
            xt_the_user_url($user->ID);
            ?>
">
                                <span title="<?php 
            echo $user_name;
            ?>
"><?php 
            echo wp_trim_words($user_name, 8);
            ?>
</span>
                                <span><img src="<?php 
            xt_the_user_pic('', $user->ID);
            ?>
" alt="<?php 
            echo $user_name;
            ?>
"></span>
                            </a>
                        </div>
                    <?php 
        }
        ?>
                    <ul class="xt-headerlove-ul">
                        <?php 
        $user = wp_get_current_user();
        if (!$user->exists()) {
            ?>
                            <li class="xt-headerlove-ul-li xt-headerlove-ul-login"><a href="javascript:;" class="X_User-Login" id="X_User-Login">
                                    <span></span> 登录/注册
                                </a></li>
                            <li class="xt-headerlove-ul-li xt-headerlove-ul-publish"><a href="javascript:;" class="X_User-Share-Publish" id="X_User-Share-Publish">
                                    <span></span> 我要分享
                                </a></li>
                            <?php 
            if (xt_is_fanxian()) {
                ?>
                                <li class="xt-headerlove-ul-li xt-headerlove-ul-fanxian"><a href="javascript:;" class="X_User-Need-Login"><span></span>
                                        我的返现
                                    </a></li>
                            <?php 
            }
            ?>
                            <li class="xt-headerlove-ul-li xt-headerlove-ul-msg hide"><a href="javascript:;" class="X_User-Need-Login"> <span></span>
                                    消息
                                </a></li>
                        <?php 
        } else {
            ?>
                            <li class="xt-headerlove-ul-li xt-headerlove-ul-publish"><a href="javascript:;" class="X_User-Share-Publish" id="X_User-Share-Publish">
                                    <span></span> 我要发表
                                </a></li>
                            <?php 
            if (xt_is_fanxian()) {
                ?>
                                <li class="xt-headerlove-ul-li xt-headerlove-ul-fanxian"><a href="<?php 
                echo xt_site_url('account');
                ?>
"><span></span>
                                        我的返现
                                    </a></li>
                            <?php 
            }
            ?>
                            <li class="xt-headerlove-ul-li xt-headerlove-ul-my">
                                <a href="<?php 
            xt_the_user_url($user->ID);
            ?>
">
                                    <span></span> 个人中心
                                    <i class="xt-headerlove-line-topleft"></i>
                                    <i class="xt-headerlove-line-topright"></i>
                                </a>
                                <div class="xt-headerlove-ul-my-sub">
                                    <ul>
                                        <li class="xt-first"><a href="<?php 
            xt_the_user_url($user->ID);
            ?>
#share" class="X_Menu-Share-A">我的分享</a></li>
                                        <li><a href="<?php 
            xt_the_user_url($user->ID);
            ?>
#like" class="X_Menu-Fav-A">我喜欢的</a></li>
                                        <li class="xt-last"><a href="<?php 
            xt_the_user_url($user->ID);
            ?>
#album" class="X_Menu-Album-A">我的专辑</a></li>
                                        <li class="xt-last"><a href="<?php 
            echo xt_site_url('account#profile');
            ?>
" class="X_Menu-Account-A">账号设置</a></li>
                                        <li class="xt-last hide"><a href="<?php 
            echo xt_site_url('account#tuiguang');
            ?>
"> class="X_Menu-Invite-A"邀请好友</a></li>
                                        <?php 
            if (current_user_can('edit_pages')) {
                ?>
                                            <li class="xt-last"><a href="<?php 
                echo admin_url();
                ?>
">管理中心</a></li>
                                        <?php 
            }
            ?>
                                        <li><a href="<?php 
            echo wp_logout_url() . '&redirect_to=' . $_SERVER['REQUEST_URI'];
            ?>
">退出</a></li>

                                    </ul>
                                    <i class="xt-headerlove-line-bottom"></i> <i class="xt-headerlove-line-topleft"></i>
                                    <i class="xt-headerlove-line-bottomleft"></i> <i
                                        class="xt-headerlove-line-bottomright"></i>
                                </div>
                            </li>
                            <li class="xt-headerlove-ul-li xt-headerlove-ul-msg hide"><a href="javascript:alert('即将开放');"> <span></span>
                                    消息
                                </a></li>
                        <?php 
        }
        ?>

                    </ul>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            jQuery(function($) {
                $('#X_Header .xt-headerlove-ul-li').hover(function(){$('#X_Header .xt-headerlove-ul-li').removeClass('xt-hover');$(this).addClass('xt-hover')},function(){$(this).removeClass('xt-hover')});
            });
        </script>
        <?php 
        echo $after_widget;
    }
Exemplo n.º 2
0
    if ($xt_user->exists()) {
        $xt_user_counts = xt_default_counts();
        $_xt_user_counts = get_user_meta($xt_user->ID, XT_USER_COUNT, true);
        if (!empty($_xt_user_counts)) {
            $xt_user_counts = array_merge($xt_user_counts, $_xt_user_counts);
        }
        $url = xt_get_the_user_url();
        ?>
        <div class="clearfix">
            <div class="clearfix">
                <a href="<?php 
        echo $url;
        ?>
" class="xt-avatar pull-left" target="_blank">
                    <img src="<?php 
        xt_the_user_pic();
        ?>
" alt="<?php 
        xt_the_user_title();
        ?>
">
                </a>
                <div class="pull-left">
                    <p><a href="<?php 
        echo $url;
        ?>
" class="xt-username" target="_blank"><?php 
        xt_the_user_title();
        ?>
</a></p>
                    <p class="xt-last">
Exemplo n.º 3
0
function get_the_user_template($count)
{
    global $xt_user_follow;
    $_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);
        }
    }
    ?>
    <div class="xt-share xt-share-user media<?php 
    echo $count % 3 == 2 ? ' xt-last' : '';
    ?>
">
        <a class="pull-left" target="_blank" href="<?php 
    xt_the_user_url();
    ?>
">
            <img class="media-object" src="<?php 
    xt_the_user_pic();
    ?>
">
        </a>
        <div class="media-body">
            <h4 class="media-heading"><a target="_blank" href="<?php 
    xt_the_user_url();
    ?>
"><?php 
    xt_the_user_title();
    ?>
</a></h4>
            <div class="media">
                <small>
                    <span>关注</span><span><?php 
    echo xt_the_user_followcount();
    ?>
</span>&nbsp;&nbsp;
                    <span>粉丝</span><span><?php 
    echo xt_the_user_fanscount();
    ?>
</span>&nbsp;&nbsp;
                    <span>宝贝</span><span><?php 
    echo xt_get_the_user_sharecount() + xt_get_the_user_fav_sharecount();
    ?>
</span>&nbsp;&nbsp;
                    <span>喜欢</span><span><?php 
    echo xt_get_the_user_fav_sharecount() + xt_get_the_user_fav_albumcount();
    ?>
</span>
                </small>
                <?php 
    if (!xt_is_self(xt_get_the_user_id())) {
        ?>
                    <div class="xt-user-follow clearfix">
                        <?php 
        if (!empty($xt_user_follow) && in_array((int) xt_get_the_user_id(), $xt_user_follow)) {
            ?>
                            <a class="xt-unfollow" href="javascript:;" data-userid="<?php 
            xt_the_user_id();
            ?>
">取消关注</a> <a class="xt-sendmsg" href="javascript:;" name="<?php 
            xt_the_user_title();
            ?>
">发私信</a>
                        <?php 
        } else {
            ?>
                            <a class="xt-follow" href="javascript:;" data-userid="<?php 
            xt_the_user_id();
            ?>
">+ 加关注</a> <a class="xt-sendmsg" href="javascript:;" name="<?php 
            xt_the_user_title();
            ?>
">发私信</a>
                        <?php 
        }
        ?>
                    </div>
                <?php 
    }
    ?>
            </div>
        </div>
    </div>
    <?php 
}
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        global $wp_query, $xt_album, $xt_user;
        $xt_share_param = array('album_id' => absint($wp_query->query_vars['xt_param']), 'page' => 1, 'share_per_page' => 40, 'user_id' => $xt_user->ID);
        echo "<script type='text/javascript'>var XT_SHARE_PARAMS=" . json_encode($xt_share_param) . ";</script>";
        $user = wp_get_current_user();
        $isSelf = $user->exists() && $user->ID == $xt_album->user_id;
        $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 . '/default_header.jpg');
        }
        ?>
            <?php 
        if ($isSelf) {
            ?>
                <div id="X_Album-Modal-Update-Box" class="modal hide">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h3>编辑专辑</h3>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal">
                            <div class="control-group">
                                <label class="control-label" for="X_Album-Update-Title" style="width:100px;">名称</label>
                                <div class="controls" style="margin-left:120px;">
                                    <input type="text" class="input-xlarge" id="X_Album-Update-Title" value="<?php 
            echo $xt_album->title;
            ?>
">
                                    <input type="hidden" id="X_Album-Update-Id" value="<?php 
            echo $xt_album->id;
            ?>
">
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label" for="X_Album-Update-Content" style="width:100px;">描述</label>
                                <div class="controls" style="margin-left:120px;">
                                    <textarea id="X_Album-Update-Content" class="input-xlarge" rows="3"><?php 
            echo esc_html($xt_album->content);
            ?>
</textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary">确定</button>
                    </div>
                </div>
            <?php 
        }
        ?>
            <div class="row-fluid" style="background-color:white;margin-bottom:15px;">
                <div class="span5">
                    <div class="clearfix" style="padding:0 30px;">
                        <h1 style="white-space:nowrap;overflow:hidden;font-size:20px;"><?php 
        if ($isSelf) {
            ?>
[<a href="javascript:;" data-toggle="modal" data-target="#X_Album-Modal-Update-Box" style="text-decoration: none;">编辑</a>]&nbsp;<?php 
        }
        echo $xt_album->title;
        ?>
</h1>
                        <div class="pull-left muted">宝贝数量 <b class="text-default"><?php 
        echo $xt_album->share_count;
        ?>
</b></div> <div class="pull-right muted" style="margin-right:60px;">喜欢指数 <b class="text-default"><?php 
        echo $xt_album->fav_count;
        ?>
</b></div>
                    </div>
                    <div class="clearfix muted" style="padding:5px 30px 0px;height:76px;font-size:12px;font-weight:normal;overflow:hidden;">
                        <?php 
        echo esc_html($xt_album->content);
        ?>
                    </div>
                    <div class="clearfix" style="padding:5px 30px;">
                        <div class="media">
                            <a class="pull-left" target="_blank" href="<?php 
        xt_the_user_url();
        ?>
"><img class="media-object" style="width:32px;height:32px;" src="<?php 
        xt_the_user_pic();
        ?>
"></a>
                            <div class="media-body">
                                <h4 class="media-heading" style="font-size:12px;line-height:12px;"><a target="_blank" href="<?php 
        xt_the_user_url();
        ?>
"><?php 
        xt_the_user_title();
        ?>
</a></h4>
                                <div class="media" style="margin-top:0px;">
                                    <small>
                                        <span>关注</span><span><?php 
        echo xt_the_user_followcount();
        ?>
</span>&nbsp;&nbsp;
                                        <span>粉丝</span><span><?php 
        echo xt_the_user_fanscount();
        ?>
</span>&nbsp;&nbsp;
                                        <span>宝贝</span><span><?php 
        echo xt_get_the_user_sharecount() + xt_get_the_user_fav_sharecount();
        ?>
</span>&nbsp;&nbsp;
                                        <span>喜欢</span><span><?php 
        echo xt_get_the_user_fav_sharecount() + xt_get_the_user_fav_albumcount();
        ?>
</span>
                                    </small>
                                </div>
                            </div>
                        </div>
                    </div>     
                </div>
                <div class="span7" style="height:240px;overflow:hidden;">
                    <img src="<?php 
        echo $_covers[array_rand($_covers)];
        ?>
" width="100%">
                </div>
            </div>
            <?php 
        get_the_share_container($xt_share_param, false, false, false);
        ?>
            <?php 
        echo $after_widget;
    }
Exemplo n.º 5
0
function get_the_share_template($user_id = 0, $delClass = '')
{
    global $xt_album;
    $cacheObj = get_the_share_cachedata();
    $_item = isset($cacheObj['item']) ? $cacheObj['item'] : array();
    $_comment = isset($cacheObj['comment']) ? $cacheObj['comment'] : array();
    $_title = get_the_share_title();
    $_url = get_the_share_url();
    $_nick = xt_get_the_user_title(get_the_share_username());
    ?>
    <div class="span3 xt-share">
        <div class="thumbnail">
            <a href="<?php 
    echo $_url;
    ?>
" title="<?php 
    echo $_title;
    ?>
" target="_blank" class="xt-share-link">
                <img src="<?php 
    the_share_picurl();
    ?>
" title="<?php 
    echo $_title;
    ?>
" alt="<?php 
    echo $_title;
    ?>
" />
                <div class="xt-img-price">¥<?php 
    the_share_price();
    ?>
</div>
                <?php 
    echo get_the_admin_tool_share(get_the_share_id());
    ?>
                <?php 
    if ($user_id) {
        the_delete_template(get_the_share_id(), $delClass == 'xt-delete-album-share' ? $xt_album->id : 1, $user_id, $delClass);
    }
    ?>
                <span class="label label-album-add" data-id="<?php 
    the_share_id();
    ?>
" data-pic="<?php 
    the_share_picurl(160);
    ?>
">加入专辑</span>	
            </a>
            <div class="caption">
                <h5><?php 
    the_share_content();
    ?>
</h5>
                <div class="clearfix">
                    <a class="badge badge-fav" title="喜欢" data-id="<?php 
    the_share_id();
    ?>
" data-type="1" data-uid="<?php 
    the_share_userid();
    ?>
"><?php 
    the_share_favcount();
    ?>
<i class="icon-heart icon-white"></i></a>
                    <a class="badge badge-comment" title="评论" href="javascript:;" data-id="<?php 
    the_share_id();
    ?>
"><?php 
    the_share_commentcount();
    ?>
<i class="icon-comment icon-white"></i></a>
                </div>
            </div>
            <ul class="media-list clearfix">
                <li class="media">
                    <a class="pull-left X_Nick" data-value="<?php 
    echo get_the_share_userid();
    ?>
" target="_blank" href="<?php 
    xt_the_user_url(get_the_share_userid());
    ?>
"><img src="<?php 
    xt_the_user_pic(get_the_share_useravatar());
    ?>
" alt="<?php 
    echo $_nick;
    ?>
"></a>
                    <div class="media-body"><p class="muted"><a class="X_Nick" data-value="<?php 
    echo get_the_share_userid();
    ?>
" target="_blank" href="<?php 
    xt_the_user_url(get_the_share_userid());
    ?>
" class="xt-rep-nick"><?php 
    echo $_nick;
    ?>
        </a>分享了:<?php 
    echo wp_trim_words(get_the_share_title(), 15);
    ?>
    </p></div>
                </li>
                <?php 
    if (xt_is_displaycomment() && !empty($_comment) && isset($_comment['comments']) && !empty($_comment['comments'])) {
        $_comments = $_comment['comments'];
        foreach ($_comments as $c) {
            ?>
                        <li class="media">
                            <a class="pull-left X_Nick" data-value="<?php 
            echo $c['user_id'];
            ?>
" target="_blank" href="<?php 
            xt_the_user_url($c['user_id']);
            ?>
"><img src="<?php 
            xt_the_user_pic($c['pic_url']);
            ?>
" alt="<?php 
            xt_the_user_title($c['nick']);
            ?>
"></a>
                            <div class="media-body"><p class="muted"><a class="X_Nick" data-value="<?php 
            echo $c['user_id'];
            ?>
" target="_blank" href="<?php 
            xt_the_user_url($c['user_id']);
            ?>
" class="xt-rep-nick"><?php 
            xt_the_user_title($c['nick']);
            ?>
        </a>:<?php 
            xt_comment_excerpt(0, $c['content']);
            ?>
    </p></div>
                        </li>
                        <?php 
        }
        if (isset($_comment['total']) && $_comment['total'] > 2) {
            echo '<li class="xt-rep-more"><a href="' . $_url . '" target="_blank" rel="nofollow"> 查看全部' . $_comment['total'] . '条评论...</a></li>';
        }
    }
    ?>
            </ul>
        </div>
    </div>
    <?php 
}
Exemplo n.º 6
0
function xt_comment_template()
{
    xt_the_comment();
    ?>
    <li class="media" style="border-bottom: 1px dashed #DDD;padding-bottom:5px;">
        <a class="pull-left X_Nick" data-value="<?php 
    echo xt_get_comment_userid();
    ?>
" href="<?php 
    xt_the_user_url(xt_get_comment_userid());
    ?>
" target="_blank"><img src="<?php 
    xt_the_user_pic(xt_get_comment_useravatar());
    ?>
" style="width:32px;height:32px;"></a>
        <div class="media-body">
            <h5 class="media-heading clearfix" style="margin-bottom:0px;">
                <span class="pull-right"><?php 
    xt_comment_time_human();
    ?>
</span>
                <a  class="X_Nick" data-value="<?php 
    echo xt_get_comment_userid();
    ?>
" href="<?php 
    xt_the_user_url(xt_get_comment_userid());
    ?>
" target="_blank"><?php 
    xt_comment_username();
    ?>
</a>
            </h5>
            <div class="media" style="margin-top:0px;">
    <?php 
    xt_comment_text();
    ?>
 <a href="javascript:;" class="xt-share-reply" data-nick="<?php 
    xt_comment_username();
    ?>
">回复</a>
            </div>
        </div>
    </li>
    <?php 
}