示例#1
0
function make_comments_table($episode_id, $offset, $sort = "")
{
    global $connection;
    if ($sort == "newest") {
        $comment_set = get_comments_sorted_by_newest($episode_id, $offset);
    } else {
        if ($sort == "top") {
            $comment_set = get_comments_sorted_by_top($episode_id, $offset);
        } else {
            $comment_set = get_comments_by_episode_id($episode_id, $offset);
        }
    }
    $has_comments = mysqli_affected_rows($connection);
    $total = get_total_comments($episode_id);
    $output = "";
    if ($has_comments > 0) {
        $output .= "<select id=\"comment_sort\"> ";
        $output .= "<option value=\"top\" ";
        if ($sort == "top") {
            $output .= "selected=\"selected\"";
        }
        $output .= ">Top comments</option>";
        $output .= "<option value=\"newest\" ";
        if ($sort == "newest") {
            $output .= "selected=\"selected\"";
        }
        $output .= ">Newest first</option>";
        $output .= "</select>";
        while ($next_comment = mysqli_fetch_assoc($comment_set)) {
            $output .= make_comment_from_id($next_comment["id"]);
        }
        if ($total - $offset > 10) {
            $output .= "<div id=\"load_comments_button\">Load More Comments </div>";
        }
    } else {
        $output .= "No comments posted. ";
    }
    return $output;
}
示例#2
0
    total_users();
    ?>
</strong></div>
								</div>
								<div class="col-lg-2 col-md-4 col-sm-6 col-xs-12">
									<div class="statistic-item text-center"><?php 
    echo _n('Thread', 'Threads', get_total_threads(), 'luna');
    ?>
: <strong><?php 
    total_threads();
    ?>
</strong></div>
								</div>
								<div class="col-lg-2 col-md-4 col-sm-6 col-xs-12">
									<div class="statistic-item text-center"><?php 
    echo _n('Comment', 'Comments', get_total_comments(), 'luna');
    ?>
: <strong><?php 
    total_comments();
    ?>
</strong></div>
								</div>
								<div class="col-lg-2 col-md-4 col-sm-6 col-xs-12">
									<div class="statistic-item text-center"><?php 
    _e('Newest user', 'luna');
    ?>
: <strong><?php 
    newest_user();
    ?>
</strong></div>
								</div>
function total_comments()
{
    echo get_total_comments();
}