@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | * |
| 593 | 593 | * @param integer $index Offset to get pageID for |
| 594 | 594 | * |
| 595 | - * @return integer PageID for given offset |
|
| 595 | + * @return PEAR_Error PageID for given offset |
|
| 596 | 596 | * @access public |
| 597 | 597 | */ |
| 598 | 598 | function getPageIdByOffset($index) |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | * |
| 613 | 613 | * @param integer $pageID PageID to get offsets for |
| 614 | 614 | * |
| 615 | - * @return array First and last offsets |
|
| 615 | + * @return integer[] First and last offsets |
|
| 616 | 616 | * @access public |
| 617 | 617 | */ |
| 618 | 618 | function getOffsetByPageId($pageID = null) |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | * |
| 640 | 640 | * @param integer $pageID PageID to get offsets for |
| 641 | 641 | * |
| 642 | - * @return array First and last offsets |
|
| 642 | + * @return PEAR_Error First and last offsets |
|
| 643 | 643 | * @access public |
| 644 | 644 | */ |
| 645 | 645 | function getPageRangeByPageId($pageID = null) |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | * @param string $next_html HTML to put inside the next link |
| 669 | 669 | * [deprecated: use the factory instead] |
| 670 | 670 | * |
| 671 | - * @return array back/next/first/last and page links |
|
| 671 | + * @return PEAR_Error back/next/first/last and page links |
|
| 672 | 672 | * @access public |
| 673 | 673 | */ |
| 674 | 674 | function getLinks($pageID=null, $next_html='') |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | * Returns next page ID. If current page is last page |
| 699 | 699 | * this function returns FALSE |
| 700 | 700 | * |
| 701 | - * @return mixed Next page ID or false |
|
| 701 | + * @return integer Next page ID or false |
|
| 702 | 702 | * @access public |
| 703 | 703 | */ |
| 704 | 704 | function getNextPageID() |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | * Returns previous page ID. If current page is first page |
| 714 | 714 | * this function returns FALSE |
| 715 | 715 | * |
| 716 | - * @return mixed Previous page ID or false |
|
| 716 | + * @return integer Previous page ID or false |
|
| 717 | 717 | * @access public |
| 718 | 718 | */ |
| 719 | 719 | function getPreviousPageID() |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | * |
| 995 | 995 | * @param string $string the pattern to check |
| 996 | 996 | * |
| 997 | - * @return boolean |
|
| 997 | + * @return integer |
|
| 998 | 998 | * @access private |
| 999 | 999 | */ |
| 1000 | 1000 | function _isRegexp($string) { |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | * |
| 1137 | 1137 | * @param string $url URL to use in the link [deprecated: use the factory instead] |
| 1138 | 1138 | * |
| 1139 | - * @return string Links |
|
| 1139 | + * @return PEAR_Error Links |
|
| 1140 | 1140 | * @access private |
| 1141 | 1141 | */ |
| 1142 | 1142 | function _getPageLinks($url='') |
@@ -1,40 +1,40 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ |
| 3 | 3 | /** |
| 4 | - * Contains the Pager_Common class |
|
| 5 | - * |
|
| 6 | - * PHP versions 4 and 5 |
|
| 7 | - * |
|
| 8 | - * LICENSE: Redistribution and use in source and binary forms, with or without |
|
| 9 | - * modification, are permitted provided that the following conditions are met: |
|
| 10 | - * 1. Redistributions of source code must retain the above copyright |
|
| 11 | - * notice, this list of conditions and the following disclaimer. |
|
| 12 | - * 2. Redistributions in binary form must reproduce the above copyright |
|
| 13 | - * notice, this list of conditions and the following disclaimer in the |
|
| 14 | - * documentation and/or other materials provided with the distribution. |
|
| 15 | - * 3. The name of the author may not be used to endorse or promote products |
|
| 16 | - * derived from this software without specific prior written permission. |
|
| 17 | - * |
|
| 18 | - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED |
|
| 19 | - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
| 20 | - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
| 21 | - * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY |
|
| 22 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
| 23 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
| 24 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
| 25 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
| 26 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
| 27 | - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
| 28 | - * |
|
| 29 | - * @category HTML |
|
| 30 | - * @package Pager |
|
| 31 | - * @author Lorenzo Alberton <[email protected]> |
|
| 32 | - * @author Richard Heyes <[email protected]> |
|
| 33 | - * @copyright 2003-2007 Lorenzo Alberton, Richard Heyes |
|
| 34 | - * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) |
|
| 35 | - * @version CVS: $Id: Common.php,v 1.82 2008/05/31 12:44:55 quipo Exp $ |
|
| 36 | - * @link http://pear.php.net/package/Pager |
|
| 37 | - */ |
|
| 4 | + * Contains the Pager_Common class |
|
| 5 | + * |
|
| 6 | + * PHP versions 4 and 5 |
|
| 7 | + * |
|
| 8 | + * LICENSE: Redistribution and use in source and binary forms, with or without |
|
| 9 | + * modification, are permitted provided that the following conditions are met: |
|
| 10 | + * 1. Redistributions of source code must retain the above copyright |
|
| 11 | + * notice, this list of conditions and the following disclaimer. |
|
| 12 | + * 2. Redistributions in binary form must reproduce the above copyright |
|
| 13 | + * notice, this list of conditions and the following disclaimer in the |
|
| 14 | + * documentation and/or other materials provided with the distribution. |
|
| 15 | + * 3. The name of the author may not be used to endorse or promote products |
|
| 16 | + * derived from this software without specific prior written permission. |
|
| 17 | + * |
|
| 18 | + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED |
|
| 19 | + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
| 20 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
| 21 | + * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY |
|
| 22 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
| 23 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
| 24 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
| 25 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
| 26 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
|
| 27 | + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
| 28 | + * |
|
| 29 | + * @category HTML |
|
| 30 | + * @package Pager |
|
| 31 | + * @author Lorenzo Alberton <[email protected]> |
|
| 32 | + * @author Richard Heyes <[email protected]> |
|
| 33 | + * @copyright 2003-2007 Lorenzo Alberton, Richard Heyes |
|
| 34 | + * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) |
|
| 35 | + * @version CVS: $Id: Common.php,v 1.82 2008/05/31 12:44:55 quipo Exp $ |
|
| 36 | + * @link http://pear.php.net/package/Pager |
|
| 37 | + */ |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Two constants used to guess the path- and file-name of the page |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | // |
| 61 | 61 | /** |
| 62 | - * Error codes |
|
| 63 | - */ |
|
| 62 | + * Error codes |
|
| 63 | + */ |
|
| 64 | 64 | define('PAGER_OK', 0); |
| 65 | 65 | define('ERROR_PAGER', -1); |
| 66 | 66 | define('ERROR_PAGER_INVALID', -2); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | return array( |
| 627 | 627 | max(($this->_perPage * ($pageID - 1)) + 1, 1), |
| 628 | 628 | min($this->_totalItems, $this->_perPage * $pageID) |
| 629 | - ); |
|
| 629 | + ); |
|
| 630 | 630 | } |
| 631 | 631 | return array(0, 0); |
| 632 | 632 | } |
@@ -848,16 +848,16 @@ discard block |
||
| 848 | 848 | $onclick = str_replace('%d', $this->_linkData[$this->_urlVar], $this->_onclick); |
| 849 | 849 | } |
| 850 | 850 | return sprintf('<a href="%s"%s%s%s%s title="%s">%s</a>', |
| 851 | - // Modified by Ivan Tcholakov, 17-OCT-2008. |
|
| 852 | - //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'), |
|
| 853 | - api_htmlentities($this->_url . $href), |
|
| 854 | - // |
|
| 855 | - empty($this->_classString) ? '' : ' '.$this->_classString, |
|
| 856 | - empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 857 | - empty($this->_accesskey) ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"', |
|
| 858 | - empty($onclick) ? '' : ' onclick="'.$onclick.'"', |
|
| 859 | - $altText, |
|
| 860 | - $linkText |
|
| 851 | + // Modified by Ivan Tcholakov, 17-OCT-2008. |
|
| 852 | + //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'), |
|
| 853 | + api_htmlentities($this->_url . $href), |
|
| 854 | + // |
|
| 855 | + empty($this->_classString) ? '' : ' '.$this->_classString, |
|
| 856 | + empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 857 | + empty($this->_accesskey) ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"', |
|
| 858 | + empty($onclick) ? '' : ' onclick="'.$onclick.'"', |
|
| 859 | + $altText, |
|
| 860 | + $linkText |
|
| 861 | 861 | ); |
| 862 | 862 | } elseif ($this->_httpMethod == 'POST') { |
| 863 | 863 | $href = $this->_url; |
@@ -865,12 +865,12 @@ discard block |
||
| 865 | 865 | $href .= '?' . $this->_http_build_query_wrapper($_GET); |
| 866 | 866 | } |
| 867 | 867 | return sprintf("<a href='javascript:void(0)' onclick='%s'%s%s%s title='%s'>%s</a>", |
| 868 | - $this->_generateFormOnClick($href, $this->_linkData), |
|
| 869 | - empty($this->_classString) ? '' : ' '.$this->_classString, |
|
| 870 | - empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 871 | - empty($this->_accesskey) ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'', |
|
| 872 | - $altText, |
|
| 873 | - $linkText |
|
| 868 | + $this->_generateFormOnClick($href, $this->_linkData), |
|
| 869 | + empty($this->_classString) ? '' : ' '.$this->_classString, |
|
| 870 | + empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 871 | + empty($this->_accesskey) ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'', |
|
| 872 | + $altText, |
|
| 873 | + $linkText |
|
| 874 | 874 | ); |
| 875 | 875 | } |
| 876 | 876 | return ''; |
@@ -1120,10 +1120,10 @@ discard block |
||
| 1120 | 1120 | if ($this->_currentPage > 1) { |
| 1121 | 1121 | $this->_linkData[$this->_urlVar] = $this->getPreviousPageID(); |
| 1122 | 1122 | $back = $this->_renderLink($this->_altPrev, $this->_prevImg) |
| 1123 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1123 | + . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1124 | 1124 | } else if ($this->_prevImgEmpty !== null && $this->_totalPages > 1) { |
| 1125 | 1125 | $back = $this->_prevImgEmpty |
| 1126 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1126 | + . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1127 | 1127 | } |
| 1128 | 1128 | return $back; |
| 1129 | 1129 | } |
@@ -1171,12 +1171,12 @@ discard block |
||
| 1171 | 1171 | if ($this->_currentPage < $this->_totalPages) { |
| 1172 | 1172 | $this->_linkData[$this->_urlVar] = $this->getNextPageID(); |
| 1173 | 1173 | $next = $this->_spacesAfter |
| 1174 | - . $this->_renderLink($this->_altNext, $this->_nextImg) |
|
| 1175 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1174 | + . $this->_renderLink($this->_altNext, $this->_nextImg) |
|
| 1175 | + . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1176 | 1176 | } else if ($this->_nextImgEmpty !== null && $this->_totalPages > 1) { |
| 1177 | 1177 | $next = $this->_spacesAfter |
| 1178 | - . $this->_nextImgEmpty |
|
| 1179 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1178 | + . $this->_nextImgEmpty |
|
| 1179 | + . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1180 | 1180 | } |
| 1181 | 1181 | return $next; |
| 1182 | 1182 | } |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | if (!empty($_SESSION[$this->_sessionVar]) && $this->_useSessions) { |
| 1635 | - $this->_perPage = $_SESSION[$this->_sessionVar]; |
|
| 1635 | + $this->_perPage = $_SESSION[$this->_sessionVar]; |
|
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | if ($this->_closeSession) { |
@@ -1713,7 +1713,7 @@ discard block |
||
| 1713 | 1713 | ERROR_PAGER_INVALID => 'invalid', |
| 1714 | 1714 | ERROR_PAGER_INVALID_PLACEHOLDER => 'invalid format - use "%d" as placeholder.', |
| 1715 | 1715 | ERROR_PAGER_INVALID_USAGE => 'if $options[\'append\'] is set to false, ' |
| 1716 | - .' $options[\'fileName\'] MUST contain the "%d" placeholder.', |
|
| 1716 | + .' $options[\'fileName\'] MUST contain the "%d" placeholder.', |
|
| 1717 | 1717 | ERROR_PAGER_NOT_IMPLEMENTED => 'not implemented' |
| 1718 | 1718 | ); |
| 1719 | 1719 | } |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * Error codes |
| 63 | 63 | */ |
| 64 | -define('PAGER_OK', 0); |
|
| 65 | -define('ERROR_PAGER', -1); |
|
| 66 | -define('ERROR_PAGER_INVALID', -2); |
|
| 64 | +define('PAGER_OK', 0); |
|
| 65 | +define('ERROR_PAGER', -1); |
|
| 66 | +define('ERROR_PAGER_INVALID', -2); |
|
| 67 | 67 | define('ERROR_PAGER_INVALID_PLACEHOLDER', -3); |
| 68 | -define('ERROR_PAGER_INVALID_USAGE', -4); |
|
| 69 | -define('ERROR_PAGER_NOT_IMPLEMENTED', -5); |
|
| 68 | +define('ERROR_PAGER_INVALID_USAGE', -4); |
|
| 69 | +define('ERROR_PAGER_NOT_IMPLEMENTED', -5); |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Pager_Common - Common base class for [Sliding|Jumping] Window Pager |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | * @var integer number of items per page |
| 95 | 95 | * @access private |
| 96 | 96 | */ |
| 97 | - var $_perPage = 10; |
|
| 97 | + var $_perPage = 10; |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * @var integer number of page links for each window |
| 101 | 101 | * @access private |
| 102 | 102 | */ |
| 103 | - var $_delta = 10; |
|
| 103 | + var $_delta = 10; |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * @var integer current page number |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @var integer total pages number |
| 113 | 113 | * @access private |
| 114 | 114 | */ |
| 115 | - var $_totalPages = 1; |
|
| 115 | + var $_totalPages = 1; |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * @var string CSS class for links |
| 119 | 119 | * @access private |
| 120 | 120 | */ |
| 121 | - var $_linkClass = ''; |
|
| 121 | + var $_linkClass = ''; |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * @var string wrapper for CSS class name |
@@ -130,13 +130,13 @@ discard block |
||
| 130 | 130 | * @var string path name |
| 131 | 131 | * @access private |
| 132 | 132 | */ |
| 133 | - var $_path = PAGER_CURRENT_PATHNAME; |
|
| 133 | + var $_path = PAGER_CURRENT_PATHNAME; |
|
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | 136 | * @var string file name |
| 137 | 137 | * @access private |
| 138 | 138 | */ |
| 139 | - var $_fileName = PAGER_CURRENT_FILENAME; |
|
| 139 | + var $_fileName = PAGER_CURRENT_FILENAME; |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * @var boolean If false, don't override the fileName option. Use at your own risk. |
@@ -148,19 +148,19 @@ discard block |
||
| 148 | 148 | * @var boolean you have to use FALSE with mod_rewrite |
| 149 | 149 | * @access private |
| 150 | 150 | */ |
| 151 | - var $_append = true; |
|
| 151 | + var $_append = true; |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * @var string specifies which HTTP method to use |
| 155 | 155 | * @access private |
| 156 | 156 | */ |
| 157 | - var $_httpMethod = 'GET'; |
|
| 157 | + var $_httpMethod = 'GET'; |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * @var string specifies which HTML form to use |
| 161 | 161 | * @access private |
| 162 | 162 | */ |
| 163 | - var $_formID = ''; |
|
| 163 | + var $_formID = ''; |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * @var boolean whether or not to import submitted data |
@@ -172,19 +172,19 @@ discard block |
||
| 172 | 172 | * @var string name of the querystring var for pageID |
| 173 | 173 | * @access private |
| 174 | 174 | */ |
| 175 | - var $_urlVar = 'pageID'; |
|
| 175 | + var $_urlVar = 'pageID'; |
|
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | 178 | * @var array data to pass through the link |
| 179 | 179 | * @access private |
| 180 | 180 | */ |
| 181 | - var $_linkData = array(); |
|
| 181 | + var $_linkData = array(); |
|
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * @var array additional URL vars |
| 185 | 185 | * @access private |
| 186 | 186 | */ |
| 187 | - var $_extraVars = array(); |
|
| 187 | + var $_extraVars = array(); |
|
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * @var array URL vars to ignore |
@@ -196,19 +196,19 @@ discard block |
||
| 196 | 196 | * @var boolean TRUE => expanded mode (for Pager_Sliding) |
| 197 | 197 | * @access private |
| 198 | 198 | */ |
| 199 | - var $_expanded = true; |
|
| 199 | + var $_expanded = true; |
|
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | 202 | * @var boolean TRUE => show accesskey attribute on <a> tags |
| 203 | 203 | * @access private |
| 204 | 204 | */ |
| 205 | - var $_accesskey = false; |
|
| 205 | + var $_accesskey = false; |
|
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | * @var string extra attributes for the <a> tag |
| 209 | 209 | * @access private |
| 210 | 210 | */ |
| 211 | - var $_attributes = ''; |
|
| 211 | + var $_attributes = ''; |
|
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * @var string onclick |
@@ -220,37 +220,37 @@ discard block |
||
| 220 | 220 | * @var string alt text for "first page" (use "%d" placeholder for page number) |
| 221 | 221 | * @access private |
| 222 | 222 | */ |
| 223 | - var $_altFirst = 'first page'; |
|
| 223 | + var $_altFirst = 'first page'; |
|
| 224 | 224 | |
| 225 | 225 | /** |
| 226 | 226 | * @var string alt text for "previous page" |
| 227 | 227 | * @access private |
| 228 | 228 | */ |
| 229 | - var $_altPrev = 'previous page'; |
|
| 229 | + var $_altPrev = 'previous page'; |
|
| 230 | 230 | |
| 231 | 231 | /** |
| 232 | 232 | * @var string alt text for "next page" |
| 233 | 233 | * @access private |
| 234 | 234 | */ |
| 235 | - var $_altNext = 'next page'; |
|
| 235 | + var $_altNext = 'next page'; |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * @var string alt text for "last page" (use "%d" placeholder for page number) |
| 239 | 239 | * @access private |
| 240 | 240 | */ |
| 241 | - var $_altLast = 'last page'; |
|
| 241 | + var $_altLast = 'last page'; |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * @var string alt text for "page" (use optional "%d" placeholder for page number) |
| 245 | 245 | * @access private |
| 246 | 246 | */ |
| 247 | - var $_altPage = 'page'; |
|
| 247 | + var $_altPage = 'page'; |
|
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * @var string image/text to use as "prev" link |
| 251 | 251 | * @access private |
| 252 | 252 | */ |
| 253 | - var $_prevImg = '<< Back'; |
|
| 253 | + var $_prevImg = '<< Back'; |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * image/text to use as "prev" link when no prev link is needed (e.g. on the first page) |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @var string image/text to use as "next" link |
| 266 | 266 | * @access private |
| 267 | 267 | */ |
| 268 | - var $_nextImg = 'Next >>'; |
|
| 268 | + var $_nextImg = 'Next >>'; |
|
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | 271 | * image/text to use as "next" link when |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @var string link separator |
| 282 | 282 | * @access private |
| 283 | 283 | */ |
| 284 | - var $_separator = ''; |
|
| 284 | + var $_separator = ''; |
|
| 285 | 285 | |
| 286 | 286 | /** |
| 287 | 287 | * @var integer number of spaces before separator |
@@ -293,31 +293,31 @@ discard block |
||
| 293 | 293 | * @var integer number of spaces after separator |
| 294 | 294 | * @access private |
| 295 | 295 | */ |
| 296 | - var $_spacesAfterSeparator = 1; |
|
| 296 | + var $_spacesAfterSeparator = 1; |
|
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | 299 | * @var string CSS class name for current page link |
| 300 | 300 | * @access private |
| 301 | 301 | */ |
| 302 | - var $_curPageLinkClassName = ''; |
|
| 302 | + var $_curPageLinkClassName = ''; |
|
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * @var string Text before current page link |
| 306 | 306 | * @access private |
| 307 | 307 | */ |
| 308 | - var $_curPageSpanPre = ''; |
|
| 308 | + var $_curPageSpanPre = ''; |
|
| 309 | 309 | |
| 310 | 310 | /** |
| 311 | 311 | * @var string Text after current page link |
| 312 | 312 | * @access private |
| 313 | 313 | */ |
| 314 | - var $_curPageSpanPost = ''; |
|
| 314 | + var $_curPageSpanPost = ''; |
|
| 315 | 315 | |
| 316 | 316 | /** |
| 317 | 317 | * @var string Text before first page link |
| 318 | 318 | * @access private |
| 319 | 319 | */ |
| 320 | - var $_firstPagePre = '['; |
|
| 320 | + var $_firstPagePre = '['; |
|
| 321 | 321 | |
| 322 | 322 | /** |
| 323 | 323 | * @var string Text to be used for first page link |
@@ -335,31 +335,31 @@ discard block |
||
| 335 | 335 | * @var string Text before last page link |
| 336 | 336 | * @access private |
| 337 | 337 | */ |
| 338 | - var $_lastPagePre = '['; |
|
| 338 | + var $_lastPagePre = '['; |
|
| 339 | 339 | |
| 340 | 340 | /** |
| 341 | 341 | * @var string Text to be used for last page link |
| 342 | 342 | * @access private |
| 343 | 343 | */ |
| 344 | - var $_lastPageText = ''; |
|
| 344 | + var $_lastPageText = ''; |
|
| 345 | 345 | |
| 346 | 346 | /** |
| 347 | 347 | * @var string Text after last page link |
| 348 | 348 | * @access private |
| 349 | 349 | */ |
| 350 | - var $_lastPagePost = ']'; |
|
| 350 | + var $_lastPagePost = ']'; |
|
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | 353 | * @var string Will contain the HTML code for the spaces |
| 354 | 354 | * @access private |
| 355 | 355 | */ |
| 356 | - var $_spacesBefore = ''; |
|
| 356 | + var $_spacesBefore = ''; |
|
| 357 | 357 | |
| 358 | 358 | /** |
| 359 | 359 | * @var string Will contain the HTML code for the spaces |
| 360 | 360 | * @access private |
| 361 | 361 | */ |
| 362 | - var $_spacesAfter = ''; |
|
| 362 | + var $_spacesAfter = ''; |
|
| 363 | 363 | |
| 364 | 364 | /** |
| 365 | 365 | * @var string String used as title in <link rel="first"> tag |
@@ -389,37 +389,37 @@ discard block |
||
| 389 | 389 | * @var string Text to be used for the 'show all' option in the select box |
| 390 | 390 | * @access private |
| 391 | 391 | */ |
| 392 | - var $_showAllText = ''; |
|
| 392 | + var $_showAllText = ''; |
|
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | 395 | * @var array data to be paged |
| 396 | 396 | * @access private |
| 397 | 397 | */ |
| 398 | - var $_itemData = null; |
|
| 398 | + var $_itemData = null; |
|
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | 401 | * @var boolean If TRUE and there's only one page, links aren't shown |
| 402 | 402 | * @access private |
| 403 | 403 | */ |
| 404 | - var $_clearIfVoid = true; |
|
| 404 | + var $_clearIfVoid = true; |
|
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | 407 | * @var boolean Use session for storing the number of items per page |
| 408 | 408 | * @access private |
| 409 | 409 | */ |
| 410 | - var $_useSessions = false; |
|
| 410 | + var $_useSessions = false; |
|
| 411 | 411 | |
| 412 | 412 | /** |
| 413 | 413 | * @var boolean Close the session when finished reading/writing data |
| 414 | 414 | * @access private |
| 415 | 415 | */ |
| 416 | - var $_closeSession = false; |
|
| 416 | + var $_closeSession = false; |
|
| 417 | 417 | |
| 418 | 418 | /** |
| 419 | 419 | * @var string name of the session var for number of items per page |
| 420 | 420 | * @access private |
| 421 | 421 | */ |
| 422 | - var $_sessionVar = 'setPerPage'; |
|
| 422 | + var $_sessionVar = 'setPerPage'; |
|
| 423 | 423 | |
| 424 | 424 | /** |
| 425 | 425 | * Pear error mode (when raiseError is called) |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | * @return array back/next/first/last and page links |
| 672 | 672 | * @access public |
| 673 | 673 | */ |
| 674 | - function getLinks($pageID=null, $next_html='') |
|
| 674 | + function getLinks($pageID = null, $next_html = '') |
|
| 675 | 675 | { |
| 676 | 676 | $msg = 'function "getLinks()" not implemented.'; |
| 677 | 677 | return $this->raiseError($msg, ERROR_PAGER_NOT_IMPLEMENTED); |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | */ |
| 747 | 747 | function numPages() |
| 748 | 748 | { |
| 749 | - return (int)$this->_totalPages; |
|
| 749 | + return (int) $this->_totalPages; |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | // }}} |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | if (!is_null($this->_itemData)) { |
| 807 | 807 | $this->_totalItems = count($this->_itemData); |
| 808 | 808 | } |
| 809 | - $this->_totalPages = ceil((float)$this->_totalItems / (float)$this->_perPage); |
|
| 809 | + $this->_totalPages = ceil((float) $this->_totalItems / (float) $this->_perPage); |
|
| 810 | 810 | $i = 1; |
| 811 | 811 | if (!empty($this->_itemData)) { |
| 812 | 812 | foreach ($this->_itemData as $key => $value) { |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | { |
| 840 | 840 | if ($this->_httpMethod == 'GET') { |
| 841 | 841 | if ($this->_append) { |
| 842 | - $href = '?' . $this->_http_build_query_wrapper($this->_linkData); |
|
| 842 | + $href = '?'.$this->_http_build_query_wrapper($this->_linkData); |
|
| 843 | 843 | } else { |
| 844 | 844 | $href = str_replace('%d', $this->_linkData[$this->_urlVar], $this->_fileName); |
| 845 | 845 | } |
@@ -850,25 +850,25 @@ discard block |
||
| 850 | 850 | return sprintf('<a href="%s"%s%s%s%s title="%s">%s</a>', |
| 851 | 851 | // Modified by Ivan Tcholakov, 17-OCT-2008. |
| 852 | 852 | //htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'), |
| 853 | - api_htmlentities($this->_url . $href), |
|
| 853 | + api_htmlentities($this->_url.$href), |
|
| 854 | 854 | // |
| 855 | 855 | empty($this->_classString) ? '' : ' '.$this->_classString, |
| 856 | - empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 857 | - empty($this->_accesskey) ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"', |
|
| 858 | - empty($onclick) ? '' : ' onclick="'.$onclick.'"', |
|
| 856 | + empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 857 | + empty($this->_accesskey) ? '' : ' accesskey="'.$this->_linkData[$this->_urlVar].'"', |
|
| 858 | + empty($onclick) ? '' : ' onclick="'.$onclick.'"', |
|
| 859 | 859 | $altText, |
| 860 | 860 | $linkText |
| 861 | 861 | ); |
| 862 | 862 | } elseif ($this->_httpMethod == 'POST') { |
| 863 | 863 | $href = $this->_url; |
| 864 | 864 | if (!empty($_GET)) { |
| 865 | - $href .= '?' . $this->_http_build_query_wrapper($_GET); |
|
| 865 | + $href .= '?'.$this->_http_build_query_wrapper($_GET); |
|
| 866 | 866 | } |
| 867 | 867 | return sprintf("<a href='javascript:void(0)' onclick='%s'%s%s%s title='%s'>%s</a>", |
| 868 | 868 | $this->_generateFormOnClick($href, $this->_linkData), |
| 869 | 869 | empty($this->_classString) ? '' : ' '.$this->_classString, |
| 870 | - empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 871 | - empty($this->_accesskey) ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'', |
|
| 870 | + empty($this->_attributes) ? '' : ' '.$this->_attributes, |
|
| 871 | + empty($this->_accesskey) ? '' : ' accesskey=\''.$this->_linkData[$this->_urlVar].'\'', |
|
| 872 | 872 | $altText, |
| 873 | 873 | $linkText |
| 874 | 874 | ); |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | $str = ''; |
| 957 | 957 | if (is_array($data) || is_object($data)) { |
| 958 | 958 | // foreach key/visible member |
| 959 | - foreach ((array)$data as $key => $val) { |
|
| 959 | + foreach ((array) $data as $key => $val) { |
|
| 960 | 960 | // append [$key] to prev |
| 961 | 961 | $tempKey = sprintf('%s[%s]', $prev, $key); |
| 962 | 962 | $str .= $this->_generateFormOnClickHelper($val, $tempKey); |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | * @return string The link |
| 1107 | 1107 | * @access private |
| 1108 | 1108 | */ |
| 1109 | - function _getBackLink($url='', $link='') |
|
| 1109 | + function _getBackLink($url = '', $link = '') |
|
| 1110 | 1110 | { |
| 1111 | 1111 | //legacy settings... the preferred way to set an option |
| 1112 | 1112 | //now is passing it to the factory |
@@ -1120,10 +1120,10 @@ discard block |
||
| 1120 | 1120 | if ($this->_currentPage > 1) { |
| 1121 | 1121 | $this->_linkData[$this->_urlVar] = $this->getPreviousPageID(); |
| 1122 | 1122 | $back = $this->_renderLink($this->_altPrev, $this->_prevImg) |
| 1123 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1123 | + . $this->_spacesBefore.$this->_spacesAfter; |
|
| 1124 | 1124 | } else if ($this->_prevImgEmpty !== null && $this->_totalPages > 1) { |
| 1125 | 1125 | $back = $this->_prevImgEmpty |
| 1126 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1126 | + . $this->_spacesBefore.$this->_spacesAfter; |
|
| 1127 | 1127 | } |
| 1128 | 1128 | return $back; |
| 1129 | 1129 | } |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | * @return string Links |
| 1140 | 1140 | * @access private |
| 1141 | 1141 | */ |
| 1142 | - function _getPageLinks($url='') |
|
| 1142 | + function _getPageLinks($url = '') |
|
| 1143 | 1143 | { |
| 1144 | 1144 | $msg = 'function "_getPageLinks()" not implemented.'; |
| 1145 | 1145 | return $this->raiseError($msg, ERROR_PAGER_NOT_IMPLEMENTED); |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | * @return string The link |
| 1158 | 1158 | * @access private |
| 1159 | 1159 | */ |
| 1160 | - function _getNextLink($url='', $link='') |
|
| 1160 | + function _getNextLink($url = '', $link = '') |
|
| 1161 | 1161 | { |
| 1162 | 1162 | //legacy settings... the preferred way to set an option |
| 1163 | 1163 | //now is passing it to the factory |
@@ -1172,11 +1172,11 @@ discard block |
||
| 1172 | 1172 | $this->_linkData[$this->_urlVar] = $this->getNextPageID(); |
| 1173 | 1173 | $next = $this->_spacesAfter |
| 1174 | 1174 | . $this->_renderLink($this->_altNext, $this->_nextImg) |
| 1175 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1175 | + . $this->_spacesBefore.$this->_spacesAfter; |
|
| 1176 | 1176 | } else if ($this->_nextImgEmpty !== null && $this->_totalPages > 1) { |
| 1177 | 1177 | $next = $this->_spacesAfter |
| 1178 | 1178 | . $this->_nextImgEmpty |
| 1179 | - . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1179 | + . $this->_spacesBefore.$this->_spacesAfter; |
|
| 1180 | 1180 | } |
| 1181 | 1181 | return $next; |
| 1182 | 1182 | } |
@@ -1308,13 +1308,13 @@ discard block |
||
| 1308 | 1308 | { |
| 1309 | 1309 | $this->_linkData[$this->_urlVar] = $pageID; |
| 1310 | 1310 | if ($this->_append) { |
| 1311 | - $href = '?' . $this->_http_build_query_wrapper($this->_linkData); |
|
| 1311 | + $href = '?'.$this->_http_build_query_wrapper($this->_linkData); |
|
| 1312 | 1312 | } else { |
| 1313 | 1313 | $href = str_replace('%d', $this->_linkData[$this->_urlVar], $this->_fileName); |
| 1314 | 1314 | } |
| 1315 | 1315 | // Modified by Ivan Tcholakov, 17-OCT-2008. |
| 1316 | 1316 | //return htmlentities($this->_url . $href, ENT_COMPAT, 'UTF-8'); |
| 1317 | - return api_htmlentities($this->_url . $href); |
|
| 1317 | + return api_htmlentities($this->_url.$href); |
|
| 1318 | 1318 | // |
| 1319 | 1319 | } |
| 1320 | 1320 | |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | * @return string xhtml select box |
| 1343 | 1343 | * @access public |
| 1344 | 1344 | */ |
| 1345 | - function getPerPageSelectBox($start=5, $end=30, $step=5, $showAllData=false, $extraParams=array()) |
|
| 1345 | + function getPerPageSelectBox($start = 5, $end = 30, $step = 5, $showAllData = false, $extraParams = array()) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | include_once 'Pager/HtmlWidgets.php'; |
| 1348 | 1348 | $widget = new Pager_HtmlWidgets($this); |
@@ -1393,8 +1393,8 @@ discard block |
||
| 1393 | 1393 | $this->_linkData[$this->_urlVar] = 1; |
| 1394 | 1394 | return $this->_renderLink( |
| 1395 | 1395 | str_replace('%d', 1, $this->_altFirst), |
| 1396 | - $this->_firstPagePre . $this->_firstPageText . $this->_firstPagePost |
|
| 1397 | - ) . $this->_spacesBefore . $this->_spacesAfter; |
|
| 1396 | + $this->_firstPagePre.$this->_firstPageText.$this->_firstPagePost |
|
| 1397 | + ).$this->_spacesBefore.$this->_spacesAfter; |
|
| 1398 | 1398 | } |
| 1399 | 1399 | |
| 1400 | 1400 | // }}} |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | $this->_linkData[$this->_urlVar] = $this->_totalPages; |
| 1416 | 1416 | return $this->_renderLink( |
| 1417 | 1417 | str_replace('%d', $this->_totalPages, $this->_altLast), |
| 1418 | - $this->_lastPagePre . $this->_lastPageText . $this->_lastPagePost |
|
| 1418 | + $this->_lastPagePre.$this->_lastPageText.$this->_lastPagePost |
|
| 1419 | 1419 | ); |
| 1420 | 1420 | } |
| 1421 | 1421 | |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | */ |
| 1456 | 1456 | function _http_build_query_wrapper($data) |
| 1457 | 1457 | { |
| 1458 | - $data = (array)$data; |
|
| 1458 | + $data = (array) $data; |
|
| 1459 | 1459 | if (empty($data)) { |
| 1460 | 1460 | return ''; |
| 1461 | 1461 | } |
@@ -1463,12 +1463,12 @@ discard block |
||
| 1463 | 1463 | if ($separator == '&') { |
| 1464 | 1464 | $separator = '&'; //the string is escaped by htmlentities anyway... |
| 1465 | 1465 | } |
| 1466 | - $tmp = array (); |
|
| 1466 | + $tmp = array(); |
|
| 1467 | 1467 | foreach ($data as $key => $val) { |
| 1468 | 1468 | if (is_scalar($val)) { |
| 1469 | 1469 | //array_push($tmp, $key.'='.$val); |
| 1470 | 1470 | $val = urlencode($val); |
| 1471 | - array_push($tmp, $key .'='. str_replace('%2F', '/', $val)); |
|
| 1471 | + array_push($tmp, $key.'='.str_replace('%2F', '/', $val)); |
|
| 1472 | 1472 | continue; |
| 1473 | 1473 | } |
| 1474 | 1474 | // If the value is an array, recursively parse it |
@@ -1494,7 +1494,7 @@ discard block |
||
| 1494 | 1494 | */ |
| 1495 | 1495 | function __http_build_query($array, $name) |
| 1496 | 1496 | { |
| 1497 | - $tmp = array (); |
|
| 1497 | + $tmp = array(); |
|
| 1498 | 1498 | $separator = ini_get('arg_separator.output'); |
| 1499 | 1499 | if ($separator == '&') { |
| 1500 | 1500 | $separator = '&'; //the string is escaped by htmlentities anyway... |
@@ -1569,7 +1569,7 @@ discard block |
||
| 1569 | 1569 | { |
| 1570 | 1570 | foreach ($options as $key => $value) { |
| 1571 | 1571 | if (in_array($key, $this->_allowed_options) && (!is_null($value))) { |
| 1572 | - $this->{'_' . $key} = $value; |
|
| 1572 | + $this->{'_'.$key} = $value; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | } |
| 1575 | 1575 | |
@@ -1584,7 +1584,7 @@ discard block |
||
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | if (substr($this->_path, -1, 1) == '/') { |
| 1587 | - $this->_fileName = ltrim($this->_fileName, '/'); //strip leading slash |
|
| 1587 | + $this->_fileName = ltrim($this->_fileName, '/'); //strip leading slash |
|
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | if ($this->_append) { |
@@ -1615,8 +1615,8 @@ discard block |
||
| 1615 | 1615 | } |
| 1616 | 1616 | |
| 1617 | 1617 | if (strlen($this->_curPageLinkClassName)) { |
| 1618 | - $this->_curPageSpanPre .= '<span class="'.$this->_curPageLinkClassName.'">'; |
|
| 1619 | - $this->_curPageSpanPost = '</span>' . $this->_curPageSpanPost; |
|
| 1618 | + $this->_curPageSpanPre .= '<span class="'.$this->_curPageLinkClassName.'">'; |
|
| 1619 | + $this->_curPageSpanPost = '</span>'.$this->_curPageSpanPost; |
|
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | 1622 | $this->_perPage = max($this->_perPage, 1); //avoid possible user errors |
@@ -1625,7 +1625,7 @@ discard block |
||
| 1625 | 1625 | session_start(); |
| 1626 | 1626 | } |
| 1627 | 1627 | if (!empty($_REQUEST[$this->_sessionVar])) { |
| 1628 | - $this->_perPage = max(1, (int)$_REQUEST[$this->_sessionVar]); |
|
| 1628 | + $this->_perPage = max(1, (int) $_REQUEST[$this->_sessionVar]); |
|
| 1629 | 1629 | if ($this->_useSessions) { |
| 1630 | 1630 | $_SESSION[$this->_sessionVar] = $this->_perPage; |
| 1631 | 1631 | } |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | // |
| 1648 | 1648 | |
| 1649 | 1649 | if (isset($_REQUEST[$this->_urlVar]) && empty($options['currentPage'])) { |
| 1650 | - $this->_currentPage = (int)$_REQUEST[$this->_urlVar]; |
|
| 1650 | + $this->_currentPage = (int) $_REQUEST[$this->_urlVar]; |
|
| 1651 | 1651 | } |
| 1652 | 1652 | $this->_currentPage = max($this->_currentPage, 1); |
| 1653 | 1653 | $this->_linkData = $this->_getLinksData(); |
@@ -1672,7 +1672,7 @@ discard block |
||
| 1672 | 1672 | $msg = 'invalid option: '.$name; |
| 1673 | 1673 | return $this->raiseError($msg, ERROR_PAGER_INVALID); |
| 1674 | 1674 | } |
| 1675 | - return $this->{'_' . $name}; |
|
| 1675 | + return $this->{'_'.$name}; |
|
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | 1678 | // }}} |
@@ -1688,7 +1688,7 @@ discard block |
||
| 1688 | 1688 | { |
| 1689 | 1689 | $options = array(); |
| 1690 | 1690 | foreach ($this->_allowed_options as $option) { |
| 1691 | - $options[$option] = $this->{'_' . $option}; |
|
| 1691 | + $options[$option] = $this->{'_'.$option}; |
|
| 1692 | 1692 | } |
| 1693 | 1693 | return $options; |
| 1694 | 1694 | } |
@@ -55,7 +55,8 @@ |
||
| 55 | 55 | /** |
| 56 | 56 | * Constructor |
| 57 | 57 | * |
| 58 | - * @param object &$pager Pager instance |
|
| 58 | + * @param object &$pager Pager instance |
|
| 59 | + * @param Pager_Common $pager |
|
| 59 | 60 | */ |
| 60 | 61 | function Pager_HtmlWidgets(&$pager) |
| 61 | 62 | { |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | $href = htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8');
|
| 154 | 154 | } |
| 155 | 155 | $tmp .= ' onchange="document.location.href=\'' |
| 156 | - . $href .'\'' |
|
| 157 | - . '"'; |
|
| 156 | + . $href .'\'' |
|
| 157 | + . '"'; |
|
| 158 | 158 | } elseif ($this->pager->_httpMethod == 'POST') {
|
| 159 | 159 | $tmp .= " onchange='" |
| 160 | - . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData) |
|
| 161 | - . "'"; |
|
| 160 | + . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData) |
|
| 161 | + . "'"; |
|
| 162 | 162 | $tmp = preg_replace( |
| 163 | 163 | '/(input\.name = \"'.$this->pager->_sessionVar.'\"; input\.value =) \"(\d+)\";/', |
| 164 | 164 | '\\1 this.options[this.selectedIndex].value;', |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | // |
| 260 | 260 | } |
| 261 | 261 | $tmp .= ' onchange="javascript: document.location.href=\'' |
| 262 | - . $href .'\'' |
|
| 263 | - . '"'; |
|
| 262 | + . $href .'\'' |
|
| 263 | + . '"'; |
|
| 264 | 264 | } elseif ($this->pager->_httpMethod == 'POST') { |
| 265 | 265 | $tmp .= " onchange='" |
| 266 | - . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData) |
|
| 267 | - . "'"; |
|
| 266 | + . $this->pager->_generateFormOnClick($this->pager->_url, $this->pager->_linkData) |
|
| 267 | + . "'"; |
|
| 268 | 268 | $tmp = preg_replace( |
| 269 | 269 | '/(input\.name = \"'.$this->pager->_urlVar.'\"; input\.value =) \"(\d+)\";/', |
| 270 | 270 | '\\1 this.options[this.selectedIndex].value;', |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | function Pager_HtmlWidgets(&$pager) |
| 61 | 61 | { |
| 62 | - $this->pager =& $pager; |
|
| 62 | + $this->pager = & $pager; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // }}} |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @return string xhtml select box |
| 91 | 91 | * @access public |
| 92 | 92 | */ |
| 93 | - function getPerPageSelectBox($start=5, $end=30, $step=5, $showAllData=false, $extraParams=array()) |
|
| 93 | + function getPerPageSelectBox($start = 5, $end = 30, $step = 5, $showAllData = false, $extraParams = array()) |
|
| 94 | 94 | { |
| 95 | 95 | // FIXME: needs POST support |
| 96 | 96 | $optionText = '%d'; |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | ERROR_PAGER_INVALID_PLACEHOLDER |
| 118 | 118 | ); |
| 119 | 119 | } |
| 120 | - $start = (int)$start; |
|
| 121 | - $end = (int)$end; |
|
| 122 | - $step = (int)$step; |
|
| 120 | + $start = (int) $start; |
|
| 121 | + $end = (int) $end; |
|
| 122 | + $step = (int) $step; |
|
| 123 | 123 | if (!empty($_SESSION[$this->pager->_sessionVar])) { |
| 124 | - $selected = (int)$_SESSION[$this->pager->_sessionVar]; |
|
| 124 | + $selected = (int) $_SESSION[$this->pager->_sessionVar]; |
|
| 125 | 125 | } else { |
| 126 | 126 | $selected = $this->pager->_perPage; |
| 127 | 127 | } |
@@ -143,17 +143,17 @@ discard block |
||
| 143 | 143 | $tmpLinkData[$this->pager->_urlVar] = $this->pager->getCurrentPageID(); |
| 144 | 144 | } |
| 145 | 145 | $tmpLinkData[$this->pager->_sessionVar] = '1'; |
| 146 | - $href = '?' . $this->pager->_http_build_query_wrapper($tmpLinkData); |
|
| 147 | - $href = htmlentities($this->pager->_url, ENT_COMPAT, 'UTF-8'). preg_replace( |
|
| 146 | + $href = '?'.$this->pager->_http_build_query_wrapper($tmpLinkData); |
|
| 147 | + $href = htmlentities($this->pager->_url, ENT_COMPAT, 'UTF-8').preg_replace( |
|
| 148 | 148 | '/(&|&|\?)('.$this->pager->_sessionVar.'=)(\d+)/',
|
| 149 | 149 | '\\1\\2'.$selector, |
| 150 | 150 | htmlentities($href, ENT_COMPAT, 'UTF-8') |
| 151 | 151 | ); |
| 152 | 152 | } else {
|
| 153 | - $href = htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8');
|
|
| 153 | + $href = htmlentities($this->pager->_url.str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8');
|
|
| 154 | 154 | } |
| 155 | 155 | $tmp .= ' onchange="document.location.href=\'' |
| 156 | - . $href .'\'' |
|
| 156 | + . $href.'\'' |
|
| 157 | 157 | . '"'; |
| 158 | 158 | } elseif ($this->pager->_httpMethod == 'POST') {
|
| 159 | 159 | $tmp .= " onchange='" |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $tmp .= '>'; |
| 172 | 172 | $last = $start; |
| 173 | - for ($i=$start; $i<=$end; $i+=$step) { |
|
| 173 | + for ($i = $start; $i <= $end; $i += $step) { |
|
| 174 | 174 | $last = $i; |
| 175 | 175 | $tmp .= '<option value="'.$i.'"'; |
| 176 | 176 | if ($i == $selected) { |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | if ($this->pager->_httpMethod == 'GET') { |
| 241 | 241 | $selector = '\' + '.'this.options[this.selectedIndex].value + \''; |
| 242 | 242 | if ($this->pager->_append) { |
| 243 | - $href = '?' . $this->pager->_http_build_query_wrapper($this->pager->_linkData); |
|
| 243 | + $href = '?'.$this->pager->_http_build_query_wrapper($this->pager->_linkData); |
|
| 244 | 244 | // Modified by Ivan Tcholakov, 17-OCT-2008. |
| 245 | 245 | //$href = htmlentities($this->pager->_url, ENT_COMPAT, 'UTF-8'). preg_replace( |
| 246 | 246 | // '/(&|&|\?)('.$this->pager->_urlVar.'=)(\d+)/', |
| 247 | 247 | // '\\1\\2'.$selector, |
| 248 | 248 | // htmlentities($href, ENT_COMPAT, 'UTF-8') |
| 249 | - $href = api_htmlentities($this->pager->_url). preg_replace( |
|
| 249 | + $href = api_htmlentities($this->pager->_url).preg_replace( |
|
| 250 | 250 | '/(&|&|\?)('.$this->pager->_urlVar.'=)(\d+)/', |
| 251 | 251 | '\\1\\2'.$selector, |
| 252 | 252 | api_htmlentities($href) |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | } else { |
| 256 | 256 | // Modified by Ivan Tcholakov, 17-OCT-2008. |
| 257 | 257 | //$href = htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName), ENT_COMPAT, 'UTF-8'); |
| 258 | - $href = api_htmlentities($this->pager->_url . str_replace('%d', $selector, $this->pager->_fileName)); |
|
| 258 | + $href = api_htmlentities($this->pager->_url.str_replace('%d', $selector, $this->pager->_fileName)); |
|
| 259 | 259 | // |
| 260 | 260 | } |
| 261 | 261 | $tmp .= ' onchange="javascript: document.location.href=\'' |
| 262 | - . $href .'\'' |
|
| 262 | + . $href.'\'' |
|
| 263 | 263 | . '"'; |
| 264 | 264 | } elseif ($this->pager->_httpMethod == 'POST') { |
| 265 | 265 | $tmp .= " onchange='" |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $start = 1; |
| 277 | 277 | $end = $this->pager->numPages(); |
| 278 | 278 | $selected = $this->pager->getCurrentPageID(); |
| 279 | - for ($i=$start; $i<=$end; $i++) { |
|
| 279 | + for ($i = $start; $i <= $end; $i++) { |
|
| 280 | 280 | $tmp .= '<option value="'.$i.'"'; |
| 281 | 281 | if ($i == $selected) { |
| 282 | 282 | $tmp .= ' selected="selected"'; |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | * |
| 108 | 108 | * @param integer $pageid PageID to get offsets for |
| 109 | 109 | * |
| 110 | - * @return array First and last offsets |
|
| 110 | + * @return integer[] First and last offsets |
|
| 111 | 111 | * @access public |
| 112 | 112 | */ |
| 113 | 113 | function getPageRangeByPageId($pageid = null) |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | $this->range[$i] = false; |
| 235 | 235 | $this->_linkData[$this->_urlVar] = $i; |
| 236 | 236 | $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i) |
| 237 | - . $this->_spacesBefore |
|
| 238 | - . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : ''); |
|
| 237 | + . $this->_spacesBefore |
|
| 238 | + . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : ''); |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | $this->range[$i] = false; |
| 269 | 269 | $this->_linkData[$this->_urlVar] = $i; |
| 270 | 270 | $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i) |
| 271 | - . $this->_spacesBefore |
|
| 272 | - . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : ''); |
|
| 271 | + . $this->_spacesBefore |
|
| 272 | + . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : ''); |
|
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost; |
| 286 | 286 | } |
| 287 | 287 | $links .= $this->_spacesBefore |
| 288 | - . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : ''); |
|
| 288 | + . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : ''); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | return $links; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function getPageRangeByPageId($pageid = null) |
| 114 | 114 | { |
| 115 | - $pageid = isset($pageid) ? (int)$pageid : $this->_currentPage; |
|
| 115 | + $pageid = isset($pageid) ? (int) $pageid : $this->_currentPage; |
|
| 116 | 116 | if (!isset($this->_pageData)) { |
| 117 | 117 | $this->_generatePageData(); |
| 118 | 118 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @return array back/pages/next/first/last/all links |
| 147 | 147 | * @access public |
| 148 | 148 | */ |
| 149 | - function getLinks($pageID = null, $dummy='') |
|
| 149 | + function getLinks($pageID = null, $dummy = '') |
|
| 150 | 150 | { |
| 151 | 151 | if (!is_null($pageID)) { |
| 152 | 152 | $_sav = $this->_currentPage; |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | if ($i == $this->_currentPage) { |
| 253 | 253 | $this->range[$i] = true; |
| 254 | - $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost; |
|
| 254 | + $links .= $this->_curPageSpanPre.$i.$this->_curPageSpanPost; |
|
| 255 | 255 | } else { |
| 256 | 256 | $this->range[$i] = false; |
| 257 | 257 | $this->_linkData[$this->_urlVar] = $i; |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if ($this->_expanded && $expansion_after) { |
| 265 | - $links .= $this->_separator . $this->_spacesAfter; |
|
| 266 | - for ($i = $this->_currentPage + $this->_delta +1; $expansion_after; $expansion_after--, $i++) { |
|
| 265 | + $links .= $this->_separator.$this->_spacesAfter; |
|
| 266 | + for ($i = $this->_currentPage + $this->_delta + 1; $expansion_after; $expansion_after--, $i++) { |
|
| 267 | 267 | $print_separator_flag = ($expansion_after != 1); |
| 268 | 268 | $this->range[$i] = false; |
| 269 | 269 | $this->_linkData[$this->_urlVar] = $i; |
@@ -275,14 +275,14 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | } else { |
| 277 | 277 | //if $this->_totalPages <= (2*Delta+1) show them all |
| 278 | - for ($i=1; $i<=$this->_totalPages; $i++) { |
|
| 278 | + for ($i = 1; $i <= $this->_totalPages; $i++) { |
|
| 279 | 279 | if ($i != $this->_currentPage) { |
| 280 | 280 | $this->range[$i] = false; |
| 281 | 281 | $this->_linkData[$this->_urlVar] = $i; |
| 282 | 282 | $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i); |
| 283 | 283 | } else { |
| 284 | 284 | $this->range[$i] = true; |
| 285 | - $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost; |
|
| 285 | + $links .= $this->_curPageSpanPre.$i.$this->_curPageSpanPost; |
|
| 286 | 286 | } |
| 287 | 287 | $links .= $this->_spacesBefore |
| 288 | 288 | . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : ''); |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, |
| 491 | 491 | * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION. |
| 492 | 492 | * |
| 493 | - * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter |
|
| 493 | + * @param integer|null $options If $mode is PEAR_ERROR_TRIGGER, this parameter |
|
| 494 | 494 | * specifies the PHP-internal error level (one of |
| 495 | 495 | * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). |
| 496 | 496 | * If $mode is PEAR_ERROR_CALLBACK, this |
@@ -581,6 +581,7 @@ discard block |
||
| 581 | 581 | * message, code and userinfo are enough. |
| 582 | 582 | * |
| 583 | 583 | * @param string $message |
| 584 | + * @param integer $code |
|
| 584 | 585 | * |
| 585 | 586 | */ |
| 586 | 587 | function &throwError($message = null, |
@@ -864,7 +865,7 @@ discard block |
||
| 864 | 865 | * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER, |
| 865 | 866 | * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION |
| 866 | 867 | * |
| 867 | - * @param mixed $options (optional) error level, _OR_ in the case of |
|
| 868 | + * @param integer $options (optional) error level, _OR_ in the case of |
|
| 868 | 869 | * PEAR_ERROR_CALLBACK, the callback function or object/method |
| 869 | 870 | * tuple. |
| 870 | 871 | * |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | /**#@+ |
| 27 | 27 | * ERROR constants |
| 28 | 28 | */ |
| 29 | -define('PEAR_ERROR_RETURN', 1); |
|
| 30 | -define('PEAR_ERROR_PRINT', 2); |
|
| 31 | -define('PEAR_ERROR_TRIGGER', 4); |
|
| 32 | -define('PEAR_ERROR_DIE', 8); |
|
| 33 | -define('PEAR_ERROR_CALLBACK', 16); |
|
| 29 | +define('PEAR_ERROR_RETURN', 1); |
|
| 30 | +define('PEAR_ERROR_PRINT', 2); |
|
| 31 | +define('PEAR_ERROR_TRIGGER', 4); |
|
| 32 | +define('PEAR_ERROR_DIE', 8); |
|
| 33 | +define('PEAR_ERROR_CALLBACK', 16); |
|
| 34 | 34 | /** |
| 35 | 35 | * WARNING: obsolete |
| 36 | 36 | * @deprecated |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | if (substr(PHP_OS, 0, 3) == 'WIN') { |
| 44 | 44 | define('OS_WINDOWS', true); |
| 45 | - define('OS_UNIX', false); |
|
| 46 | - define('PEAR_OS', 'Windows'); |
|
| 45 | + define('OS_UNIX', false); |
|
| 46 | + define('PEAR_OS', 'Windows'); |
|
| 47 | 47 | } else { |
| 48 | 48 | define('OS_WINDOWS', false); |
| 49 | - define('OS_UNIX', true); |
|
| 50 | - define('PEAR_OS', 'Unix'); // blatant assumption |
|
| 49 | + define('OS_UNIX', true); |
|
| 50 | + define('PEAR_OS', 'Unix'); // blatant assumption |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; |
@@ -451,9 +451,9 @@ discard block |
||
| 451 | 451 | // $error_code is a non-empty array here; |
| 452 | 452 | // we walk through it trying to unset all |
| 453 | 453 | // values |
| 454 | - foreach($error_code as $key => $error) { |
|
| 454 | + foreach ($error_code as $key => $error) { |
|
| 455 | 455 | if ($this->_checkDelExpect($error)) { |
| 456 | - $deleted = true; |
|
| 456 | + $deleted = true; |
|
| 457 | 457 | } else { |
| 458 | 458 | $deleted = false; |
| 459 | 459 | } |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | */ |
| 987 | 987 | function getMessage() |
| 988 | 988 | { |
| 989 | - return ($this->error_message_prefix . $this->message); |
|
| 989 | + return ($this->error_message_prefix.$this->message); |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | |
@@ -1103,8 +1103,7 @@ discard block |
||
| 1103 | 1103 | if ($this->mode & PEAR_ERROR_CALLBACK) { |
| 1104 | 1104 | if (is_array($this->callback)) { |
| 1105 | 1105 | $callback = (is_object($this->callback[0]) ? |
| 1106 | - strtolower(get_class($this->callback[0])) : |
|
| 1107 | - $this->callback[0]) . '::' . |
|
| 1106 | + strtolower(get_class($this->callback[0])) : $this->callback[0]).'::'. |
|
| 1108 | 1107 | $this->callback[1]; |
| 1109 | 1108 | } else { |
| 1110 | 1109 | $callback = $this->callback; |
@@ -205,17 +205,17 @@ discard block |
||
| 205 | 205 | // {{{ getStaticProperty() |
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | - * If you have a class that's mostly/entirely static, and you need static |
|
| 209 | - * properties, you can use this method to simulate them. Eg. in your method(s) |
|
| 210 | - * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); |
|
| 211 | - * You MUST use a reference, or they will not persist! |
|
| 212 | - * |
|
| 213 | - * @access public |
|
| 214 | - * @param string $class The calling classname, to prevent clashes |
|
| 215 | - * @param string $var The variable to retrieve. |
|
| 216 | - * @return mixed A reference to the variable. If not set it will be |
|
| 217 | - * auto initialised to NULL. |
|
| 218 | - */ |
|
| 208 | + * If you have a class that's mostly/entirely static, and you need static |
|
| 209 | + * properties, you can use this method to simulate them. Eg. in your method(s) |
|
| 210 | + * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); |
|
| 211 | + * You MUST use a reference, or they will not persist! |
|
| 212 | + * |
|
| 213 | + * @access public |
|
| 214 | + * @param string $class The calling classname, to prevent clashes |
|
| 215 | + * @param string $var The variable to retrieve. |
|
| 216 | + * @return mixed A reference to the variable. If not set it will be |
|
| 217 | + * auto initialised to NULL. |
|
| 218 | + */ |
|
| 219 | 219 | function &getStaticProperty($class, $var) |
| 220 | 220 | { |
| 221 | 221 | static $properties; |
@@ -234,14 +234,14 @@ discard block |
||
| 234 | 234 | // {{{ registerShutdownFunc() |
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | - * Use this function to register a shutdown method for static |
|
| 238 | - * classes. |
|
| 239 | - * |
|
| 240 | - * @access public |
|
| 241 | - * @param mixed $func The function name (or array of class/method) to call |
|
| 242 | - * @param mixed $args The arguments to pass to the function |
|
| 243 | - * @return void |
|
| 244 | - */ |
|
| 237 | + * Use this function to register a shutdown method for static |
|
| 238 | + * classes. |
|
| 239 | + * |
|
| 240 | + * @access public |
|
| 241 | + * @param mixed $func The function name (or array of class/method) to call |
|
| 242 | + * @param mixed $args The arguments to pass to the function |
|
| 243 | + * @return void |
|
| 244 | + */ |
|
| 245 | 245 | function registerShutdownFunc($func, $args = array()) |
| 246 | 246 | { |
| 247 | 247 | // if we are called statically, there is a potential |
@@ -513,12 +513,12 @@ discard block |
||
| 513 | 513 | * @since PHP 4.0.5 |
| 514 | 514 | */ |
| 515 | 515 | function &raiseError($message = null, |
| 516 | - $code = null, |
|
| 517 | - $mode = null, |
|
| 518 | - $options = null, |
|
| 519 | - $userinfo = null, |
|
| 520 | - $error_class = null, |
|
| 521 | - $skipmsg = false) |
|
| 516 | + $code = null, |
|
| 517 | + $mode = null, |
|
| 518 | + $options = null, |
|
| 519 | + $userinfo = null, |
|
| 520 | + $error_class = null, |
|
| 521 | + $skipmsg = false) |
|
| 522 | 522 | { |
| 523 | 523 | // The error is yet a PEAR error object |
| 524 | 524 | if (is_object($message)) { |
@@ -584,8 +584,8 @@ discard block |
||
| 584 | 584 | * |
| 585 | 585 | */ |
| 586 | 586 | function &throwError($message = null, |
| 587 | - $code = null, |
|
| 588 | - $userinfo = null) |
|
| 587 | + $code = null, |
|
| 588 | + $userinfo = null) |
|
| 589 | 589 | { |
| 590 | 590 | if (isset($this) && is_a($this, 'PEAR')) { |
| 591 | 591 | $a = &$this->raiseError($message, $code, null, null, $userinfo); |
@@ -707,12 +707,12 @@ discard block |
||
| 707 | 707 | // {{{ popErrorHandling() |
| 708 | 708 | |
| 709 | 709 | /** |
| 710 | - * Pop the last error handler used |
|
| 711 | - * |
|
| 712 | - * @return bool Always true |
|
| 713 | - * |
|
| 714 | - * @see PEAR::pushErrorHandling |
|
| 715 | - */ |
|
| 710 | + * Pop the last error handler used |
|
| 711 | + * |
|
| 712 | + * @return bool Always true |
|
| 713 | + * |
|
| 714 | + * @see PEAR::pushErrorHandling |
|
| 715 | + */ |
|
| 716 | 716 | function popErrorHandling() |
| 717 | 717 | { |
| 718 | 718 | $stack = &$GLOBALS['_PEAR_error_handler_stack']; |
@@ -731,12 +731,12 @@ discard block |
||
| 731 | 731 | // {{{ loadExtension() |
| 732 | 732 | |
| 733 | 733 | /** |
| 734 | - * OS independant PHP extension load. Remember to take care |
|
| 735 | - * on the correct extension name for case sensitive OSes. |
|
| 736 | - * |
|
| 737 | - * @param string $ext The extension name |
|
| 738 | - * @return bool Success or not on the dl() call |
|
| 739 | - */ |
|
| 734 | + * OS independant PHP extension load. Remember to take care |
|
| 735 | + * on the correct extension name for case sensitive OSes. |
|
| 736 | + * |
|
| 737 | + * @param string $ext The extension name |
|
| 738 | + * @return bool Success or not on the dl() call |
|
| 739 | + */ |
|
| 740 | 740 | function loadExtension($ext) |
| 741 | 741 | { |
| 742 | 742 | if (!extension_loaded($ext)) { |
@@ -999,10 +999,10 @@ discard block |
||
| 999 | 999 | * @return int error code |
| 1000 | 1000 | * @access public |
| 1001 | 1001 | */ |
| 1002 | - function getCode() |
|
| 1003 | - { |
|
| 1002 | + function getCode() |
|
| 1003 | + { |
|
| 1004 | 1004 | return $this->code; |
| 1005 | - } |
|
| 1005 | + } |
|
| 1006 | 1006 | |
| 1007 | 1007 | // }}} |
| 1008 | 1008 | // {{{ getType() |
@@ -1110,10 +1110,10 @@ discard block |
||
| 1110 | 1110 | $callback = $this->callback; |
| 1111 | 1111 | } |
| 1112 | 1112 | return sprintf('[%s: message="%s" code=%d mode=callback '. |
| 1113 | - 'callback=%s prefix="%s" info="%s"]', |
|
| 1114 | - strtolower(get_class($this)), $this->message, $this->code, |
|
| 1115 | - $callback, $this->error_message_prefix, |
|
| 1116 | - $this->userinfo); |
|
| 1113 | + 'callback=%s prefix="%s" info="%s"]', |
|
| 1114 | + strtolower(get_class($this)), $this->message, $this->code, |
|
| 1115 | + $callback, $this->error_message_prefix, |
|
| 1116 | + $this->userinfo); |
|
| 1117 | 1117 | } |
| 1118 | 1118 | if ($this->mode & PEAR_ERROR_PRINT) { |
| 1119 | 1119 | $modes[] = 'print'; |
@@ -1128,11 +1128,11 @@ discard block |
||
| 1128 | 1128 | $modes[] = 'return'; |
| 1129 | 1129 | } |
| 1130 | 1130 | return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. |
| 1131 | - 'prefix="%s" info="%s"]', |
|
| 1132 | - strtolower(get_class($this)), $this->message, $this->code, |
|
| 1133 | - implode("|", $modes), $levels[$this->level], |
|
| 1134 | - $this->error_message_prefix, |
|
| 1135 | - $this->userinfo); |
|
| 1131 | + 'prefix="%s" info="%s"]', |
|
| 1132 | + strtolower(get_class($this)), $this->message, $this->code, |
|
| 1133 | + implode("|", $modes), $levels[$this->level], |
|
| 1134 | + $this->error_message_prefix, |
|
| 1135 | + $this->userinfo); |
|
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | // }}} |
@@ -147,6 +147,7 @@ discard block |
||
| 147 | 147 | * the two files do not match, and likewise that the last lines do not |
| 148 | 148 | * match. The caller must trim matching lines from the beginning and end |
| 149 | 149 | * of the portions it is going to specify. |
| 150 | + * @param double $nchunks |
|
| 150 | 151 | */ |
| 151 | 152 | function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) |
| 152 | 153 | { |
@@ -267,6 +268,10 @@ discard block |
||
| 267 | 268 | * |
| 268 | 269 | * Note that XLIM, YLIM are exclusive bounds. All line numbers are |
| 269 | 270 | * origin-0 and discarded lines are not counted. |
| 271 | + * @param integer $xoff |
|
| 272 | + * @param integer $xlim |
|
| 273 | + * @param integer $yoff |
|
| 274 | + * @param integer $ylim |
|
| 270 | 275 | */ |
| 271 | 276 | function _compareseq ($xoff, $xlim, $yoff, $ylim) |
| 272 | 277 | { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * match. The caller must trim matching lines from the beginning and end |
| 149 | 149 | * of the portions it is going to specify. |
| 150 | 150 | */ |
| 151 | - function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) |
|
| 151 | + function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) |
|
| 152 | 152 | { |
| 153 | 153 | $flip = false; |
| 154 | 154 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $this->lcs = 0; |
| 174 | - $this->seq[0]= $yoff - 1; |
|
| 174 | + $this->seq[0] = $yoff - 1; |
|
| 175 | 175 | $this->in_seq = array(); |
| 176 | 176 | $ymids[0] = array(); |
| 177 | 177 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks); |
|
| 187 | + $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $chunk) / $nchunks); |
|
| 188 | 188 | for (; $x < $x1; $x++) { |
| 189 | 189 | $line = $flip ? $this->yv[$x] : $this->xv[$x]; |
| 190 | 190 | if (empty($ymatches[$line])) { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); |
| 221 | 221 | $ymid = $ymids[$this->lcs]; |
| 222 | 222 | for ($n = 0; $n < $nchunks - 1; $n++) { |
| 223 | - $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); |
|
| 223 | + $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $n) / $nchunks); |
|
| 224 | 224 | $y1 = $ymid[$n] + 1; |
| 225 | 225 | $seps[] = $flip ? array($y1, $x1) : array($x1, $y1); |
| 226 | 226 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | $beg = 1; |
| 242 | 242 | while ($beg < $end) { |
| 243 | - $mid = (int)(($beg + $end) / 2); |
|
| 243 | + $mid = (int) (($beg + $end) / 2); |
|
| 244 | 244 | if ($ypos > $this->seq[$mid]) { |
| 245 | 245 | $beg = $mid + 1; |
| 246 | 246 | } else { |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * Note that XLIM, YLIM are exclusive bounds. All line numbers are |
| 269 | 269 | * origin-0 and discarded lines are not counted. |
| 270 | 270 | */ |
| 271 | - function _compareseq ($xoff, $xlim, $yoff, $ylim) |
|
| 271 | + function _compareseq($xoff, $xlim, $yoff, $ylim) |
|
| 272 | 272 | { |
| 273 | 273 | /* Slide down the bottom initial diagonal. */ |
| 274 | 274 | while ($xoff < $xlim && $yoff < $ylim |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | reset($seps); |
| 310 | 310 | $pt1 = $seps[0]; |
| 311 | 311 | while ($pt2 = next($seps)) { |
| 312 | - $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]); |
|
| 312 | + $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]); |
|
| 313 | 313 | $pt1 = $pt2; |
| 314 | 314 | } |
| 315 | 315 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | $j++; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - while ($i < $len && ! $changed[$i]) { |
|
| 355 | + while ($i < $len && !$changed[$i]) { |
|
| 356 | 356 | assert('$j < $other_len && ! $other_changed[$j]'); |
| 357 | 357 | $i++; $j++; |
| 358 | 358 | while ($j < $other_len && $other_changed[$j]) { |
@@ -143,6 +143,12 @@ discard block |
||
| 143 | 143 | return $output . $this->_endDiff(); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | + /** |
|
| 147 | + * @param integer $xbeg |
|
| 148 | + * @param integer $xlen |
|
| 149 | + * @param integer $ybeg |
|
| 150 | + * @param integer $ylen |
|
| 151 | + */ |
|
| 146 | 152 | function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) |
| 147 | 153 | { |
| 148 | 154 | $output = $this->_startBlock($this->_blockHeader($xbeg, $xlen, $ybeg, $ylen)); |
@@ -199,6 +205,9 @@ discard block |
||
| 199 | 205 | return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; |
| 200 | 206 | } |
| 201 | 207 | |
| 208 | + /** |
|
| 209 | + * @param string $header |
|
| 210 | + */ |
|
| 202 | 211 | function _startBlock($header) |
| 203 | 212 | { |
| 204 | 213 | return $header . "\n"; |
@@ -149,21 +149,21 @@ |
||
| 149 | 149 | |
| 150 | 150 | foreach ($edits as $edit) { |
| 151 | 151 | switch (strtolower(get_class($edit))) { |
| 152 | - case 'text_diff_op_copy': |
|
| 153 | - $output .= $this->_context($edit->orig); |
|
| 154 | - break; |
|
| 152 | + case 'text_diff_op_copy': |
|
| 153 | + $output .= $this->_context($edit->orig); |
|
| 154 | + break; |
|
| 155 | 155 | |
| 156 | - case 'text_diff_op_add': |
|
| 157 | - $output .= $this->_added($edit->final); |
|
| 158 | - break; |
|
| 156 | + case 'text_diff_op_add': |
|
| 157 | + $output .= $this->_added($edit->final); |
|
| 158 | + break; |
|
| 159 | 159 | |
| 160 | - case 'text_diff_op_delete': |
|
| 161 | - $output .= $this->_deleted($edit->orig); |
|
| 162 | - break; |
|
| 160 | + case 'text_diff_op_delete': |
|
| 161 | + $output .= $this->_deleted($edit->orig); |
|
| 162 | + break; |
|
| 163 | 163 | |
| 164 | - case 'text_diff_op_change': |
|
| 165 | - $output .= $this->_changed($edit->orig, $edit->final); |
|
| 166 | - break; |
|
| 164 | + case 'text_diff_op_change': |
|
| 165 | + $output .= $this->_changed($edit->orig, $edit->final); |
|
| 166 | + break; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | function Text_Diff_Renderer($params = array()) |
| 39 | 39 | { |
| 40 | 40 | foreach ($params as $param => $value) { |
| 41 | - $v = '_' . $param; |
|
| 41 | + $v = '_'.$param; |
|
| 42 | 42 | if (isset($this->$v)) { |
| 43 | 43 | $this->$v = $value; |
| 44 | 44 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $block); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - return $output . $this->_endDiff(); |
|
| 143 | + return $output.$this->_endDiff(); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - return $output . $this->_endBlock(); |
|
| 170 | + return $output.$this->_endBlock(); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | function _startDiff() |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
| 184 | 184 | { |
| 185 | 185 | if ($xlen > 1) { |
| 186 | - $xbeg .= ',' . ($xbeg + $xlen - 1); |
|
| 186 | + $xbeg .= ','.($xbeg + $xlen - 1); |
|
| 187 | 187 | } |
| 188 | 188 | if ($ylen > 1) { |
| 189 | - $ybeg .= ',' . ($ybeg + $ylen - 1); |
|
| 189 | + $ybeg .= ','.($ybeg + $ylen - 1); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // this matches the GNU Diff behaviour |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | $xbeg--; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; |
|
| 199 | + return $xbeg.($xlen ? ($ylen ? 'c' : 'd') : 'a').$ybeg; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | function _startBlock($header) |
| 203 | 203 | { |
| 204 | - return $header . "\n"; |
|
| 204 | + return $header."\n"; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | function _endBlock() |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | function _lines($lines, $prefix = ' ') |
| 213 | 213 | { |
| 214 | - return $prefix . implode("\n$prefix", $lines) . "\n"; |
|
| 214 | + return $prefix.implode("\n$prefix", $lines)."\n"; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | function _context($lines) |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | function _changed($orig, $final) |
| 233 | 233 | { |
| 234 | - return $this->_deleted($orig) . "---\n" . $this->_added($final); |
|
| 234 | + return $this->_deleted($orig)."---\n".$this->_added($final); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | } |
@@ -1,19 +1,19 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * A class to render Diffs in different formats. |
|
| 4 | - * |
|
| 5 | - * This class renders the diff in classic diff format. It is intended that |
|
| 6 | - * this class be customized via inheritance, to obtain fancier outputs. |
|
| 7 | - * |
|
| 8 | - * $Horde: framework/Text_Diff/Diff/Renderer.php,v 1.5.10.12 2009/07/24 13:26:40 jan Exp $ |
|
| 9 | - * |
|
| 10 | - * Copyright 2004-2009 The Horde Project (http://www.horde.org/) |
|
| 11 | - * |
|
| 12 | - * See the enclosed file COPYING for license information (LGPL). If you did |
|
| 13 | - * not receive this file, see http://opensource.org/licenses/lgpl-license.php. |
|
| 14 | - * |
|
| 15 | - * @package Text_Diff |
|
| 16 | - */ |
|
| 3 | + * A class to render Diffs in different formats. |
|
| 4 | + * |
|
| 5 | + * This class renders the diff in classic diff format. It is intended that |
|
| 6 | + * this class be customized via inheritance, to obtain fancier outputs. |
|
| 7 | + * |
|
| 8 | + * $Horde: framework/Text_Diff/Diff/Renderer.php,v 1.5.10.12 2009/07/24 13:26:40 jan Exp $ |
|
| 9 | + * |
|
| 10 | + * Copyright 2004-2009 The Horde Project (http://www.horde.org/) |
|
| 11 | + * |
|
| 12 | + * See the enclosed file COPYING for license information (LGPL). If you did |
|
| 13 | + * not receive this file, see http://opensource.org/licenses/lgpl-license.php. |
|
| 14 | + * |
|
| 15 | + * @package Text_Diff |
|
| 16 | + */ |
|
| 17 | 17 | class Text_Diff_Renderer { |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | /* @todo */ |
| 106 | 106 | $output .= $this->_block($x0, $ntrail + $xi - $x0, |
| 107 | - $y0, $ntrail + $yi - $y0, |
|
| 108 | - $block); |
|
| 107 | + $y0, $ntrail + $yi - $y0, |
|
| 108 | + $block); |
|
| 109 | 109 | $block = false; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | if (is_array($block)) { |
| 138 | 138 | $output .= $this->_block($x0, $xi - $x0, |
| 139 | - $y0, $yi - $y0, |
|
| 140 | - $block); |
|
| 139 | + $y0, $yi - $y0, |
|
| 140 | + $block); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | return $output . $this->_endDiff(); |
@@ -74,6 +74,9 @@ discard block |
||
| 74 | 74 | return $header; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | + /** |
|
| 78 | + * @param string[] $lines |
|
| 79 | + */ |
|
| 77 | 80 | function _lines($lines, $prefix = ' ', $encode = true) |
| 78 | 81 | { |
| 79 | 82 | if ($encode) { |
@@ -141,6 +144,9 @@ discard block |
||
| 141 | 144 | return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; |
| 142 | 145 | } |
| 143 | 146 | |
| 147 | + /** |
|
| 148 | + * @param string $string |
|
| 149 | + */ |
|
| 144 | 150 | function _splitOnWords($string, $newlineEscape = "\n") |
| 145 | 151 | { |
| 146 | 152 | // Ignore \0; otherwise the while loop will never finish. |
@@ -129,13 +129,13 @@ |
||
| 129 | 129 | * preserve whitespace as well. Therefore we split on words, |
| 130 | 130 | * but include all blocks of whitespace in the wordlist. */ |
| 131 | 131 | $diff = new Text_Diff('native', |
| 132 | - array($this->_splitOnWords($text1, $nl), |
|
| 132 | + array($this->_splitOnWords($text1, $nl), |
|
| 133 | 133 | $this->_splitOnWords($text2, $nl))); |
| 134 | 134 | |
| 135 | 135 | /* Get the diff in inline format. */ |
| 136 | 136 | $renderer = new Text_Diff_Renderer_inline |
| 137 | 137 | (array_merge($this->getParams(), |
| 138 | - array('split_level' => 'words'))); |
|
| 138 | + array('split_level' => 'words'))); |
|
| 139 | 139 | |
| 140 | 140 | /* Run the diff and get the output. */ |
| 141 | 141 | return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | if ($this->_split_level == 'words') { |
| 84 | 84 | return implode('', $lines); |
| 85 | 85 | } else { |
| 86 | - return implode("\n", $lines) . "\n"; |
|
| 86 | + return implode("\n", $lines)."\n"; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | function _added($lines) |
| 91 | 91 | { |
| 92 | 92 | array_walk($lines, array(&$this, '_encode')); |
| 93 | - $lines[0] = $this->_ins_prefix . $lines[0]; |
|
| 93 | + $lines[0] = $this->_ins_prefix.$lines[0]; |
|
| 94 | 94 | $lines[count($lines) - 1] .= $this->_ins_suffix; |
| 95 | 95 | return $this->_lines($lines, ' ', false); |
| 96 | 96 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | function _deleted($lines, $words = false) |
| 99 | 99 | { |
| 100 | 100 | array_walk($lines, array(&$this, '_encode')); |
| 101 | - $lines[0] = $this->_del_prefix . $lines[0]; |
|
| 101 | + $lines[0] = $this->_del_prefix.$lines[0]; |
|
| 102 | 102 | $lines[count($lines) - 1] .= $this->_del_suffix; |
| 103 | 103 | return $this->_lines($lines, ' ', false); |
| 104 | 104 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $orig[0] = substr($orig[0], 1); |
| 117 | 117 | $final[0] = substr($final[0], 1); |
| 118 | 118 | } |
| 119 | - return $prefix . $this->_deleted($orig) . $this->_added($final); |
|
| 119 | + return $prefix.$this->_deleted($orig).$this->_added($final); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $text1 = implode("\n", $orig); |
@@ -133,12 +133,11 @@ discard block |
||
| 133 | 133 | $this->_splitOnWords($text2, $nl))); |
| 134 | 134 | |
| 135 | 135 | /* Get the diff in inline format. */ |
| 136 | - $renderer = new Text_Diff_Renderer_inline |
|
| 137 | - (array_merge($this->getParams(), |
|
| 136 | + $renderer = new Text_Diff_Renderer_inline(array_merge($this->getParams(), |
|
| 138 | 137 | array('split_level' => 'words'))); |
| 139 | 138 | |
| 140 | 139 | /* Run the diff and get the output. */ |
| 141 | - return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; |
|
| 140 | + return str_replace($nl, "\n", $renderer->render($diff))."\n"; |
|
| 142 | 141 | } |
| 143 | 142 | |
| 144 | 143 | function _splitOnWords($string, $newlineEscape = "\n") |
@@ -180,6 +180,7 @@ discard block |
||
| 180 | 180 | * @access private |
| 181 | 181 | * @param string Login |
| 182 | 182 | * @param integer Key |
| 183 | + * @param integer $key |
|
| 183 | 184 | * @return string |
| 184 | 185 | */ |
| 185 | 186 | function _xor($login, $key) |
@@ -208,6 +209,7 @@ discard block |
||
| 208 | 209 | * @access private |
| 209 | 210 | * @param string Login |
| 210 | 211 | * @param integer Key |
| 212 | + * @param integer $key |
|
| 211 | 213 | * @return string |
| 212 | 214 | */ |
| 213 | 215 | function _rotx($login, $key) |
@@ -241,6 +243,7 @@ discard block |
||
| 241 | 243 | * @access private |
| 242 | 244 | * @param string Login |
| 243 | 245 | * @param integer Key |
| 246 | + * @param integer $key |
|
| 244 | 247 | * @return string |
| 245 | 248 | */ |
| 246 | 249 | function _rotxpp($login, $key) |
@@ -274,6 +277,7 @@ discard block |
||
| 274 | 277 | * @access private |
| 275 | 278 | * @param string Login |
| 276 | 279 | * @param integer Key |
| 280 | + * @param integer $key |
|
| 277 | 281 | * @return string |
| 278 | 282 | */ |
| 279 | 283 | function _rotxmm($login, $key) |
@@ -306,6 +310,7 @@ discard block |
||
| 306 | 310 | * @access private |
| 307 | 311 | * @param string Login |
| 308 | 312 | * @param integer Key |
| 313 | + * @param integer $key |
|
| 309 | 314 | * @return string |
| 310 | 315 | */ |
| 311 | 316 | function _asciiRotx($login, $key) |
@@ -340,6 +345,7 @@ discard block |
||
| 340 | 345 | * @access private |
| 341 | 346 | * @param string Login |
| 342 | 347 | * @param integer Key |
| 348 | + * @param integer $key |
|
| 343 | 349 | * @return string |
| 344 | 350 | */ |
| 345 | 351 | function _asciiRotxpp($login, $key) |
@@ -374,6 +380,7 @@ discard block |
||
| 374 | 380 | * @access private |
| 375 | 381 | * @param string Login |
| 376 | 382 | * @param integer Key |
| 383 | + * @param integer $key |
|
| 377 | 384 | * @return string |
| 378 | 385 | */ |
| 379 | 386 | function _asciiRotxmm($login, $key) |
@@ -430,6 +437,7 @@ discard block |
||
| 430 | 437 | * |
| 431 | 438 | * @access private |
| 432 | 439 | * @param integer Length of the password |
| 440 | + * @param integer $length |
|
| 433 | 441 | * @return string Returns the password |
| 434 | 442 | */ |
| 435 | 443 | function _createPronounceable($length) |
@@ -475,6 +483,8 @@ discard block |
||
| 475 | 483 | * @param string Character which could be use in the |
| 476 | 484 | * unpronounceable password ex : 'ABCDEFG' |
| 477 | 485 | * or numeric, alphabetical or alphanumeric. |
| 486 | + * @param integer $length |
|
| 487 | + * @param string $chars |
|
| 478 | 488 | * @return string Returns the password |
| 479 | 489 | */ |
| 480 | 490 | function _createUnpronounceable($length, $chars) |
@@ -441,17 +441,17 @@ discard block |
||
| 441 | 441 | * List of vowels and vowel sounds |
| 442 | 442 | */ |
| 443 | 443 | $v = array('a', 'e', 'i', 'o', 'u', 'ae', 'ou', 'io', |
| 444 | - 'ea', 'ou', 'ia', 'ai' |
|
| 445 | - ); |
|
| 444 | + 'ea', 'ou', 'ia', 'ai' |
|
| 445 | + ); |
|
| 446 | 446 | |
| 447 | 447 | /** |
| 448 | 448 | * List of consonants and consonant sounds |
| 449 | 449 | */ |
| 450 | 450 | $c = array('b', 'c', 'd', 'g', 'h', 'j', 'k', 'l', 'm', |
| 451 | - 'n', 'p', 'r', 's', 't', 'u', 'v', 'w', |
|
| 452 | - 'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th', |
|
| 453 | - 'ch', 'ph', 'st', 'sl', 'cl' |
|
| 454 | - ); |
|
| 451 | + 'n', 'p', 'r', 's', 't', 'u', 'v', 'w', |
|
| 452 | + 'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th', |
|
| 453 | + 'ch', 'ph', 'st', 'sl', 'cl' |
|
| 454 | + ); |
|
| 455 | 455 | |
| 456 | 456 | $v_count = 12; |
| 457 | 457 | $c_count = 29; |
@@ -484,50 +484,50 @@ discard block |
||
| 484 | 484 | /** |
| 485 | 485 | * List of character which could be use in the password |
| 486 | 486 | */ |
| 487 | - switch($chars) { |
|
| 487 | + switch($chars) { |
|
| 488 | 488 | |
| 489 | - case 'alphanumeric': |
|
| 489 | + case 'alphanumeric': |
|
| 490 | 490 | $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
| 491 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
| 492 | - break; |
|
| 491 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
| 492 | + break; |
|
| 493 | 493 | |
| 494 | - case 'alphabetical': |
|
| 494 | + case 'alphabetical': |
|
| 495 | 495 | $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
| 496 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
| 497 | - break; |
|
| 496 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
| 497 | + break; |
|
| 498 | 498 | |
| 499 | - case 'numeric': |
|
| 499 | + case 'numeric': |
|
| 500 | 500 | $chars = '0123456789'; |
| 501 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
| 502 | - break; |
|
| 501 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
| 502 | + break; |
|
| 503 | 503 | |
| 504 | - case '': |
|
| 504 | + case '': |
|
| 505 | 505 | $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
| 506 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
| 507 | - break; |
|
| 506 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
| 507 | + break; |
|
| 508 | 508 | |
| 509 | - default: |
|
| 509 | + default: |
|
| 510 | 510 | /** |
| 511 | 511 | * Some characters shouldn't be used |
| 512 | 512 | */ |
| 513 | 513 | $chars = trim($chars); |
| 514 | - $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
| 515 | - |
|
| 516 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - /** |
|
| 520 | - * Generate password |
|
| 521 | - */ |
|
| 522 | - for ($i = 0; $i < $length; $i++) { |
|
| 523 | - $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1); |
|
| 524 | - $password .= $chars{$num}; |
|
| 525 | - } |
|
| 526 | - |
|
| 527 | - /** |
|
| 528 | - * Return password |
|
| 529 | - */ |
|
| 530 | - return $password; |
|
| 514 | + $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
| 515 | + |
|
| 516 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + /** |
|
| 520 | + * Generate password |
|
| 521 | + */ |
|
| 522 | + for ($i = 0; $i < $length; $i++) { |
|
| 523 | + $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1); |
|
| 524 | + $password .= $chars{$num}; |
|
| 525 | + } |
|
| 526 | + |
|
| 527 | + /** |
|
| 528 | + * Return password |
|
| 529 | + */ |
|
| 530 | + return $password; |
|
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | ?> |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | function create($length = 10, $type = 'pronounceable', $chars = '') |
| 56 | 56 | { |
| 57 | 57 | switch ($type) { |
| 58 | - case 'unpronounceable' : |
|
| 59 | - return Text_Password::_createUnpronounceable($length, $chars); |
|
| 58 | + case 'unpronounceable' : |
|
| 59 | + return Text_Password::_createUnpronounceable($length, $chars); |
|
| 60 | 60 | |
| 61 | - case 'pronounceable' : |
|
| 62 | - default : |
|
| 63 | - return Text_Password::_createPronounceable($length); |
|
| 61 | + case 'pronounceable' : |
|
| 62 | + default : |
|
| 63 | + return Text_Password::_createPronounceable($length); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -110,35 +110,35 @@ discard block |
||
| 110 | 110 | function createFromLogin($login, $type, $key = 0) |
| 111 | 111 | { |
| 112 | 112 | switch ($type) { |
| 113 | - case 'reverse': |
|
| 114 | - return strrev($login); |
|
| 113 | + case 'reverse': |
|
| 114 | + return strrev($login); |
|
| 115 | 115 | |
| 116 | - case 'shuffle': |
|
| 117 | - return Text_Password::_shuffle($login); |
|
| 116 | + case 'shuffle': |
|
| 117 | + return Text_Password::_shuffle($login); |
|
| 118 | 118 | |
| 119 | - case 'xor': |
|
| 120 | - return Text_Password::_xor($login, $key); |
|
| 119 | + case 'xor': |
|
| 120 | + return Text_Password::_xor($login, $key); |
|
| 121 | 121 | |
| 122 | - case 'rot13': |
|
| 123 | - return str_rot13($login); |
|
| 122 | + case 'rot13': |
|
| 123 | + return str_rot13($login); |
|
| 124 | 124 | |
| 125 | - case 'rotx': |
|
| 126 | - return Text_Password::_rotx($login, $key); |
|
| 125 | + case 'rotx': |
|
| 126 | + return Text_Password::_rotx($login, $key); |
|
| 127 | 127 | |
| 128 | - case 'rotx++': |
|
| 129 | - return Text_Password::_rotxpp($login, $key); |
|
| 128 | + case 'rotx++': |
|
| 129 | + return Text_Password::_rotxpp($login, $key); |
|
| 130 | 130 | |
| 131 | - case 'rotx--': |
|
| 132 | - return Text_Password::_rotxmm($login, $key); |
|
| 131 | + case 'rotx--': |
|
| 132 | + return Text_Password::_rotxmm($login, $key); |
|
| 133 | 133 | |
| 134 | - case 'ascii_rotx': |
|
| 135 | - return Text_Password::_asciiRotx($login, $key); |
|
| 134 | + case 'ascii_rotx': |
|
| 135 | + return Text_Password::_asciiRotx($login, $key); |
|
| 136 | 136 | |
| 137 | - case 'ascii_rotx++': |
|
| 138 | - return Text_Password::_asciiRotxpp($login, $key); |
|
| 137 | + case 'ascii_rotx++': |
|
| 138 | + return Text_Password::_asciiRotxpp($login, $key); |
|
| 139 | 139 | |
| 140 | - case 'ascii_rotx--': |
|
| 141 | - return Text_Password::_asciiRotxmm($login, $key); |
|
| 140 | + case 'ascii_rotx--': |
|
| 141 | + return Text_Password::_asciiRotxmm($login, $key); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | $next += 255; |
| 321 | 321 | } |
| 322 | 322 | switch ($next) { // delete white space |
| 323 | - case 0x09: |
|
| 324 | - case 0x20: |
|
| 325 | - case 0x0A: |
|
| 326 | - case 0x0D: |
|
| 327 | - $next++; |
|
| 323 | + case 0x09: |
|
| 324 | + case 0x20: |
|
| 325 | + case 0x0A: |
|
| 326 | + case 0x0D: |
|
| 327 | + $next++; |
|
| 328 | 328 | } |
| 329 | 329 | $tmp .= chr($next); |
| 330 | 330 | } |
@@ -354,11 +354,11 @@ discard block |
||
| 354 | 354 | $next += 255; |
| 355 | 355 | } |
| 356 | 356 | switch ($next) { // delete white space |
| 357 | - case 0x09: |
|
| 358 | - case 0x20: |
|
| 359 | - case 0x0A: |
|
| 360 | - case 0x0D: |
|
| 361 | - $next++; |
|
| 357 | + case 0x09: |
|
| 358 | + case 0x20: |
|
| 359 | + case 0x0A: |
|
| 360 | + case 0x0D: |
|
| 361 | + $next++; |
|
| 362 | 362 | } |
| 363 | 363 | $tmp .= chr($next); |
| 364 | 364 | } |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | $next += 255; |
| 389 | 389 | } |
| 390 | 390 | switch ($next) { // delete white space |
| 391 | - case 0x09: |
|
| 392 | - case 0x20: |
|
| 393 | - case 0x0A: |
|
| 394 | - case 0x0D: |
|
| 395 | - $next++; |
|
| 391 | + case 0x09: |
|
| 392 | + case 0x20: |
|
| 393 | + case 0x0A: |
|
| 394 | + case 0x0D: |
|
| 395 | + $next++; |
|
| 396 | 396 | } |
| 397 | 397 | $tmp .= chr($next); |
| 398 | 398 | } |
@@ -486,34 +486,34 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | switch($chars) { |
| 488 | 488 | |
| 489 | - case 'alphanumeric': |
|
| 490 | - $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 491 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
| 492 | - break; |
|
| 489 | + case 'alphanumeric': |
|
| 490 | + $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 491 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
| 492 | + break; |
|
| 493 | 493 | |
| 494 | - case 'alphabetical': |
|
| 495 | - $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
|
| 496 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
| 497 | - break; |
|
| 494 | + case 'alphabetical': |
|
| 495 | + $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
|
| 496 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
| 497 | + break; |
|
| 498 | 498 | |
| 499 | - case 'numeric': |
|
| 500 | - $chars = '0123456789'; |
|
| 501 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
| 502 | - break; |
|
| 499 | + case 'numeric': |
|
| 500 | + $chars = '0123456789'; |
|
| 501 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
| 502 | + break; |
|
| 503 | 503 | |
| 504 | - case '': |
|
| 505 | - $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 506 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
| 507 | - break; |
|
| 504 | + case '': |
|
| 505 | + $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
|
| 506 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
| 507 | + break; |
|
| 508 | 508 | |
| 509 | - default: |
|
| 510 | - /** |
|
| 509 | + default: |
|
| 510 | + /** |
|
| 511 | 511 | * Some characters shouldn't be used |
| 512 | 512 | */ |
| 513 | - $chars = trim($chars); |
|
| 514 | - $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
| 513 | + $chars = trim($chars); |
|
| 514 | + $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
| 515 | 515 | |
| 516 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
| 516 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /** |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = $v_count + $c_count; |
| 460 | 460 | |
| 461 | 461 | for ($i = 0; $i < $length; $i++) { |
| 462 | - $retVal .= $c[mt_rand(0, $c_count-1)] . $v[mt_rand(0, $v_count-1)]; |
|
| 462 | + $retVal .= $c[mt_rand(0, $c_count - 1)].$v[mt_rand(0, $v_count - 1)]; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return substr($retVal, 0, $length); |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | /** |
| 485 | 485 | * List of character which could be use in the password |
| 486 | 486 | */ |
| 487 | - switch($chars) { |
|
| 487 | + switch ($chars) { |
|
| 488 | 488 | |
| 489 | 489 | case 'alphanumeric': |
| 490 | 490 | $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | * Setup db connection. |
| 116 | 116 | * Based on defined options, this method connects to db defined in {@link $dsn} |
| 117 | 117 | * and creates a {@link $table} table if {@link $createTable} is true. |
| 118 | - * @return boolean true if all ok. |
|
| 118 | + * @return boolean|null true if all ok. |
|
| 119 | 119 | */ |
| 120 | 120 | function activateOptions() |
| 121 | 121 | { |
@@ -121,10 +121,10 @@ |
||
| 121 | 121 | { |
| 122 | 122 | $this->db = &ADONewConnection($this->type); |
| 123 | 123 | if (! $this->db->PConnect($this->host, $this->user, $this->password, $this->database)) { |
| 124 | - $this->db = null; |
|
| 125 | - $this->closed = true; |
|
| 126 | - $this->canAppend = false; |
|
| 127 | - return; |
|
| 124 | + $this->db = null; |
|
| 125 | + $this->closed = true; |
|
| 126 | + $this->canAppend = false; |
|
| 127 | + return; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $this->layout = LoggerReflectionUtils::createObject('LoggerLayoutPattern'); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | /** A docblok to make phpdoc happy */ |
| 22 | -require_once(ADODB_DIR . '/adodb.inc.php'); |
|
| 22 | +require_once(ADODB_DIR.'/adodb.inc.php'); |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Appends log events to a db table using adodb class. |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | function activateOptions() |
| 121 | 121 | { |
| 122 | 122 | $this->db = &ADONewConnection($this->type); |
| 123 | - if (! $this->db->PConnect($this->host, $this->user, $this->password, $this->database)) { |
|
| 123 | + if (!$this->db->PConnect($this->host, $this->user, $this->password, $this->database)) { |
|
| 124 | 124 | $this->db = null; |
| 125 | 125 | $this->closed = true; |
| 126 | 126 | $this->canAppend = false; |
@@ -131,14 +131,14 @@ discard block |
||
| 131 | 131 | $this->layout->setConversionPattern($this->getSql()); |
| 132 | 132 | |
| 133 | 133 | // test if log table exists |
| 134 | - $sql = 'select * from ' . $this->table . ' where 1 = 0'; |
|
| 134 | + $sql = 'select * from '.$this->table.' where 1 = 0'; |
|
| 135 | 135 | $dbrs = $this->db->Execute($sql); |
| 136 | 136 | if ($dbrs == false and $this->getCreateTable()) { |
| 137 | 137 | $query = "CREATE TABLE {$this->table} (timestamp varchar(32),logger varchar(32),level varchar(32),message varchar(64),thread varchar(32),file varchar(64),line varchar(4) );"; |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | $result = $this->db->Execute($query); |
| 141 | - if (! $result) { |
|
| 141 | + if (!$result) { |
|
| 142 | 142 | $this->canAppend = false; |
| 143 | 143 | return; |
| 144 | 144 | } |
@@ -155,8 +155,9 @@ |
||
| 155 | 155 | |
| 156 | 156 | function close() |
| 157 | 157 | { |
| 158 | - if ($this->db !== null) |
|
| 159 | - $this->db->Close(); |
|
| 158 | + if ($this->db !== null) { |
|
| 159 | + $this->db->Close(); |
|
| 160 | + } |
|
| 160 | 161 | $this->closed = true; |
| 161 | 162 | } |
| 162 | 163 | |