コード例 #1
0
    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;
    }
コード例 #2
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 
}