當前位置: 首頁>>代碼示例>>PHP>>正文


PHP pager::getButList方法代碼示例

本文整理匯總了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;
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:67,代碼來源:comment_management.php


注:本文中的pager::getButList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。