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">×</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>] <?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> <span>粉丝</span><span><?php echo xt_the_user_fanscount(); ?> </span> <span>宝贝</span><span><?php echo xt_get_the_user_sharecount() + xt_get_the_user_fav_sharecount(); ?> </span> <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; }
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> <span>粉丝</span><span><?php echo xt_the_user_fanscount(); ?> </span> <span>宝贝</span><span><?php echo xt_get_the_user_sharecount() + xt_get_the_user_fav_sharecount(); ?> </span> <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 }
?> </div> <?php } ?> </div> </div> <div class="clearfix"></div> <div class="xt-user-status"> <div> <div class="xt-user-status-li"><a rel="nofollow" href="<?php xt_the_user_url(); ?> #follow" data-hash="#follow"><span class="xt-user-status-label">关注</span><span class="xt-user-nums"><?php xt_the_user_followcount(); ?> </span></a></div> <div class="xt-user-status-li"><a rel="nofollow" href="<?php xt_the_user_url(); ?> #fans" data-hash="#fans"><span class="xt-user-status-label">粉丝</span><span class="xt-user-nums"><?php xt_the_user_fanscount(); ?> </span></a></div> <div class="xt-user-status-li"><a rel="nofollow" href="<?php xt_the_user_url(); ?> #share" data-hash="#share"><span class="xt-user-status-label">宝贝</span><span class="xt-user-nums"><?php