예제 #1
0
/**
 * 9IPHP <Comments List> in the theme.
 * 评论列表
 *
 * @version 1.0
 * @package Specs
 * @copyright 2014 all rights reserved
 *
 *
 */
function specs_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);
    ?>
	<li <?php 
    comment_class(empty($args['has_children']) ? '' : 'parent');
    ?>
 id="comment-<?php 
    comment_ID();
    ?>
">
    <div class="comment-wrap" id="comment-<?php 
    comment_ID();
    ?>
">
        <div class="comment-author pull-left">
        <?php 
    if ($args['avatar_size'] != 0) {
        echo get_avatar($comment, $args['avatar_size']);
    }
    ?>
        </div>
        <div class="comment-body">
            <h4>
                <?php 
    printf('<cite class="fn">%1$s %2$s</cite>', get_comment_author_link(), $comment->user_id === get_queried_object()->post_author ? '<small class="label label-primary">博主</small>' : '');
    ?>
                <span class="comment-date">
                    <?php 
    printf(__('%1$s'), get_comment_date("Y/m/d H:i"));
    ?>
                </span>
            </h4>
            <?php 
    if ($comment->comment_approved == '0') {
        ?>
                <p class="comment-awaiting-moderation text-danger"><?php 
        echo "您的评论正在等待审核";
        ?>
</p>
            <?php 
    }
    ?>
            <p>
                <?php 
    if ($comment->comment_parent) {
        // 如果存在父级评论
        $comment_parent_href = get_comment_ID($comment->comment_parent);
        $comment_parent = get_comment($comment->comment_parent);
        ?>
                <span class="comment-to plr">@</span>
                <span class="reply-comment-author">
                    <a href="#comment-<?php 
        echo $comment_parent_href;
        ?>
" title="<?php 
        echo specs_string_cut(strip_tags(apply_filters('the_content', $comment_parent->comment_content)), 100);
        ?>
">
                        <?php 
        echo $comment_parent->comment_author;
        ?>
                    </a>
                </span>
                <?php 
    }
    ?>
                <?php 
    echo convert_smilies(get_comment_text());
    ?>
            </p>

            <div class="reply clearfix">
                <?php 
    comment_reply_link(array_merge($args, array('reply_text' => '<div class="label label-danger pull-right">回复</div>', 'depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
            </div>

        </div>
    </div>
<?php 
}
예제 #2
0
파일: widgets.php 프로젝트: carpliyz/9IPHP
    function widget($args, $instance)
    {
        extract($args);
        $result = '';
        //echo $title;
        $number = !empty($instance['number']) ? intval($instance['number']) : 5;
        ?>
        <div class="widget widget-posts">
            <ul id="myTab" class="nav nav-tabs nav-justified visible-lg">
                <li class="active"><a href="#hot" data-toggle="tab"><h2><i class="fa fa-fire"></i> 热点文章</h2></a></li>
                <li><a href="#newest" data-toggle="tab"><h2><i class="fa fa-refresh fa-spin"></i> 最新文章</h2></a></li>
                <li><a href="#rand" data-toggle="tab"><h2><i class="fa fa-random"></i> 随机文章</h2></a></li>
            </ul>
            <ul id="myTab" class="nav nav-tabs nav-justified visible-md">
                <li class="active"><a href="#hot" data-toggle="tab"><h2><i class="fa fa-fire"></i> 热点</h2></a></li>
                <li><a href="#newest" data-toggle="tab"><h2><i class="fa fa-refresh fa-spin"></i> 最新</h2></a></li>
                <li><a href="#rand" data-toggle="tab"><h2><i class="fa fa-random"></i> 随机</h2></a></li>
            </ul>
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane fade in active" id="hot">
                    <ul class="list-group">
                        <?php 
        if (function_exists('most_comm_posts')) {
            most_comm_posts(60, $number);
        }
        ?>
                    </ul>
                </div>
                <div class="tab-pane fade" id="newest">
                    <ul class="list-group">
                        <?php 
        $myposts = get_posts('numberposts=' . $number . ' & offset=0');
        foreach ($myposts as $post) {
            ?>
                            <a class="list-group-item visible-lg" title="<?php 
            echo $post->post_title;
            ?>
" href="<?php 
            echo get_permalink($post->ID);
            ?>
" rel="bookmark">
                                <?php 
            echo specs_string_cut(strip_tags($post->post_title), 18);
            ?>
                                <i class="fa fa-comment badge"> <?php 
            echo $post->comment_count;
            ?>
</i>
                            </a>
                            <a class="list-group-item visible-md" title="<?php 
            echo $post->post_title;
            ?>
" href="<?php 
            echo get_permalink($post->ID);
            ?>
" rel="bookmark">
                                <?php 
            echo specs_string_cut(strip_tags($post->post_title), 12);
            ?>
                                <i class="fa fa-comment badge"> <?php 
            echo $post->comment_count;
            ?>
</i>
                            </a>
                        <?php 
        }
        ?>
                    </ul>
                </div>
                <div class="tab-pane fade" id="rand">
                    <ul class="list-group">
                        <?php 
        $myposts = get_posts('numberposts=' . $number . ' & offset=0 & orderby=rand');
        foreach ($myposts as $post) {
            ?>
                            <a class="list-group-item visible-lg" title="<?php 
            echo $post->post_title;
            ?>
" href="<?php 
            echo get_permalink($post->ID);
            ?>
" rel="bookmark">
                                <?php 
            echo specs_string_cut(strip_tags($post->post_title), 18);
            ?>
                                <i class="fa fa-comment badge"> <?php 
            echo $post->comment_count;
            ?>
</i>
                            </a>
                            <a class="list-group-item visible-md" title="<?php 
            echo $post->post_title;
            ?>
" href="<?php 
            echo get_permalink($post->ID);
            ?>
" rel="bookmark">
                                <?php 
            echo specs_string_cut(strip_tags($post->post_title), 12);
            ?>
                                <i class="fa fa-comment badge"> <?php 
            echo $post->comment_count;
            ?>
</i>
                            </a>
                        <?php 
        }
        ?>
                    </ul>
                </div>
            </div>
        </div>
        <?php 
    }