cvs: pear /Pager Pager.php

From: Date: Sat, 07 Jun 2003 15:46:48 +0000
Subject: cvs: pear /Pager Pager.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-10749@lists.php.net to get a copy of this message
quipo Sat Jun 7 11:46:48 2003 EDT Modified files: /pear/Pager Pager.php Log: - fixed phpdoc parameter - prevent URL modification - added CVS $Id Index: pear/Pager/Pager.php diff -u pear/Pager/Pager.php:1.9 pear/Pager/Pager.php:1.10 --- pear/Pager/Pager.php:1.9 Sat Jan 4 06:56:13 2003 +++ pear/Pager/Pager.php Sat Jun 7 11:46:48 2003 @@ -31,6 +31,8 @@ // +-----------------------------------------------------------------------+ // | Author: Richard Heyes <richard@phpguru.org> | // +-----------------------------------------------------------------------+ +// +// $Id: Pager.php,v 1.10 2003/06/07 15:46:48 quipo Exp $ /** * Pager class @@ -165,7 +167,7 @@ * it will return you 1 and 10. PageID of 2 would * give you 11 and 20. * - * @params pageID PageID to get offsets for + * @param pageID PageID to get offsets for * @return array First and last offsets */ function getOffsetByPageId($pageid = null) @@ -208,7 +210,7 @@ { return $this->_currentPage; } - + /** * Returns next page ID. If current page is last page * this function returns FALSE @@ -219,7 +221,7 @@ { return ($this->getCurrentPageID() == $this->numPages() ? false : $this->getCurrentPageID() + 1); } - + /** * Returns previous page ID. If current page is first page * this function returns FALSE @@ -230,7 +232,7 @@ { return $this->isFirstPage() ? false : $this->getCurrentPageID() - 1; } - + /** * Returns number of items * @@ -301,6 +303,9 @@ } else { $this->_pageData = array(); } + + //prevent URL modification + $this->_currentPage = min($this->_currentPage, $this->_totalPages); } /** @@ -344,7 +349,7 @@ { // Back link if ($this->_currentPage > 1) { - $back = sprintf('<a href="%s%d" %s>%s</a>', + $back = sprintf('<a href="%s%d" %s>%s</a>', $url, $this->_currentPage - 1, !empty($this->_linkClass) ? 'class="' . $this->_linkClass . '"' : '', @@ -352,7 +357,7 @@ } else { $back = ''; } - + return $back; } @@ -392,7 +397,7 @@ function _getNextLink($url, $link = 'Next >>') { if ($this->_currentPage < $this->_totalPages) { - $next = sprintf('<a href="%s%d" %s>%s</a>', + $next = sprintf('<a href="%s%d" %s>%s</a>', $url, $this->_currentPage + 1, !empty($this->_linkClass) ? 'class="' . $this->_linkClass . '"' : '',

« previous php.pear.cvs (#10749) next »