本文整理汇总了PHP中pager::getButList方法的典型用法代码示例。如果您正苦于以下问题:PHP pager::getButList方法的具体用法?PHP pager::getButList怎么用?PHP pager::getButList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pager
的用法示例。
在下文中一共展示了pager::getButList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_main_page_area
//.........这里部分代码省略.........
$msg .= "<p>result: " . var_export($cmt->akismet_spam, TRUE) . "</p>";
}
break;
default:
if (preg_match("~^/delete/(\\d+)\$~", $path_info, $m)) {
list(, $cid) = $m;
if (!$is_admin) {
$msg = "Sorry, only administrators can delete comments at the moment :(";
} else {
try {
$c = new Comment();
$c->load((int) $cid);
$c->delete();
$msg = "Comment deleted.";
} catch (PAException $e) {
if ($e->code == COMMENT_NOT_EXIST) {
$msg = "Comment already deleted.";
} else {
throw $e;
}
}
}
}
}
$per_page = 20;
// how many comments to show on a page
// paging
if ($limit_set !== NULL) {
$total_comments = count($limit_set);
} else {
$total_comments = Comment::count_all_comments($is_admin ? 0 : $user->user_id);
}
$pager = new pager($total_comments, $per_page, $paging_url);
$paging = $pager->getButList(8) . " (total {$total_comments} comments)";
// main comment list
if ($limit_set !== NULL) {
$show_start = max(0, min(($pager->page - 1) * $per_page, $total_comments));
$show_count = min($per_page, $total_comments - $show_start);
$limit_set_ids = array_map(create_function('$item', 'return $item["comment_id"];'), array_slice($limit_set, $show_start, $show_count));
$cmts = Comment::get_selected($limit_set_ids);
} else {
$cmts = Comment::get_all_comments($is_admin ? 0 : $user->user_id, $per_page, $pager->page);
}
$comments = "";
foreach ($cmts as $cmt) {
// $comments .= "<li>".htmlspecialchars(var_export($cmt, TRUE))."</li>";
$akismet_result = $cmt['akismet_spam'] ? "spam" : "?";
$comments .= "<tr><td>" . $cmt['comment_id'] . "</td><td>" . $cmt['content_id'] . "</td><td>" . esc_wbr($cmt['name']) . "</td><td>" . esc_wbr($cmt['email']) . "</td><td>" . esc_wbr($cmt['homepage']) . "</td><td>" . esc_wbr($cmt['subject']) . "</td><td>" . esc_wbr($cmt['comment']) . " {$akismet_result} <a href=\"{$page_url}/analyze_comment?comment=" . $cmt['comment_id'] . "\">analyze</a></td><td>" . esc_wbr($cmt['ip_addr']) . "</td><td>" . '<form method="POST" action="' . PA::$url . '/comment_management.php/delete/' . $cmt['comment_id'] . '?page=' . $pager->page . '"><input type="submit" value="X"></form> <a href="' . $page_url . '/akismet_check_spam?comment=' . $cmt['comment_id'] . '">ak</a></td></tr>';
}
if ($is_admin) {
if ($current_search_terms) {
$current_search = '<form method="POST" action="' . $page_url . '/add_spam_term"><p>Currently displaying results for: <b>' . htmlspecialchars($current_search_terms) . '</b>. <a href="' . $page_url . '">Show all comments</a>. <input type="hidden" name="term" value="' . htmlspecialchars($current_search_terms) . '"><input type="submit" value="Blacklist this term"></p></form>';
} else {
$current_search = "";
}
$your_permissions = <<<EOS
\t<form method="POST" action="{$page_url}/logout"><p>You are an administrator, so all comments in the site will be displayed. <input type="submit" value="Log out"></p></form>
\t<p><a href="{$page_url}/akismet_verify_key">Verify Akismet key</a> | <a href="{$page_url}/common_domains">Show most common domains</a> | <a href="{$page_url}/stats">Spam statistics</a></p>
\t<form method="GET" action="{$page_url}/search"><p>Search comment content: <input type="text" id="search_q" name="q" size="20"><input type="submit" value="Search"/></p></form>
\t<script language="javascript"><!--
\t document.getElementById("search_q").focus();
// --></script>
{$current_search}
EOS;