public function testRegulatingRowsPerPage() { $_GET['pp'] = 11; $actual = Pager::getRowsPerPage(); $this->assertEquals(50, $actual); $_GET['pp'] = 8; $actual = Pager::getRowsPerPage(); $this->assertEquals(10, $actual); $_GET['pp'] = 58; $actual = Pager::getRowsPerPage(); $this->assertEquals(100, $actual); $_GET['pp'] = 102; $actual = Pager::getRowsPerPage(); $this->assertEquals(100, $actual); }
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"); }