function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        ?>
            <div id="X_Share-Detail" class="xt-share-detail">
                <?php 
        get_the_share_detail_template();
        ?>
                <div class="well well-small">
                    <?php 
        xt_load_template('xt-share_comments');
        ?>
                    <textarea id="comment" class="input-xxlarge" style="width:705px;"></textarea>
                    <div class="clearfix">
                        <?php 
        if (function_exists('cs_print_smilies')) {
            cs_print_smilies();
        }
        ?>
                        <a href="javascript:;" class="btn btn-small btn-primary" id="X_Share-comment-submit" data-id="<?php 
        the_share_id();
        ?>
" data-url="<?php 
        echo esc_url(get_the_share_url());
        ?>
">评 论</a>
                    </div>
                </div>
            </div>
            <?php 
        echo $after_widget;
    }
function _xt_sitemap_build_share($type = '')
{
    global $wpdb;
    $shares = $wpdb->get_results('SELECT id,create_date FROM ' . XT_TABLE_SHARE . ' ORDER BY id DESC LIMIT ' . XT_SITEMAP_SHARE_LIMIT);
    if ($type == 'baidu') {
    } else {
        $xml_begin = '<?xml version="1.0" encoding="utf-8"?><urlset>';
        $xml_indexs = '';
        if (!empty($shares)) {
            foreach ($shares as $share) {
                $xml_indexs .= '<url>';
                $xml_indexs .= '<loc>' . get_the_share_url($share->id) . '</loc>';
                $xml_indexs .= '<lastmod>' . date('Y-m-d', strtotime($share->create_date)) . '</lastmod>';
                $xml_indexs .= '<changefreq>' . XT_SITEMAP_SHARE_CHANGEFREQ . '</changefreq>';
                $xml_indexs .= '<priority>' . XT_SITEMAP_SHARE_PRIORITY . '</priority>';
                $xml_indexs .= '</url>';
            }
        }
        $xml_end = '</urlset>';
        return $xml_begin . $xml_indexs . $xml_end;
    }
}
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 
}
function xt_widget_template_grid_sidesmall_item_share($_count, $rate, $item)
{
    $_url = get_the_share_url($item->id);
    $_title = esc_html($item->title);
    $_pic = get_the_share_picurl(80, $item);
    ?>
    <li class="media"<?php 
    echo $_count == 0 ? ' style="padding-top:0px;"' : '';
    ?>
>
        <a rel="nofollow" class="pull-left" href="<?php 
    echo $_url;
    ?>
" target="_blank">
            <?php 
    xt_write_pic(base64_encode($_pic), $_title, 0, 0, 'media-object');
    ?>
<span><i>喜欢:<?php 
    echo $item->fav_count;
    ?>
</i></span>
        </a>
        <div class="media-body">
            <h4 class="media-heading"><a rel="nofollow" class="text-gray" href="<?php 
    echo $_url;
    ?>
" target="_blank"><?php 
    echo $_title;
    ?>
</a></h4>
            <div class="media">
                <p><span>¥</span><strong><?php 
    echo $item->price;
    ?>
</strong></p>
                <p><span>来自:</span><a class="X_Nick" data-value="<?php 
    echo $item->user_id;
    ?>
" href="<?php 
    xt_the_user_url($item->user_id);
    ?>
" target="_blank"><?php 
    echo $item->user_name;
    ?>
</a></p>
            </div>
        </div>
    </li>
    <?php 
}