当前位置: 首页>>代码示例>>PHP>>正文


PHP Pager::getPageNumbers方法代码示例

本文整理汇总了PHP中Pager::getPageNumbers方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::getPageNumbers方法的具体用法?PHP Pager::getPageNumbers怎么用?PHP Pager::getPageNumbers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pager的用法示例。


在下文中一共展示了Pager::getPageNumbers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testEnsureOnlyOnePageAppearsByDefault

 public function testEnsureOnlyOnePageAppearsByDefault()
 {
     $pages = array();
     Pager::getPageNumbers(0, $pages, $number_of_pages);
     $this->assertEquals($pages['start'], 0);
     $this->assertEquals($pages['end'], 0);
     $this->assertEquals(1, $number_of_pages);
 }
开发者ID:anirut,项目名称:wp-autoresponder,代码行数:8,代码来源:PagerTest.php

示例2: testWhetherPagesRunMultiplesOfTen

 public function testWhetherPagesRunMultiplesOfTen()
 {
     $pages = array();
     $number_of_pages = 0;
     $_GET['p'] = 1;
     Pager::getPageNumbers(1000, $pages, $number_of_pages);
     $this->assertEquals(1, $pages['start']);
     $this->assertEquals(10, $pages['end']);
     $_GET['p'] = 4;
     Pager::getPageNumbers(1000, $pages, $number_of_pages);
     $this->assertEquals(1, $pages['start']);
     $this->assertEquals(10, $pages['end']);
     $_GET['p'] = 11;
     Pager::getPageNumbers(1000, $pages, $number_of_pages);
     $this->assertEquals(11, $pages['start']);
     $this->assertEquals(20, $pages['end']);
     $_GET['p'] = 20;
     Pager::getPageNumbers(1000, $pages, $number_of_pages);
     $this->assertEquals(11, $pages['start']);
     $this->assertEquals(20, $pages['end']);
     $_GET['p'] = 100;
     Pager::getPageNumbers(1000, $pages, $number_of_pages);
     $this->assertEquals(91, $pages['start']);
     $this->assertEquals(100, $pages['end']);
     $_GET['p'] = 0;
     Pager::getPageNumbers(1000, $pages, $number_of_pages);
     $this->assertEquals(1, $pages['start']);
     $this->assertEquals(10, $pages['end']);
     $_GET['p'] = -1;
     Pager::getPageNumbers(1000, $pages, $number_of_pages);
     $this->assertEquals(1, $pages['start']);
     $this->assertEquals(10, $pages['end']);
 }
开发者ID:anirut,项目名称:wp-autoresponder,代码行数:33,代码来源:paging.php

示例3: manage

 public static function manage()
 {
     $numberOfPages = 1;
     $autoresponder_id = $_GET['id'];
     try {
         $autoresponder = Autoresponder::getAutoresponder((int) $autoresponder_id);
     } catch (NonExistentAutoresponderException $exp) {
         wp_redirect("admin.php?page=_wpr/autoresponders");
     }
     Pager::getPageNumbers($autoresponder->getNumberOfMessages(), $pages, $numberOfPages);
     $current_page = $pages['current_page'];
     $messages = $autoresponder->getMessages(Pager::getStartIndexOfRecordSet(), Pager::getRowsPerPage());
     _wpr_set('number_of_pages', $numberOfPages);
     _wpr_set('current_page', $current_page);
     _wpr_set('pages', $pages);
     _wpr_set("messages", $messages);
     _wpr_set('base_url', 'admin.php?page=_wpr/autoresponders&action=manage&id=' . $autoresponder_id);
     _wpr_set("autoresponder", $autoresponder);
     _wpr_setview("autoresponder_manage");
 }
开发者ID:anirut,项目名称:wp-autoresponder,代码行数:20,代码来源:autoresponder.php


注:本文中的Pager::getPageNumbers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。