@@ -54,6 +54,8 @@ |
||
| 54 | 54 | * @param string Input field name attribute |
| 55 | 55 | * @param mixed Label(s) for a field |
| 56 | 56 | * @param mixed Either a typical HTML attribute string or an associative array |
| 57 | + * @param string $elementName |
|
| 58 | + * @param string $elementLabel |
|
| 57 | 59 | * @since 1.0 |
| 58 | 60 | * @access public |
| 59 | 61 | * @return void |
@@ -194,13 +194,13 @@ |
||
| 194 | 194 | return $this->getFrozenHtml(); |
| 195 | 195 | } else { |
| 196 | 196 | return $this->_getTabs() . |
| 197 | - '<textarea' . $this->_getAttrString($this->_attributes) . '>' . |
|
| 198 | - // because we wrap the form later we don't want the text indented |
|
| 199 | - // Modified by Ivan Tcholakov, 16-MAR-2010. |
|
| 200 | - //preg_replace("/(\r\n|\n|\r)/", '
', htmlspecialchars($this->_value)) . |
|
| 201 | - preg_replace("/(\r\n|\n|\r)/", '
', @htmlspecialchars($this->_value, ENT_COMPAT, HTML_Common::charset())) . |
|
| 202 | - // |
|
| 203 | - '</textarea>'; |
|
| 197 | + '<textarea' . $this->_getAttrString($this->_attributes) . '>' . |
|
| 198 | + // because we wrap the form later we don't want the text indented |
|
| 199 | + // Modified by Ivan Tcholakov, 16-MAR-2010. |
|
| 200 | + //preg_replace("/(\r\n|\n|\r)/", '
', htmlspecialchars($this->_value)) . |
|
| 201 | + preg_replace("/(\r\n|\n|\r)/", '
', @htmlspecialchars($this->_value, ENT_COMPAT, HTML_Common::charset())) . |
|
| 202 | + // |
|
| 203 | + '</textarea>'; |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @access public |
| 59 | 59 | * @return void |
| 60 | 60 | */ |
| 61 | - public function __construct($elementName=null, $elementLabel=null, $attributes=null) |
|
| 61 | + public function __construct($elementName = null, $elementLabel = null, $attributes = null) |
|
| 62 | 62 | { |
| 63 | 63 | $attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'form-control'; |
| 64 | 64 | $columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null; |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | if ($this->_flagFrozen) { |
| 194 | 194 | return $this->getFrozenHtml(); |
| 195 | 195 | } else { |
| 196 | - return $this->_getTabs() . |
|
| 197 | - '<textarea' . $this->_getAttrString($this->_attributes) . '>' . |
|
| 196 | + return $this->_getTabs(). |
|
| 197 | + '<textarea'.$this->_getAttrString($this->_attributes).'>'. |
|
| 198 | 198 | // because we wrap the form later we don't want the text indented |
| 199 | 199 | // Modified by Ivan Tcholakov, 16-MAR-2010. |
| 200 | 200 | //preg_replace("/(\r\n|\n|\r)/", '
', htmlspecialchars($this->_value)) . |
| 201 | - preg_replace("/(\r\n|\n|\r)/", '
', @htmlspecialchars($this->_value, ENT_COMPAT, HTML_Common::charset())) . |
|
| 201 | + preg_replace("/(\r\n|\n|\r)/", '
', @htmlspecialchars($this->_value, ENT_COMPAT, HTML_Common::charset())). |
|
| 202 | 202 | // |
| 203 | 203 | '</textarea>'; |
| 204 | 204 | } |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | $value = @htmlspecialchars($this->getValue(), ENT_COMPAT, HTML_Common::charset()); |
| 219 | 219 | // |
| 220 | 220 | if ($this->getAttribute('wrap') == 'off') { |
| 221 | - $html = $this->_getTabs() . '<pre>' . $value."</pre>\n"; |
|
| 221 | + $html = $this->_getTabs().'<pre>'.$value."</pre>\n"; |
|
| 222 | 222 | } else { |
| 223 | 223 | $html = nl2br($value)."\n"; |
| 224 | 224 | } |
| 225 | - return $html . $this->_getPersistantData(); |
|
| 225 | + return $html.$this->_getPersistantData(); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | * Adds a table row and returns the row identifier |
| 666 | 666 | * @param array $contents (optional) Must be a indexed array of |
| 667 | 667 | * valid cell contents |
| 668 | - * @param mixed $attributes (optional) Associative array or string |
|
| 668 | + * @param string $attributes (optional) Associative array or string |
|
| 669 | 669 | * of table row attributes. This can also |
| 670 | 670 | * be an array of attributes, in which |
| 671 | 671 | * case the attributes will be repeated |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | /** |
| 720 | 720 | * Updates the row attributes for an existing row |
| 721 | 721 | * @param int $row Row index |
| 722 | - * @param mixed $attributes Associative array or string of table row |
|
| 722 | + * @param string $attributes Associative array or string of table row |
|
| 723 | 723 | * attributes |
| 724 | 724 | * @param bool $inTR false if attributes are to be applied in |
| 725 | 725 | * TD tags; true if attributes are to be |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | function HTML_Table($attributes = null, $tabOffset = 0, $useTGroups = false) |
| 166 | 166 | { |
| 167 | - parent::__construct($attributes, (int)$tabOffset); |
|
| 168 | - $this->_useTGroups = (boolean)$useTGroups; |
|
| 167 | + parent::__construct($attributes, (int) $tabOffset); |
|
| 168 | + $this->_useTGroups = (boolean) $useTGroups; |
|
| 169 | 169 | $this->addBody(); |
| 170 | 170 | if ($this->_useTGroups) { |
| 171 | 171 | $this->_thead = new HTML_Table_Storage($tabOffset, $this->_useTGroups); |
@@ -272,12 +272,12 @@ discard block |
||
| 272 | 272 | function _adjustTbodyCount($body, $method) |
| 273 | 273 | { |
| 274 | 274 | if ($this->_autoGrow) { |
| 275 | - while ($this->_tbodyCount <= (int)$body) { |
|
| 275 | + while ($this->_tbodyCount <= (int) $body) { |
|
| 276 | 276 | $this->addBody(); |
| 277 | 277 | } |
| 278 | 278 | } else { |
| 279 | - return PEAR::raiseError('Invalid body reference[' . |
|
| 280 | - $body . '] in HTML_Table::' . $method); |
|
| 279 | + return PEAR::raiseError('Invalid body reference['. |
|
| 280 | + $body.'] in HTML_Table::'.$method); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
@@ -939,26 +939,26 @@ discard block |
||
| 939 | 939 | $tBodyMaxColCount = max($tBodyColCounts); |
| 940 | 940 | } |
| 941 | 941 | if ($this->_comment) { |
| 942 | - $strHtml .= $tabs . "<!-- $this->_comment -->" . $lnEnd; |
|
| 942 | + $strHtml .= $tabs."<!-- $this->_comment -->".$lnEnd; |
|
| 943 | 943 | } |
| 944 | 944 | if ($this->getRowCount() > 0 && $tBodyMaxColCount > 0) { |
| 945 | 945 | $strHtml .= |
| 946 | - $tabs . '<table' . $this->_getAttrString($this->_attributes) . '>' . $lnEnd; |
|
| 946 | + $tabs.'<table'.$this->_getAttrString($this->_attributes).'>'.$lnEnd; |
|
| 947 | 947 | if (!empty($this->_caption)) { |
| 948 | 948 | $attr = $this->_caption['attr']; |
| 949 | 949 | $contents = $this->_caption['contents']; |
| 950 | - $strHtml .= $tabs . $tab . '<caption' . $this->_getAttrString($attr) . '>'; |
|
| 950 | + $strHtml .= $tabs.$tab.'<caption'.$this->_getAttrString($attr).'>'; |
|
| 951 | 951 | if (is_array($contents)) { |
| 952 | 952 | $contents = implode(', ', $contents); |
| 953 | 953 | } |
| 954 | 954 | $strHtml .= $contents; |
| 955 | - $strHtml .= '</caption>' . $lnEnd; |
|
| 955 | + $strHtml .= '</caption>'.$lnEnd; |
|
| 956 | 956 | } |
| 957 | 957 | if (!empty($this->_colgroup)) { |
| 958 | 958 | foreach ($this->_colgroup as $g => $col) { |
| 959 | 959 | $attr = $this->_colgroup[$g]['attr']; |
| 960 | 960 | $contents = $this->_colgroup[$g]['contents']; |
| 961 | - $strHtml .= $tabs . $tab . '<colgroup' . $this->_getAttrString($attr) . '>'; |
|
| 961 | + $strHtml .= $tabs.$tab.'<colgroup'.$this->_getAttrString($attr).'>'; |
|
| 962 | 962 | if (!empty($contents)) { |
| 963 | 963 | $strHtml .= $lnEnd; |
| 964 | 964 | if (!is_array($contents)) { |
@@ -966,11 +966,11 @@ discard block |
||
| 966 | 966 | } |
| 967 | 967 | foreach ($contents as $a => $colAttr) { |
| 968 | 968 | $attr = $this->_parseAttributes($colAttr); |
| 969 | - $strHtml .= $tabs . $tab . $tab . '<col' . $this->_getAttrString($attr) . ' />' . $lnEnd; |
|
| 969 | + $strHtml .= $tabs.$tab.$tab.'<col'.$this->_getAttrString($attr).' />'.$lnEnd; |
|
| 970 | 970 | } |
| 971 | - $strHtml .= $tabs . $tab; |
|
| 971 | + $strHtml .= $tabs.$tab; |
|
| 972 | 972 | } |
| 973 | - $strHtml .= '</colgroup>' . $lnEnd; |
|
| 973 | + $strHtml .= '</colgroup>'.$lnEnd; |
|
| 974 | 974 | } |
| 975 | 975 | } |
| 976 | 976 | if ($this->_useTGroups) { |
@@ -986,31 +986,31 @@ discard block |
||
| 986 | 986 | if ($this->_thead !== null) { |
| 987 | 987 | $this->_thead->setColCount($maxColCount); |
| 988 | 988 | if ($this->_thead->getRowCount() > 0) { |
| 989 | - $strHtml .= $tabs . $tab . '<thead' . |
|
| 990 | - $this->_getAttrString($this->_thead->_attributes) . |
|
| 991 | - '>' . $lnEnd; |
|
| 989 | + $strHtml .= $tabs.$tab.'<thead'. |
|
| 990 | + $this->_getAttrString($this->_thead->_attributes). |
|
| 991 | + '>'.$lnEnd; |
|
| 992 | 992 | $strHtml .= $this->_thead->toHtml($tabs, $tab); |
| 993 | - $strHtml .= $tabs . $tab . '</thead>' . $lnEnd; |
|
| 993 | + $strHtml .= $tabs.$tab.'</thead>'.$lnEnd; |
|
| 994 | 994 | } |
| 995 | 995 | } |
| 996 | 996 | if ($this->_tfoot !== null) { |
| 997 | 997 | $this->_tfoot->setColCount($maxColCount); |
| 998 | 998 | if ($this->_tfoot->getRowCount() > 0) { |
| 999 | - $strHtml .= $tabs . $tab . '<tfoot' . |
|
| 1000 | - $this->_getAttrString($this->_tfoot->_attributes) . |
|
| 1001 | - '>' . $lnEnd; |
|
| 999 | + $strHtml .= $tabs.$tab.'<tfoot'. |
|
| 1000 | + $this->_getAttrString($this->_tfoot->_attributes). |
|
| 1001 | + '>'.$lnEnd; |
|
| 1002 | 1002 | $strHtml .= $this->_tfoot->toHtml($tabs, $tab); |
| 1003 | - $strHtml .= $tabs . $tab . '</tfoot>' . $lnEnd; |
|
| 1003 | + $strHtml .= $tabs.$tab.'</tfoot>'.$lnEnd; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | 1006 | for ($i = 0; $i < $this->_tbodyCount; $i++) { |
| 1007 | 1007 | $this->_tbodies[$i]->setColCount($maxColCount); |
| 1008 | 1008 | if ($this->_tbodies[$i]->getRowCount() > 0) { |
| 1009 | - $strHtml .= $tabs . $tab . '<tbody' . |
|
| 1010 | - $this->_getAttrString($this->_tbodies[$i]->_attributes) . |
|
| 1011 | - '>' . $lnEnd; |
|
| 1009 | + $strHtml .= $tabs.$tab.'<tbody'. |
|
| 1010 | + $this->_getAttrString($this->_tbodies[$i]->_attributes). |
|
| 1011 | + '>'.$lnEnd; |
|
| 1012 | 1012 | $strHtml .= $this->_tbodies[$i]->toHtml($tabs, $tab); |
| 1013 | - $strHtml .= $tabs . $tab . '</tbody>' . $lnEnd; |
|
| 1013 | + $strHtml .= $tabs.$tab.'</tbody>'.$lnEnd; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | 1016 | } else { |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | $strHtml .= $this->_tbodies[$i]->toHtml($tabs, $tab); |
| 1020 | 1020 | } |
| 1021 | 1021 | } |
| 1022 | - $strHtml .= $tabs . '</table>' . $lnEnd; |
|
| 1022 | + $strHtml .= $tabs.'</table>'.$lnEnd; |
|
| 1023 | 1023 | } |
| 1024 | 1024 | return $strHtml; |
| 1025 | 1025 | } |
@@ -48,7 +48,6 @@ discard block |
||
| 48 | 48 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 49 | 49 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 50 | 50 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | - |
|
| 52 | 51 | * |
| 53 | 52 | * @category HTML |
| 54 | 53 | * @package HTML_Table |
@@ -256,7 +255,7 @@ discard block |
||
| 256 | 255 | |
| 257 | 256 | $body = $this->_tbodyCount++; |
| 258 | 257 | $this->_tbodies[$body] = new HTML_Table_Storage($this->_tabOffset, |
| 259 | - $this->_useTGroups); |
|
| 258 | + $this->_useTGroups); |
|
| 260 | 259 | $this->_tbodies[$body]->setAutoFill($this->_autoFill); |
| 261 | 260 | $this->_tbodies[$body]->setAttributes($attributes); |
| 262 | 261 | return $body; |
@@ -308,7 +307,7 @@ discard block |
||
| 308 | 307 | if (isset($colgroup)) { |
| 309 | 308 | $attributes = $this->_parseAttributes($attributes); |
| 310 | 309 | $this->_colgroup[] = array('attr' => $attributes, |
| 311 | - 'contents' => $colgroup); |
|
| 310 | + 'contents' => $colgroup); |
|
| 312 | 311 | } else { |
| 313 | 312 | $this->_colgroup = array(); |
| 314 | 313 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * Returns the autoFill value |
| 167 | 167 | * @access public |
| 168 | - * @return mixed |
|
| 168 | + * @return string |
|
| 169 | 169 | */ |
| 170 | 170 | function getAutoFill() |
| 171 | 171 | { |
@@ -174,7 +174,6 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Sets the autoGrow value |
| 177 | - * @param bool $fill |
|
| 178 | 177 | * @access public |
| 179 | 178 | */ |
| 180 | 179 | function setAutoGrow($grow) |
@@ -185,7 +184,7 @@ discard block |
||
| 185 | 184 | /** |
| 186 | 185 | * Returns the autoGrow value |
| 187 | 186 | * @access public |
| 188 | - * @return mixed |
|
| 187 | + * @return boolean |
|
| 189 | 188 | */ |
| 190 | 189 | function getAutoGrow() |
| 191 | 190 | { |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | function HTML_Table_Storage($tabOffset = 0, $useTGroups = false) |
| 130 | 130 | { |
| 131 | - parent::__construct(null, (int)$tabOffset); |
|
| 132 | - $this->_useTGroups = (boolean)$useTGroups; |
|
| 131 | + parent::__construct(null, (int) $tabOffset); |
|
| 132 | + $this->_useTGroups = (boolean) $useTGroups; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | function setCellAttributes($row, $col, $attributes) |
| 290 | 290 | { |
| 291 | - if ( isset($this->_structure[$row][$col]) |
|
| 291 | + if (isset($this->_structure[$row][$col]) |
|
| 292 | 292 | && $this->_structure[$row][$col] == '__SPANNED__' |
| 293 | 293 | ) { |
| 294 | 294 | return; |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | function updateCellAttributes($row, $col, $attributes) |
| 316 | 316 | { |
| 317 | - if ( isset($this->_structure[$row][$col]) |
|
| 317 | + if (isset($this->_structure[$row][$col]) |
|
| 318 | 318 | && $this->_structure[$row][$col] == '__SPANNED__' |
| 319 | 319 | ) { |
| 320 | 320 | return; |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | function getCellAttributes($row, $col) |
| 339 | 339 | { |
| 340 | - if ( isset($this->_structure[$row][$col]) |
|
| 340 | + if (isset($this->_structure[$row][$col]) |
|
| 341 | 341 | && $this->_structure[$row][$col] != '__SPANNED__' |
| 342 | 342 | ) { |
| 343 | 343 | return $this->_structure[$row][$col]['attr']; |
| 344 | 344 | } elseif (!isset($this->_structure[$row][$col])) { |
| 345 | - return PEAR::raiseError('Invalid table cell reference[' . |
|
| 346 | - $row . '][' . $col . '] in HTML_Table::getCellAttributes'); |
|
| 345 | + return PEAR::raiseError('Invalid table cell reference['. |
|
| 346 | + $row.']['.$col.'] in HTML_Table::getCellAttributes'); |
|
| 347 | 347 | } |
| 348 | 348 | return; |
| 349 | 349 | } |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | function _setSingleCellContents($row, $col, $contents, $type = 'TD') |
| 407 | 407 | { |
| 408 | - if ( isset($this->_structure[$row][$col]) |
|
| 408 | + if (isset($this->_structure[$row][$col]) |
|
| 409 | 409 | && $this->_structure[$row][$col] == '__SPANNED__' |
| 410 | 410 | ) { |
| 411 | 411 | return; |
@@ -427,14 +427,14 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | function getCellContents($row, $col) |
| 429 | 429 | { |
| 430 | - if ( isset($this->_structure[$row][$col]) |
|
| 430 | + if (isset($this->_structure[$row][$col]) |
|
| 431 | 431 | && $this->_structure[$row][$col] == '__SPANNED__' |
| 432 | 432 | ) { |
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | if (!isset($this->_structure[$row][$col])) { |
| 436 | - return PEAR::raiseError('Invalid table cell reference[' . |
|
| 437 | - $row . '][' . $col . '] in HTML_Table::getCellContents'); |
|
| 436 | + return PEAR::raiseError('Invalid table cell reference['. |
|
| 437 | + $row.']['.$col.'] in HTML_Table::getCellContents'); |
|
| 438 | 438 | } |
| 439 | 439 | return $this->_structure[$row][$col]['contents']; |
| 440 | 440 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $inTR = false) |
| 478 | 478 | { |
| 479 | 479 | if (isset($contents) && !is_array($contents)) { |
| 480 | - return PEAR::raiseError('First parameter to HTML_Table::addRow ' . |
|
| 480 | + return PEAR::raiseError('First parameter to HTML_Table::addRow '. |
|
| 481 | 481 | 'must be an array'); |
| 482 | 482 | } |
| 483 | 483 | if (is_null($contents)) { |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | function addCol($contents = null, $attributes = null, $type = 'td') |
| 621 | 621 | { |
| 622 | 622 | if (isset($contents) && !is_array($contents)) { |
| 623 | - return PEAR::raiseError('First parameter to HTML_Table::addCol ' . |
|
| 623 | + return PEAR::raiseError('First parameter to HTML_Table::addCol '. |
|
| 624 | 624 | 'must be an array'); |
| 625 | 625 | } |
| 626 | 626 | if (is_null($contents)) { |
@@ -727,13 +727,13 @@ discard block |
||
| 727 | 727 | $extraTab = ''; |
| 728 | 728 | } |
| 729 | 729 | if ($this->_cols > 0) { |
| 730 | - for ($i = 0 ; $i < $this->_rows ; $i++) { |
|
| 730 | + for ($i = 0; $i < $this->_rows; $i++) { |
|
| 731 | 731 | $attr = ''; |
| 732 | 732 | if (isset($this->_structure[$i]['attr'])) { |
| 733 | 733 | $attr = $this->_getAttrString($this->_structure[$i]['attr']); |
| 734 | 734 | } |
| 735 | - $strHtml .= $tabs .$tab . $extraTab . '<tr'.$attr.'>' . $lnEnd; |
|
| 736 | - for ($j = 0 ; $j < $this->_cols ; $j++) { |
|
| 735 | + $strHtml .= $tabs.$tab.$extraTab.'<tr'.$attr.'>'.$lnEnd; |
|
| 736 | + for ($j = 0; $j < $this->_cols; $j++) { |
|
| 737 | 737 | $attr = ''; |
| 738 | 738 | $contents = ''; |
| 739 | 739 | $type = 'td'; |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | if (is_object($contents)) { |
| 754 | 754 | // changes indent and line end settings on nested tables |
| 755 | 755 | if (is_subclass_of($contents, 'html_common')) { |
| 756 | - $contents->setTab($tab . $extraTab); |
|
| 756 | + $contents->setTab($tab.$extraTab); |
|
| 757 | 757 | $contents->setTabOffset($this->_tabOffset + 3); |
| 758 | 758 | $contents->_nestLevel = $this->_nestLevel + 1; |
| 759 | 759 | $contents->setLineEnd($this->_getLineEnd()); |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | $contents = implode(', ', $contents); |
| 769 | 769 | } |
| 770 | 770 | |
| 771 | - $typeContent = $tabs . $tab . $tab . $extraTab . "<$type" . $this->_getAttrString($attr) . '>'; |
|
| 771 | + $typeContent = $tabs.$tab.$tab.$extraTab."<$type".$this->_getAttrString($attr).'>'; |
|
| 772 | 772 | |
| 773 | 773 | if (empty($contents)) { |
| 774 | 774 | if (isset($this->_autoFill) && $this->_autoFill) { |
@@ -777,14 +777,14 @@ discard block |
||
| 777 | 777 | } else { |
| 778 | 778 | $typeContent .= $contents; |
| 779 | 779 | } |
| 780 | - $typeContent .= "</$type>" . $lnEnd; |
|
| 780 | + $typeContent .= "</$type>".$lnEnd; |
|
| 781 | 781 | |
| 782 | 782 | if (!empty($contents)) { |
| 783 | 783 | $strHtml .= $typeContent; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | } |
| 787 | - $strHtml .= $tabs . $tab . $extraTab . '</tr>' . $lnEnd; |
|
| 787 | + $strHtml .= $tabs.$tab.$extraTab.'</tr>'.$lnEnd; |
|
| 788 | 788 | } |
| 789 | 789 | } |
| 790 | 790 | return $strHtml; |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | * the Image_Text object after changing options. For possible options, please |
| 329 | 329 | * take a look at the class options array! |
| 330 | 330 | * |
| 331 | - * @param array|string $option A single option name or the options array. |
|
| 332 | - * @param mixed $value Option value if $option is string. |
|
| 331 | + * @param string $option A single option name or the options array. |
|
| 332 | + * @param string $value Option value if $option is string. |
|
| 333 | 333 | * |
| 334 | 334 | * @return void |
| 335 | 335 | * @see Image_Text::Image_Text() |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | * @param bool $save Save or not the image on printout. |
| 983 | 983 | * @param bool $free Free the image on exit. |
| 984 | 984 | * |
| 985 | - * @return bool True on success |
|
| 985 | + * @return boolean|null True on success |
|
| 986 | 986 | * @see Image_Text::save() |
| 987 | 987 | * @throws Image_Text_Exception |
| 988 | 988 | */ |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | * @param string $scolor string of colorcode. |
| 1134 | 1134 | * |
| 1135 | 1135 | * @see Image_Text::IMAGE_TEXT_REGEX_HTMLCOLOR |
| 1136 | - * @return bool|array false if string can't be converted to array |
|
| 1136 | + * @return resource false if string can't be converted to array |
|
| 1137 | 1137 | */ |
| 1138 | 1138 | public static function convertString2RGB($scolor) |
| 1139 | 1139 | { |
@@ -346,19 +346,19 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | foreach ($option as $opt => $val) { |
| 348 | 348 | switch ($opt) { |
| 349 | - case 'color': |
|
| 350 | - $this->setColors($val); |
|
| 351 | - break; |
|
| 352 | - case 'text': |
|
| 353 | - if (is_array($val)) { |
|
| 354 | - $this->_text = implode('\n', $val); |
|
| 355 | - } else { |
|
| 356 | - $this->_text = $val; |
|
| 357 | - } |
|
| 358 | - break; |
|
| 359 | - default: |
|
| 360 | - $this->_options[$opt] = $val; |
|
| 361 | - break; |
|
| 349 | + case 'color': |
|
| 350 | + $this->setColors($val); |
|
| 351 | + break; |
|
| 352 | + case 'text': |
|
| 353 | + if (is_array($val)) { |
|
| 354 | + $this->_text = implode('\n', $val); |
|
| 355 | + } else { |
|
| 356 | + $this->_text = $val; |
|
| 357 | + } |
|
| 358 | + break; |
|
| 359 | + default: |
|
| 360 | + $this->_options[$opt] = $val; |
|
| 361 | + break; |
|
| 362 | 362 | } |
| 363 | 363 | if (isset($reInits[$opt])) { |
| 364 | 364 | $this->_init = false; |
@@ -511,45 +511,45 @@ discard block |
||
| 511 | 511 | $image_canvas = false; |
| 512 | 512 | switch (true) { |
| 513 | 513 | |
| 514 | - case (empty($this->_options['canvas'])): |
|
| 515 | - // Create new image from width && height of the clipping |
|
| 516 | - $this->_img = imagecreatetruecolor( |
|
| 517 | - $this->_options['width'], $this->_options['height'] |
|
| 518 | - ); |
|
| 519 | - if (!$this->_img) { |
|
| 520 | - throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 521 | - } |
|
| 522 | - break; |
|
| 514 | + case (empty($this->_options['canvas'])): |
|
| 515 | + // Create new image from width && height of the clipping |
|
| 516 | + $this->_img = imagecreatetruecolor( |
|
| 517 | + $this->_options['width'], $this->_options['height'] |
|
| 518 | + ); |
|
| 519 | + if (!$this->_img) { |
|
| 520 | + throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 521 | + } |
|
| 522 | + break; |
|
| 523 | 523 | |
| 524 | - case (is_resource($this->_options['canvas']) && |
|
| 525 | - get_resource_type($this->_options['canvas']) == 'gd'): |
|
| 526 | - // The canvas is an image resource |
|
| 527 | - $image_canvas = true; |
|
| 528 | - $this->_img = $this->_options['canvas']; |
|
| 529 | - break; |
|
| 524 | + case (is_resource($this->_options['canvas']) && |
|
| 525 | + get_resource_type($this->_options['canvas']) == 'gd'): |
|
| 526 | + // The canvas is an image resource |
|
| 527 | + $image_canvas = true; |
|
| 528 | + $this->_img = $this->_options['canvas']; |
|
| 529 | + break; |
|
| 530 | 530 | |
| 531 | - case (is_array($this->_options['canvas']) && |
|
| 532 | - isset($this->_options['canvas']['width']) && |
|
| 533 | - isset($this->_options['canvas']['height'])): |
|
| 531 | + case (is_array($this->_options['canvas']) && |
|
| 532 | + isset($this->_options['canvas']['width']) && |
|
| 533 | + isset($this->_options['canvas']['height'])): |
|
| 534 | 534 | |
| 535 | - // Canvas must be a width and height measure |
|
| 536 | - $this->_img = imagecreatetruecolor( |
|
| 537 | - $this->_options['canvas']['width'], |
|
| 538 | - $this->_options['canvas']['height'] |
|
| 539 | - ); |
|
| 540 | - break; |
|
| 535 | + // Canvas must be a width and height measure |
|
| 536 | + $this->_img = imagecreatetruecolor( |
|
| 537 | + $this->_options['canvas']['width'], |
|
| 538 | + $this->_options['canvas']['height'] |
|
| 539 | + ); |
|
| 540 | + break; |
|
| 541 | 541 | |
| 542 | - case (is_array($this->_options['canvas']) && |
|
| 543 | - isset($this->_options['canvas']['size']) && |
|
| 544 | - ($this->_options['canvas']['size'] = 'auto')): |
|
| 542 | + case (is_array($this->_options['canvas']) && |
|
| 543 | + isset($this->_options['canvas']['size']) && |
|
| 544 | + ($this->_options['canvas']['size'] = 'auto')): |
|
| 545 | 545 | |
| 546 | - case (is_string($this->_options['canvas']) && |
|
| 547 | - ($this->_options['canvas'] = 'auto')): |
|
| 548 | - $this->_mode = 'auto'; |
|
| 549 | - break; |
|
| 546 | + case (is_string($this->_options['canvas']) && |
|
| 547 | + ($this->_options['canvas'] = 'auto')): |
|
| 548 | + $this->_mode = 'auto'; |
|
| 549 | + break; |
|
| 550 | 550 | |
| 551 | - default: |
|
| 552 | - throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 551 | + default: |
|
| 552 | + throw new Image_Text_Exception('Could not create image canvas.'); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | if ($this->_img) { |
@@ -889,19 +889,19 @@ discard block |
||
| 889 | 889 | $cosR = cos($radians); |
| 890 | 890 | |
| 891 | 891 | switch ($this->_options['valign']) { |
| 892 | - case self::IMAGE_TEXT_ALIGN_TOP: |
|
| 893 | - $valign_space = 0; |
|
| 894 | - break; |
|
| 895 | - case self::IMAGE_TEXT_ALIGN_MIDDLE: |
|
| 896 | - $valign_space = ($this->_options['height'] |
|
| 897 | - - $this->_realTextSize['height']) / 2; |
|
| 898 | - break; |
|
| 899 | - case self::IMAGE_TEXT_ALIGN_BOTTOM: |
|
| 900 | - $valign_space = $this->_options['height'] |
|
| 901 | - - $this->_realTextSize['height']; |
|
| 902 | - break; |
|
| 903 | - default: |
|
| 904 | - $valign_space = 0; |
|
| 892 | + case self::IMAGE_TEXT_ALIGN_TOP: |
|
| 893 | + $valign_space = 0; |
|
| 894 | + break; |
|
| 895 | + case self::IMAGE_TEXT_ALIGN_MIDDLE: |
|
| 896 | + $valign_space = ($this->_options['height'] |
|
| 897 | + - $this->_realTextSize['height']) / 2; |
|
| 898 | + break; |
|
| 899 | + case self::IMAGE_TEXT_ALIGN_BOTTOM: |
|
| 900 | + $valign_space = $this->_options['height'] |
|
| 901 | + - $this->_realTextSize['height']; |
|
| 902 | + break; |
|
| 903 | + default: |
|
| 904 | + $valign_space = 0; |
|
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | $space = (1 + $line_spacing) * $size; |
@@ -932,18 +932,18 @@ discard block |
||
| 932 | 932 | // Calc the position using the block width, the current line width and |
| 933 | 933 | // obviously the angle. That gives us the offset to slide the line. |
| 934 | 934 | switch ($align) { |
| 935 | - case self::IMAGE_TEXT_ALIGN_LEFT: |
|
| 936 | - $hyp = 0; |
|
| 937 | - break; |
|
| 938 | - case self::IMAGE_TEXT_ALIGN_RIGHT: |
|
| 939 | - $hyp = $block_width - $line_width - $left_margin; |
|
| 940 | - break; |
|
| 941 | - case self::IMAGE_TEXT_ALIGN_CENTER: |
|
| 942 | - $hyp = ($block_width - $line_width) / 2 - $left_margin; |
|
| 943 | - break; |
|
| 944 | - default: |
|
| 945 | - $hyp = 0; |
|
| 946 | - break; |
|
| 935 | + case self::IMAGE_TEXT_ALIGN_LEFT: |
|
| 936 | + $hyp = 0; |
|
| 937 | + break; |
|
| 938 | + case self::IMAGE_TEXT_ALIGN_RIGHT: |
|
| 939 | + $hyp = $block_width - $line_width - $left_margin; |
|
| 940 | + break; |
|
| 941 | + case self::IMAGE_TEXT_ALIGN_CENTER: |
|
| 942 | + $hyp = ($block_width - $line_width) / 2 - $left_margin; |
|
| 943 | + break; |
|
| 944 | + default: |
|
| 945 | + $hyp = 0; |
|
| 946 | + break; |
|
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | $posx = $new_posx + $cosR * $hyp; |
@@ -997,17 +997,17 @@ discard block |
||
| 997 | 997 | throw new Image_Text_Exception('Header already sent.'); |
| 998 | 998 | } |
| 999 | 999 | switch ($this->_options['image_type']) { |
| 1000 | - case IMAGETYPE_PNG: |
|
| 1001 | - $imgout = 'imagepng'; |
|
| 1002 | - break; |
|
| 1003 | - case IMAGETYPE_JPEG: |
|
| 1004 | - $imgout = 'imagejpeg'; |
|
| 1005 | - break; |
|
| 1006 | - case IMAGETYPE_BMP: |
|
| 1007 | - $imgout = 'imagebmp'; |
|
| 1008 | - break; |
|
| 1009 | - default: |
|
| 1010 | - throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1000 | + case IMAGETYPE_PNG: |
|
| 1001 | + $imgout = 'imagepng'; |
|
| 1002 | + break; |
|
| 1003 | + case IMAGETYPE_JPEG: |
|
| 1004 | + $imgout = 'imagejpeg'; |
|
| 1005 | + break; |
|
| 1006 | + case IMAGETYPE_BMP: |
|
| 1007 | + $imgout = 'imagebmp'; |
|
| 1008 | + break; |
|
| 1009 | + default: |
|
| 1010 | + throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1011 | 1011 | } |
| 1012 | 1012 | if ($save) { |
| 1013 | 1013 | $imgout($this->_img); |
@@ -1048,18 +1048,18 @@ discard block |
||
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | switch ($this->_options['image_type']) { |
| 1051 | - case IMAGETYPE_PNG: |
|
| 1052 | - $imgout = 'imagepng'; |
|
| 1053 | - break; |
|
| 1054 | - case IMAGETYPE_JPEG: |
|
| 1055 | - $imgout = 'imagejpeg'; |
|
| 1056 | - break; |
|
| 1057 | - case IMAGETYPE_BMP: |
|
| 1058 | - $imgout = 'imagebmp'; |
|
| 1059 | - break; |
|
| 1060 | - default: |
|
| 1061 | - throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1062 | - break; |
|
| 1051 | + case IMAGETYPE_PNG: |
|
| 1052 | + $imgout = 'imagepng'; |
|
| 1053 | + break; |
|
| 1054 | + case IMAGETYPE_JPEG: |
|
| 1055 | + $imgout = 'imagejpeg'; |
|
| 1056 | + break; |
|
| 1057 | + case IMAGETYPE_BMP: |
|
| 1058 | + $imgout = 'imagebmp'; |
|
| 1059 | + break; |
|
| 1060 | + default: |
|
| 1061 | + throw new Image_Text_Exception('Unsupported image type.'); |
|
| 1062 | + break; |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | $res = $imgout($this->_img, $destFile); |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | $space = (1 + $this->_options['line_spacing']) |
| 684 | 684 | * $this->_options['font_size']; |
| 685 | 685 | |
| 686 | - $max_lines = (int)$this->_options['max_lines']; |
|
| 686 | + $max_lines = (int) $this->_options['max_lines']; |
|
| 687 | 687 | |
| 688 | 688 | if (($max_lines < 1) && !$force) { |
| 689 | 689 | return false; |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | 'color' => $c |
| 733 | 733 | ); |
| 734 | 734 | $text_width = max($text_width, ($bounds[2] - $bounds[0])); |
| 735 | - $text_height += (int)$space; |
|
| 735 | + $text_height += (int) $space; |
|
| 736 | 736 | if (($text_height > $block_height) && !$force) { |
| 737 | 737 | return false; |
| 738 | 738 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | $text_line_next = $token; |
| 750 | 750 | $beginning_of_line = false; |
| 751 | 751 | } else { |
| 752 | - $text_line_next = $text_line . ' ' . $token; |
|
| 752 | + $text_line_next = $text_line.' '.$token; |
|
| 753 | 753 | } |
| 754 | 754 | $bounds = imagettfbbox($size, 0, $font, $text_line_next); |
| 755 | 755 | $prev_width = isset($prev_width) ? $width : 0; |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | 'color' => $c |
| 777 | 777 | ); |
| 778 | 778 | $text_width = max($text_width, ($bounds[2] - $bounds[0])); |
| 779 | - $text_height += (int)$space; |
|
| 779 | + $text_height += (int) $space; |
|
| 780 | 780 | if (($text_height > $block_height) && !$force) { |
| 781 | 781 | return false; |
| 782 | 782 | } |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | { |
| 991 | 991 | if (!headers_sent()) { |
| 992 | 992 | header( |
| 993 | - "Content-type: " . |
|
| 993 | + "Content-type: ". |
|
| 994 | 994 | image_type_to_mime_type($this->_options['image_type']) |
| 995 | 995 | ); |
| 996 | 996 | } else { |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | $y += $vC[1]; |
| 1122 | 1122 | } |
| 1123 | 1123 | } |
| 1124 | - return array('x' => (int)round($x, 0), 'y' => (int)round($y, 0)); |
|
| 1124 | + return array('x' => (int) round($x, 0), 'y' => (int) round($y, 0)); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | /** |
@@ -286,7 +286,7 @@ |
||
| 286 | 286 | * |
| 287 | 287 | * @access private |
| 288 | 288 | * @param integer $blockId the block id of the first block |
| 289 | - * @return mixed true on success, PEAR_Error on failure |
|
| 289 | + * @return boolean true on success, PEAR_Error on failure |
|
| 290 | 290 | */ |
| 291 | 291 | function _readPpsWks($blockId) |
| 292 | 292 | { |
@@ -49,74 +49,74 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * The file handle for reading an OLE container |
|
| 53 | - * @var resource |
|
| 54 | - */ |
|
| 52 | + * The file handle for reading an OLE container |
|
| 53 | + * @var resource |
|
| 54 | + */ |
|
| 55 | 55 | var $_file_handle; |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Array of PPS's found on the OLE container |
|
| 59 | - * @var array |
|
| 60 | - */ |
|
| 58 | + * Array of PPS's found on the OLE container |
|
| 59 | + * @var array |
|
| 60 | + */ |
|
| 61 | 61 | var $_list; |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * Root directory of OLE container |
|
| 65 | - * @var OLE_PPS_Root |
|
| 66 | - */ |
|
| 64 | + * Root directory of OLE container |
|
| 65 | + * @var OLE_PPS_Root |
|
| 66 | + */ |
|
| 67 | 67 | var $root; |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * Big Block Allocation Table |
|
| 71 | - * @var array (blockId => nextBlockId) |
|
| 72 | - */ |
|
| 70 | + * Big Block Allocation Table |
|
| 71 | + * @var array (blockId => nextBlockId) |
|
| 72 | + */ |
|
| 73 | 73 | var $bbat; |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * Short Block Allocation Table |
|
| 77 | - * @var array (blockId => nextBlockId) |
|
| 78 | - */ |
|
| 76 | + * Short Block Allocation Table |
|
| 77 | + * @var array (blockId => nextBlockId) |
|
| 78 | + */ |
|
| 79 | 79 | var $sbat; |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | - * Size of big blocks. This is usually 512. |
|
| 83 | - * @var int number of octets per block. |
|
| 84 | - */ |
|
| 82 | + * Size of big blocks. This is usually 512. |
|
| 83 | + * @var int number of octets per block. |
|
| 84 | + */ |
|
| 85 | 85 | var $bigBlockSize; |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | - * Size of small blocks. This is usually 64. |
|
| 89 | - * @var int number of octets per block |
|
| 90 | - */ |
|
| 88 | + * Size of small blocks. This is usually 64. |
|
| 89 | + * @var int number of octets per block |
|
| 90 | + */ |
|
| 91 | 91 | var $smallBlockSize; |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | - * Creates a new OLE object |
|
| 95 | - * @access public |
|
| 96 | - */ |
|
| 94 | + * Creates a new OLE object |
|
| 95 | + * @access public |
|
| 96 | + */ |
|
| 97 | 97 | function OLE() |
| 98 | 98 | { |
| 99 | 99 | $this->_list = array(); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * Destructor (using PEAR) |
|
| 104 | - * Just closes the file handle on the OLE file. |
|
| 105 | - * |
|
| 106 | - * @access private |
|
| 107 | - */ |
|
| 103 | + * Destructor (using PEAR) |
|
| 104 | + * Just closes the file handle on the OLE file. |
|
| 105 | + * |
|
| 106 | + * @access private |
|
| 107 | + */ |
|
| 108 | 108 | function _OLE() |
| 109 | 109 | { |
| 110 | 110 | fclose($this->_file_handle); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | - * Reads an OLE container from the contents of the file given. |
|
| 115 | - * |
|
| 116 | - * @access public |
|
| 117 | - * @param string $file |
|
| 118 | - * @return mixed true on success, PEAR_Error on failure |
|
| 119 | - */ |
|
| 114 | + * Reads an OLE container from the contents of the file given. |
|
| 115 | + * |
|
| 116 | + * @access public |
|
| 117 | + * @param string $file |
|
| 118 | + * @return mixed true on success, PEAR_Error on failure |
|
| 119 | + */ |
|
| 120 | 120 | function read($file) |
| 121 | 121 | { |
| 122 | 122 | $fh = @fopen($file, "r"); |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | - * Gets information about all PPS's on the OLE container from the PPS WK's |
|
| 285 | - * creates an OLE_PPS object for each one. |
|
| 286 | - * |
|
| 287 | - * @access private |
|
| 288 | - * @param integer $blockId the block id of the first block |
|
| 289 | - * @return mixed true on success, PEAR_Error on failure |
|
| 290 | - */ |
|
| 284 | + * Gets information about all PPS's on the OLE container from the PPS WK's |
|
| 285 | + * creates an OLE_PPS object for each one. |
|
| 286 | + * |
|
| 287 | + * @access private |
|
| 288 | + * @param integer $blockId the block id of the first block |
|
| 289 | + * @return mixed true on success, PEAR_Error on failure |
|
| 290 | + */ |
|
| 291 | 291 | function _readPpsWks($blockId) |
| 292 | 292 | { |
| 293 | 293 | $fh = $this->getStream($blockId); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | break; |
| 308 | 308 | case OLE_PPS_TYPE_DIR: |
| 309 | 309 | $pps = new OLE_PPS(null, null, null, null, null, |
| 310 | - null, null, null, null, array()); |
|
| 310 | + null, null, null, null, array()); |
|
| 311 | 311 | break; |
| 312 | 312 | case OLE_PPS_TYPE_FILE: |
| 313 | 313 | require_once 'OLE/PPS/File.php'; |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
| 363 | - * It checks whether the PPS tree is complete (all PPS's read) |
|
| 364 | - * starting with the given PPS (not necessarily root) |
|
| 365 | - * |
|
| 366 | - * @access private |
|
| 367 | - * @param integer $index The index of the PPS from which we are checking |
|
| 368 | - * @return boolean Whether the PPS tree for the given PPS is complete |
|
| 369 | - */ |
|
| 363 | + * It checks whether the PPS tree is complete (all PPS's read) |
|
| 364 | + * starting with the given PPS (not necessarily root) |
|
| 365 | + * |
|
| 366 | + * @access private |
|
| 367 | + * @param integer $index The index of the PPS from which we are checking |
|
| 368 | + * @return boolean Whether the PPS tree for the given PPS is complete |
|
| 369 | + */ |
|
| 370 | 370 | function _ppsTreeComplete($index) |
| 371 | 371 | { |
| 372 | 372 | return isset($this->_list[$index]) && |
@@ -380,12 +380,12 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | - * Checks whether a PPS is a File PPS or not. |
|
| 384 | - * If there is no PPS for the index given, it will return false. |
|
| 385 | - * @param integer $index The index for the PPS |
|
| 386 | - * @return bool true if it's a File PPS, false otherwise |
|
| 387 | - * @access public |
|
| 388 | - */ |
|
| 383 | + * Checks whether a PPS is a File PPS or not. |
|
| 384 | + * If there is no PPS for the index given, it will return false. |
|
| 385 | + * @param integer $index The index for the PPS |
|
| 386 | + * @return bool true if it's a File PPS, false otherwise |
|
| 387 | + * @access public |
|
| 388 | + */ |
|
| 389 | 389 | function isFile($index) |
| 390 | 390 | { |
| 391 | 391 | if (isset($this->_list[$index])) { |
@@ -395,12 +395,12 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | - * Checks whether a PPS is a Root PPS or not. |
|
| 399 | - * If there is no PPS for the index given, it will return false. |
|
| 400 | - * @param integer $index The index for the PPS. |
|
| 401 | - * @return bool true if it's a Root PPS, false otherwise |
|
| 402 | - * @access public |
|
| 403 | - */ |
|
| 398 | + * Checks whether a PPS is a Root PPS or not. |
|
| 399 | + * If there is no PPS for the index given, it will return false. |
|
| 400 | + * @param integer $index The index for the PPS. |
|
| 401 | + * @return bool true if it's a Root PPS, false otherwise |
|
| 402 | + * @access public |
|
| 403 | + */ |
|
| 404 | 404 | function isRoot($index) |
| 405 | 405 | { |
| 406 | 406 | if (isset($this->_list[$index])) { |
@@ -410,26 +410,26 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | /** |
| 413 | - * Gives the total number of PPS's found in the OLE container. |
|
| 414 | - * @return integer The total number of PPS's found in the OLE container |
|
| 415 | - * @access public |
|
| 416 | - */ |
|
| 413 | + * Gives the total number of PPS's found in the OLE container. |
|
| 414 | + * @return integer The total number of PPS's found in the OLE container |
|
| 415 | + * @access public |
|
| 416 | + */ |
|
| 417 | 417 | function ppsTotal() |
| 418 | 418 | { |
| 419 | 419 | return count($this->_list); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
| 423 | - * Gets data from a PPS |
|
| 424 | - * If there is no PPS for the index given, it will return an empty string. |
|
| 425 | - * @param integer $index The index for the PPS |
|
| 426 | - * @param integer $position The position from which to start reading |
|
| 427 | - * (relative to the PPS) |
|
| 428 | - * @param integer $length The amount of bytes to read (at most) |
|
| 429 | - * @return string The binary string containing the data requested |
|
| 430 | - * @access public |
|
| 431 | - * @see OLE_PPS_File::getStream() |
|
| 432 | - */ |
|
| 423 | + * Gets data from a PPS |
|
| 424 | + * If there is no PPS for the index given, it will return an empty string. |
|
| 425 | + * @param integer $index The index for the PPS |
|
| 426 | + * @param integer $position The position from which to start reading |
|
| 427 | + * (relative to the PPS) |
|
| 428 | + * @param integer $length The amount of bytes to read (at most) |
|
| 429 | + * @return string The binary string containing the data requested |
|
| 430 | + * @access public |
|
| 431 | + * @see OLE_PPS_File::getStream() |
|
| 432 | + */ |
|
| 433 | 433 | function getData($index, $position, $length) |
| 434 | 434 | { |
| 435 | 435 | // if position is not valid return empty string |
@@ -446,12 +446,12 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | - * Gets the data length from a PPS |
|
| 450 | - * If there is no PPS for the index given, it will return 0. |
|
| 451 | - * @param integer $index The index for the PPS |
|
| 452 | - * @return integer The amount of bytes in data the PPS has |
|
| 453 | - * @access public |
|
| 454 | - */ |
|
| 449 | + * Gets the data length from a PPS |
|
| 450 | + * If there is no PPS for the index given, it will return 0. |
|
| 451 | + * @param integer $index The index for the PPS |
|
| 452 | + * @return integer The amount of bytes in data the PPS has |
|
| 453 | + * @access public |
|
| 454 | + */ |
|
| 455 | 455 | function getDataLength($index) |
| 456 | 456 | { |
| 457 | 457 | if (isset($this->_list[$index])) { |
@@ -461,13 +461,13 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | /** |
| 464 | - * Utility function to transform ASCII text to Unicode |
|
| 465 | - * |
|
| 466 | - * @access public |
|
| 467 | - * @static |
|
| 468 | - * @param string $ascii The ASCII string to transform |
|
| 469 | - * @return string The string in Unicode |
|
| 470 | - */ |
|
| 464 | + * Utility function to transform ASCII text to Unicode |
|
| 465 | + * |
|
| 466 | + * @access public |
|
| 467 | + * @static |
|
| 468 | + * @param string $ascii The ASCII string to transform |
|
| 469 | + * @return string The string in Unicode |
|
| 470 | + */ |
|
| 471 | 471 | function Asc2Ucs($ascii) |
| 472 | 472 | { |
| 473 | 473 | $rawname = ''; |
@@ -478,14 +478,14 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /** |
| 481 | - * Utility function |
|
| 482 | - * Returns a string for the OLE container with the date given |
|
| 483 | - * |
|
| 484 | - * @access public |
|
| 485 | - * @static |
|
| 486 | - * @param integer $date A timestamp |
|
| 487 | - * @return string The string for the OLE container |
|
| 488 | - */ |
|
| 481 | + * Utility function |
|
| 482 | + * Returns a string for the OLE container with the date given |
|
| 483 | + * |
|
| 484 | + * @access public |
|
| 485 | + * @static |
|
| 486 | + * @param integer $date A timestamp |
|
| 487 | + * @return string The string for the OLE container |
|
| 488 | + */ |
|
| 489 | 489 | function LocalDate2OLE($date = null) |
| 490 | 490 | { |
| 491 | 491 | if (!isset($date)) { |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | // calculate seconds |
| 501 | 501 | $big_date = $days * 24 * 3600 + |
| 502 | 502 | gmmktime(date("H",$date),date("i",$date),date("s",$date), |
| 503 | - date("m",$date),date("d",$date),date("Y",$date)); |
|
| 503 | + date("m",$date),date("d",$date),date("Y",$date)); |
|
| 504 | 504 | // multiply just to make MS happy |
| 505 | 505 | $big_date *= 10000000; |
| 506 | 506 | |
@@ -525,12 +525,12 @@ discard block |
||
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | /** |
| 528 | - * Returns a timestamp from an OLE container's date |
|
| 529 | - * @param integer $string A binary string with the encoded date |
|
| 530 | - * @return string The timestamp corresponding to the string |
|
| 531 | - * @access public |
|
| 532 | - * @static |
|
| 533 | - */ |
|
| 528 | + * Returns a timestamp from an OLE container's date |
|
| 529 | + * @param integer $string A binary string with the encoded date |
|
| 530 | + * @return string The timestamp corresponding to the string |
|
| 531 | + * @access public |
|
| 532 | + * @static |
|
| 533 | + */ |
|
| 534 | 534 | function OLE2LocalDate($string) |
| 535 | 535 | { |
| 536 | 536 | if (strlen($string) != 8) { |
@@ -300,21 +300,21 @@ |
||
| 300 | 300 | $name = str_replace("\x00", "", $nameUtf16); |
| 301 | 301 | $type = $this->_readInt1($fh); |
| 302 | 302 | switch ($type) { |
| 303 | - case OLE_PPS_TYPE_ROOT: |
|
| 304 | - require_once 'OLE/PPS/Root.php'; |
|
| 305 | - $pps = new OLE_PPS_Root(null, null, array()); |
|
| 306 | - $this->root = $pps; |
|
| 307 | - break; |
|
| 308 | - case OLE_PPS_TYPE_DIR: |
|
| 309 | - $pps = new OLE_PPS(null, null, null, null, null, |
|
| 310 | - null, null, null, null, array()); |
|
| 311 | - break; |
|
| 312 | - case OLE_PPS_TYPE_FILE: |
|
| 313 | - require_once 'OLE/PPS/File.php'; |
|
| 314 | - $pps = new OLE_PPS_File($name); |
|
| 315 | - break; |
|
| 316 | - default: |
|
| 317 | - continue; |
|
| 303 | + case OLE_PPS_TYPE_ROOT: |
|
| 304 | + require_once 'OLE/PPS/Root.php'; |
|
| 305 | + $pps = new OLE_PPS_Root(null, null, array()); |
|
| 306 | + $this->root = $pps; |
|
| 307 | + break; |
|
| 308 | + case OLE_PPS_TYPE_DIR: |
|
| 309 | + $pps = new OLE_PPS(null, null, null, null, null, |
|
| 310 | + null, null, null, null, array()); |
|
| 311 | + break; |
|
| 312 | + case OLE_PPS_TYPE_FILE: |
|
| 313 | + require_once 'OLE/PPS/File.php'; |
|
| 314 | + $pps = new OLE_PPS_File($name); |
|
| 315 | + break; |
|
| 316 | + default: |
|
| 317 | + continue; |
|
| 318 | 318 | } |
| 319 | 319 | fseek($fh, 1, SEEK_CUR); |
| 320 | 320 | $pps->Type = $type; |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Constants for OLE package |
| 25 | 25 | */ |
| 26 | -define('OLE_PPS_TYPE_ROOT', 5); |
|
| 27 | -define('OLE_PPS_TYPE_DIR', 1); |
|
| 28 | -define('OLE_PPS_TYPE_FILE', 2); |
|
| 26 | +define('OLE_PPS_TYPE_ROOT', 5); |
|
| 27 | +define('OLE_PPS_TYPE_DIR', 1); |
|
| 28 | +define('OLE_PPS_TYPE_FILE', 2); |
|
| 29 | 29 | define('OLE_DATA_SIZE_SMALL', 0x1000); |
| 30 | -define('OLE_LONG_INT_SIZE', 4); |
|
| 31 | -define('OLE_PPS_SIZE', 0x80); |
|
| 30 | +define('OLE_LONG_INT_SIZE', 4); |
|
| 31 | +define('OLE_PPS_SIZE', 0x80); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Array for storing OLE instances that are accessed from |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | for ($i = 0; $i < $bbatBlockCount; $i++) { |
| 184 | 184 | $pos = $this->_getBlockOffset($mbatBlocks[$i]); |
| 185 | 185 | fseek($fh, $pos); |
| 186 | - for ($j = 0 ; $j < $this->bigBlockSize / 4; $j++) { |
|
| 186 | + for ($j = 0; $j < $this->bigBlockSize / 4; $j++) { |
|
| 187 | 187 | $this->bbat[] = $this->_readInt4($fh); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -234,12 +234,12 @@ discard block |
||
| 234 | 234 | $GLOBALS['_OLE_INSTANCES'][] = $this; |
| 235 | 235 | $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES'])); |
| 236 | 236 | |
| 237 | - $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId; |
|
| 237 | + $path = 'ole-chainedblockstream://oleInstanceId='.$instanceId; |
|
| 238 | 238 | if (is_a($blockIdOrPps, 'OLE_PPS')) { |
| 239 | - $path .= '&blockId=' . $blockIdOrPps->_StartBlock; |
|
| 240 | - $path .= '&size=' . $blockIdOrPps->Size; |
|
| 239 | + $path .= '&blockId='.$blockIdOrPps->_StartBlock; |
|
| 240 | + $path .= '&size='.$blockIdOrPps->Size; |
|
| 241 | 241 | } else { |
| 242 | - $path .= '&blockId=' . $blockIdOrPps; |
|
| 242 | + $path .= '&blockId='.$blockIdOrPps; |
|
| 243 | 243 | } |
| 244 | 244 | return fopen($path, 'r'); |
| 245 | 245 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | { |
| 473 | 473 | $rawname = ''; |
| 474 | 474 | for ($i = 0; $i < strlen($ascii); $i++) { |
| 475 | - $rawname .= $ascii{$i} . "\x00"; |
|
| 475 | + $rawname .= $ascii{$i}."\x00"; |
|
| 476 | 476 | } |
| 477 | 477 | return $rawname; |
| 478 | 478 | } |
@@ -499,8 +499,8 @@ discard block |
||
| 499 | 499 | $days = 134774; |
| 500 | 500 | // calculate seconds |
| 501 | 501 | $big_date = $days * 24 * 3600 + |
| 502 | - gmmktime(date("H",$date),date("i",$date),date("s",$date), |
|
| 503 | - date("m",$date),date("d",$date),date("Y",$date)); |
|
| 502 | + gmmktime(date("H", $date), date("i", $date), date("s", $date), |
|
| 503 | + date("m", $date), date("d", $date), date("Y", $date)); |
|
| 504 | 504 | // multiply just to make MS happy |
| 505 | 505 | $big_date *= 10000000; |
| 506 | 506 | |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | // factor used for separating numbers into 4 bytes parts |
| 541 | - $factor = pow(2,32); |
|
| 541 | + $factor = pow(2, 32); |
|
| 542 | 542 | $high_part = 0; |
| 543 | 543 | for ($i = 0; $i < 4; $i++) { |
| 544 | 544 | list(, $high_part) = unpack('C', $string{(7 - $i)}); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | * |
| 64 | 64 | * @access public |
| 65 | 65 | * @param string $dir The dir to be used as temp dir |
| 66 | - * @return true if given dir is valid, false otherwise |
|
| 66 | + * @return boolean if given dir is valid, false otherwise |
|
| 67 | 67 | */ |
| 68 | 68 | function setTempDir($dir) |
| 69 | 69 | { |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | class OLE_PPS_File extends OLE_PPS |
| 31 | 31 | { |
| 32 | 32 | /** |
| 33 | - * The temporary dir for storing the OLE file |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 33 | + * The temporary dir for storing the OLE file |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | 36 | var $_tmp_dir; |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * The constructor |
|
| 40 | - * |
|
| 41 | - * @access public |
|
| 42 | - * @param string $name The name of the file (in Unicode) |
|
| 43 | - * @see OLE::Asc2Ucs() |
|
| 44 | - */ |
|
| 39 | + * The constructor |
|
| 40 | + * |
|
| 41 | + * @access public |
|
| 42 | + * @param string $name The name of the file (in Unicode) |
|
| 43 | + * @see OLE::Asc2Ucs() |
|
| 44 | + */ |
|
| 45 | 45 | function OLE_PPS_File($name) |
| 46 | 46 | { |
| 47 | 47 | $this->_tmp_dir = ''; |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * Sets the temp dir used for storing the OLE file |
|
| 63 | - * |
|
| 64 | - * @access public |
|
| 65 | - * @param string $dir The dir to be used as temp dir |
|
| 66 | - * @return true if given dir is valid, false otherwise |
|
| 67 | - */ |
|
| 62 | + * Sets the temp dir used for storing the OLE file |
|
| 63 | + * |
|
| 64 | + * @access public |
|
| 65 | + * @param string $dir The dir to be used as temp dir |
|
| 66 | + * @return true if given dir is valid, false otherwise |
|
| 67 | + */ |
|
| 68 | 68 | function setTempDir($dir) |
| 69 | 69 | { |
| 70 | 70 | if (is_dir($dir)) { |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * Initialization method. Has to be called right after OLE_PPS_File(). |
|
| 79 | - * |
|
| 80 | - * @access public |
|
| 81 | - * @return mixed true on success. PEAR_Error on failure |
|
| 82 | - */ |
|
| 78 | + * Initialization method. Has to be called right after OLE_PPS_File(). |
|
| 79 | + * |
|
| 80 | + * @access public |
|
| 81 | + * @return mixed true on success. PEAR_Error on failure |
|
| 82 | + */ |
|
| 83 | 83 | function init() |
| 84 | 84 | { |
| 85 | 85 | $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_File"); |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * Append data to PPS |
|
| 100 | - * |
|
| 101 | - * @access public |
|
| 102 | - * @param string $data The data to append |
|
| 103 | - */ |
|
| 99 | + * Append data to PPS |
|
| 100 | + * |
|
| 101 | + * @access public |
|
| 102 | + * @param string $data The data to append |
|
| 103 | + */ |
|
| 104 | 104 | function append($data) |
| 105 | 105 | { |
| 106 | 106 | if ($this->_PPS_FILE) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @access public |
| 67 | 67 | * @param string $dir The dir to be used as temp dir |
| 68 | - * @return true if given dir is valid, false otherwise |
|
| 68 | + * @return boolean if given dir is valid, false otherwise |
|
| 69 | 69 | */ |
| 70 | 70 | function setTempDir($dir) |
| 71 | 71 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @access private |
| 144 | 144 | * @param array $raList Reference to an array of PPS's |
| 145 | - * @return array The array of numbers |
|
| 145 | + * @return double[] The array of numbers |
|
| 146 | 146 | */ |
| 147 | 147 | function _calcSize(&$raList) |
| 148 | 148 | { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @access private |
| 181 | 181 | * @param integer $i2 The argument |
| 182 | 182 | * @see save() |
| 183 | - * @return integer |
|
| 183 | + * @return double |
|
| 184 | 184 | */ |
| 185 | 185 | function _adjust2($i2) |
| 186 | 186 | { |
@@ -32,41 +32,41 @@ discard block |
||
| 32 | 32 | class OLE_PPS_Root extends OLE_PPS |
| 33 | 33 | { |
| 34 | 34 | /** |
| 35 | - * The temporary dir for storing the OLE file |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 35 | + * The temporary dir for storing the OLE file |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | 38 | var $_tmp_dir; |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | - * Constructor |
|
| 42 | - * |
|
| 43 | - * @access public |
|
| 44 | - * @param integer $time_1st A timestamp |
|
| 45 | - * @param integer $time_2nd A timestamp |
|
| 46 | - */ |
|
| 41 | + * Constructor |
|
| 42 | + * |
|
| 43 | + * @access public |
|
| 44 | + * @param integer $time_1st A timestamp |
|
| 45 | + * @param integer $time_2nd A timestamp |
|
| 46 | + */ |
|
| 47 | 47 | function OLE_PPS_Root($time_1st, $time_2nd, $raChild) |
| 48 | 48 | { |
| 49 | 49 | $this->_tmp_dir = ''; |
| 50 | 50 | $this->OLE_PPS( |
| 51 | - null, |
|
| 52 | - OLE::Asc2Ucs('Root Entry'), |
|
| 53 | - OLE_PPS_TYPE_ROOT, |
|
| 54 | - null, |
|
| 55 | - null, |
|
| 56 | - null, |
|
| 57 | - $time_1st, |
|
| 58 | - $time_2nd, |
|
| 59 | - null, |
|
| 60 | - $raChild); |
|
| 51 | + null, |
|
| 52 | + OLE::Asc2Ucs('Root Entry'), |
|
| 53 | + OLE_PPS_TYPE_ROOT, |
|
| 54 | + null, |
|
| 55 | + null, |
|
| 56 | + null, |
|
| 57 | + $time_1st, |
|
| 58 | + $time_2nd, |
|
| 59 | + null, |
|
| 60 | + $raChild); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * Sets the temp dir used for storing the OLE file |
|
| 65 | - * |
|
| 66 | - * @access public |
|
| 67 | - * @param string $dir The dir to be used as temp dir |
|
| 68 | - * @return true if given dir is valid, false otherwise |
|
| 69 | - */ |
|
| 64 | + * Sets the temp dir used for storing the OLE file |
|
| 65 | + * |
|
| 66 | + * @access public |
|
| 67 | + * @param string $dir The dir to be used as temp dir |
|
| 68 | + * @return true if given dir is valid, false otherwise |
|
| 69 | + */ |
|
| 70 | 70 | function setTempDir($dir) |
| 71 | 71 | { |
| 72 | 72 | if (is_dir($dir)) { |
@@ -77,21 +77,21 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * Method for saving the whole OLE container (including files). |
|
| 81 | - * In fact, if called with an empty argument (or '-'), it saves to a |
|
| 82 | - * temporary file and then outputs it's contents to stdout. |
|
| 83 | - * |
|
| 84 | - * @param string $filename The name of the file where to save the OLE container |
|
| 85 | - * @access public |
|
| 86 | - * @return mixed true on success, PEAR_Error on failure |
|
| 87 | - */ |
|
| 80 | + * Method for saving the whole OLE container (including files). |
|
| 81 | + * In fact, if called with an empty argument (or '-'), it saves to a |
|
| 82 | + * temporary file and then outputs it's contents to stdout. |
|
| 83 | + * |
|
| 84 | + * @param string $filename The name of the file where to save the OLE container |
|
| 85 | + * @access public |
|
| 86 | + * @return mixed true on success, PEAR_Error on failure |
|
| 87 | + */ |
|
| 88 | 88 | function save($filename) |
| 89 | 89 | { |
| 90 | 90 | // Initial Setting for saving |
| 91 | 91 | $this->_BIG_BLOCK_SIZE = pow(2, |
| 92 | - ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9)); |
|
| 92 | + ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9)); |
|
| 93 | 93 | $this->_SMALL_BLOCK_SIZE= pow(2, |
| 94 | - ((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6)); |
|
| 94 | + ((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6)); |
|
| 95 | 95 | |
| 96 | 96 | // Open temp file if we are sending output to stdout |
| 97 | 97 | if (($filename == '-') || ($filename == '')) { |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | - * Calculate some numbers |
|
| 142 | - * |
|
| 143 | - * @access private |
|
| 144 | - * @param array $raList Reference to an array of PPS's |
|
| 145 | - * @return array The array of numbers |
|
| 146 | - */ |
|
| 141 | + * Calculate some numbers |
|
| 142 | + * |
|
| 143 | + * @access private |
|
| 144 | + * @param array $raList Reference to an array of PPS's |
|
| 145 | + * @return array The array of numbers |
|
| 146 | + */ |
|
| 147 | 147 | function _calcSize(&$raList) |
| 148 | 148 | { |
| 149 | 149 | // Calculate Basic Setting |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | - * Helper function for caculating a magic value for block sizes |
|
| 179 | - * |
|
| 180 | - * @access private |
|
| 181 | - * @param integer $i2 The argument |
|
| 182 | - * @see save() |
|
| 183 | - * @return integer |
|
| 184 | - */ |
|
| 178 | + * Helper function for caculating a magic value for block sizes |
|
| 179 | + * |
|
| 180 | + * @access private |
|
| 181 | + * @param integer $i2 The argument |
|
| 182 | + * @see save() |
|
| 183 | + * @return integer |
|
| 184 | + */ |
|
| 185 | 185 | function _adjust2($i2) |
| 186 | 186 | { |
| 187 | 187 | $iWk = log($i2)/log(2); |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Save OLE header |
|
| 193 | - * |
|
| 194 | - * @access private |
|
| 195 | - * @param integer $iSBDcnt |
|
| 196 | - * @param integer $iBBcnt |
|
| 197 | - * @param integer $iPPScnt |
|
| 198 | - */ |
|
| 192 | + * Save OLE header |
|
| 193 | + * |
|
| 194 | + * @access private |
|
| 195 | + * @param integer $iSBDcnt |
|
| 196 | + * @param integer $iBBcnt |
|
| 197 | + * @param integer $iPPScnt |
|
| 198 | + */ |
|
| 199 | 199 | function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt) |
| 200 | 200 | { |
| 201 | 201 | $FILE = $this->_FILEH_; |
@@ -225,32 +225,32 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | // Save Header |
| 227 | 227 | fwrite($FILE, |
| 228 | - "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" |
|
| 229 | - . "\x00\x00\x00\x00" |
|
| 230 | - . "\x00\x00\x00\x00" |
|
| 231 | - . "\x00\x00\x00\x00" |
|
| 232 | - . "\x00\x00\x00\x00" |
|
| 233 | - . pack("v", 0x3b) |
|
| 234 | - . pack("v", 0x03) |
|
| 235 | - . pack("v", -2) |
|
| 236 | - . pack("v", 9) |
|
| 237 | - . pack("v", 6) |
|
| 238 | - . pack("v", 0) |
|
| 239 | - . "\x00\x00\x00\x00" |
|
| 240 | - . "\x00\x00\x00\x00" |
|
| 241 | - . pack("V", $iBdCnt) |
|
| 242 | - . pack("V", $iBBcnt+$iSBDcnt) //ROOT START |
|
| 243 | - . pack("V", 0) |
|
| 244 | - . pack("V", 0x1000) |
|
| 245 | - . pack("V", 0) //Small Block Depot |
|
| 246 | - . pack("V", 1) |
|
| 247 | - ); |
|
| 228 | + "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" |
|
| 229 | + . "\x00\x00\x00\x00" |
|
| 230 | + . "\x00\x00\x00\x00" |
|
| 231 | + . "\x00\x00\x00\x00" |
|
| 232 | + . "\x00\x00\x00\x00" |
|
| 233 | + . pack("v", 0x3b) |
|
| 234 | + . pack("v", 0x03) |
|
| 235 | + . pack("v", -2) |
|
| 236 | + . pack("v", 9) |
|
| 237 | + . pack("v", 6) |
|
| 238 | + . pack("v", 0) |
|
| 239 | + . "\x00\x00\x00\x00" |
|
| 240 | + . "\x00\x00\x00\x00" |
|
| 241 | + . pack("V", $iBdCnt) |
|
| 242 | + . pack("V", $iBBcnt+$iSBDcnt) //ROOT START |
|
| 243 | + . pack("V", 0) |
|
| 244 | + . pack("V", 0x1000) |
|
| 245 | + . pack("V", 0) //Small Block Depot |
|
| 246 | + . pack("V", 1) |
|
| 247 | + ); |
|
| 248 | 248 | // Extra BDList Start, Count |
| 249 | 249 | if ($iBdCnt < $i1stBdL) { |
| 250 | 250 | fwrite($FILE, |
| 251 | - pack("V", -2). // Extra BDList Start |
|
| 252 | - pack("V", 0) // Extra BDList Count |
|
| 253 | - ); |
|
| 251 | + pack("V", -2). // Extra BDList Start |
|
| 252 | + pack("V", 0) // Extra BDList Count |
|
| 253 | + ); |
|
| 254 | 254 | } else { |
| 255 | 255 | fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL)); |
| 256 | 256 | } |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
| 270 | - * Saving big data (PPS's with data bigger than OLE_DATA_SIZE_SMALL) |
|
| 271 | - * |
|
| 272 | - * @access private |
|
| 273 | - * @param integer $iStBlk |
|
| 274 | - * @param array &$raList Reference to array of PPS's |
|
| 275 | - */ |
|
| 270 | + * Saving big data (PPS's with data bigger than OLE_DATA_SIZE_SMALL) |
|
| 271 | + * |
|
| 272 | + * @access private |
|
| 273 | + * @param integer $iStBlk |
|
| 274 | + * @param array &$raList Reference to array of PPS's |
|
| 275 | + */ |
|
| 276 | 276 | function _saveBigData($iStBlk, &$raList) |
| 277 | 277 | { |
| 278 | 278 | $FILE = $this->_FILEH_; |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | - * get small data (PPS's with data smaller than OLE_DATA_SIZE_SMALL) |
|
| 322 | - * |
|
| 323 | - * @access private |
|
| 324 | - * @param array &$raList Reference to array of PPS's |
|
| 325 | - */ |
|
| 321 | + * get small data (PPS's with data smaller than OLE_DATA_SIZE_SMALL) |
|
| 322 | + * |
|
| 323 | + * @access private |
|
| 324 | + * @param array &$raList Reference to array of PPS's |
|
| 325 | + */ |
|
| 326 | 326 | function _makeSmallData(&$raList) |
| 327 | 327 | { |
| 328 | 328 | $sRes = ''; |
@@ -374,11 +374,11 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | /** |
| 377 | - * Saves all the PPS's WKs |
|
| 378 | - * |
|
| 379 | - * @access private |
|
| 380 | - * @param array $raList Reference to an array with all PPS's |
|
| 381 | - */ |
|
| 377 | + * Saves all the PPS's WKs |
|
| 378 | + * |
|
| 379 | + * @access private |
|
| 380 | + * @param array $raList Reference to an array with all PPS's |
|
| 381 | + */ |
|
| 382 | 382 | function _savePps(&$raList) |
| 383 | 383 | { |
| 384 | 384 | // Save each PPS WK |
@@ -396,13 +396,13 @@ discard block |
||
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
| 399 | - * Saving Big Block Depot |
|
| 400 | - * |
|
| 401 | - * @access private |
|
| 402 | - * @param integer $iSbdSize |
|
| 403 | - * @param integer $iBsize |
|
| 404 | - * @param integer $iPpsCnt |
|
| 405 | - */ |
|
| 399 | + * Saving Big Block Depot |
|
| 400 | + * |
|
| 401 | + * @access private |
|
| 402 | + * @param integer $iSbdSize |
|
| 403 | + * @param integer $iBsize |
|
| 404 | + * @param integer $iPpsCnt |
|
| 405 | + */ |
|
| 406 | 406 | function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) |
| 407 | 407 | { |
| 408 | 408 | $FILE = $this->_FILEH_; |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | // Initial Setting for saving |
| 91 | 91 | $this->_BIG_BLOCK_SIZE = pow(2, |
| 92 | - ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9)); |
|
| 93 | - $this->_SMALL_BLOCK_SIZE= pow(2, |
|
| 94 | - ((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6)); |
|
| 92 | + ((isset($this->_BIG_BLOCK_SIZE)) ? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9)); |
|
| 93 | + $this->_SMALL_BLOCK_SIZE = pow(2, |
|
| 94 | + ((isset($this->_SMALL_BLOCK_SIZE)) ? $this->_adjust2($this->_SMALL_BLOCK_SIZE) : 6)); |
|
| 95 | 95 | |
| 96 | 96 | // Open temp file if we are sending output to stdout |
| 97 | 97 | if (($filename == '-') || ($filename == '')) { |
| 98 | 98 | $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root"); |
| 99 | - $this->_FILEH_ = @fopen($this->_tmp_filename,"w+b"); |
|
| 99 | + $this->_FILEH_ = @fopen($this->_tmp_filename, "w+b"); |
|
| 100 | 100 | if ($this->_FILEH_ == false) { |
| 101 | 101 | return $this->raiseError("Can't create temporary file."); |
| 102 | 102 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | function _calcSize(&$raList) |
| 148 | 148 | { |
| 149 | 149 | // Calculate Basic Setting |
| 150 | - list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0); |
|
| 150 | + list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0, 0, 0); |
|
| 151 | 151 | $iSmallLen = 0; |
| 152 | 152 | $iSBcnt = 0; |
| 153 | 153 | for ($i = 0; $i < count($raList); $i++) { |
@@ -155,21 +155,21 @@ discard block |
||
| 155 | 155 | $raList[$i]->Size = $raList[$i]->_DataLen(); |
| 156 | 156 | if ($raList[$i]->Size < OLE_DATA_SIZE_SMALL) { |
| 157 | 157 | $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) |
| 158 | - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); |
|
| 158 | + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); |
|
| 159 | 159 | } else { |
| 160 | 160 | $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + |
| 161 | - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
| 161 | + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE; |
| 166 | 166 | $iSlCnt = floor($this->_BIG_BLOCK_SIZE / OLE_LONG_INT_SIZE); |
| 167 | - $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0); |
|
| 168 | - $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + |
|
| 169 | - (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
| 167 | + $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0); |
|
| 168 | + $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + |
|
| 169 | + (($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
| 170 | 170 | $iCnt = count($raList); |
| 171 | 171 | $iBdCnt = $this->_BIG_BLOCK_SIZE / OLE_PPS_SIZE; |
| 172 | - $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0)); |
|
| 172 | + $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0)); |
|
| 173 | 173 | |
| 174 | 174 | return array($iSBDcnt, $iBBcnt, $iPPScnt); |
| 175 | 175 | } |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | function _adjust2($i2) |
| 186 | 186 | { |
| 187 | - $iWk = log($i2)/log(2); |
|
| 188 | - return ($iWk > floor($iWk))? floor($iWk)+1:$iWk; |
|
| 187 | + $iWk = log($i2) / log(2); |
|
| 188 | + return ($iWk > floor($iWk)) ? floor($iWk) + 1 : $iWk; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -207,17 +207,17 @@ discard block |
||
| 207 | 207 | $iBdExL = 0; |
| 208 | 208 | $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; |
| 209 | 209 | $iAllW = $iAll; |
| 210 | - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); |
|
| 211 | - $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0); |
|
| 210 | + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); |
|
| 211 | + $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); |
|
| 212 | 212 | |
| 213 | 213 | // Calculate BD count |
| 214 | 214 | if ($iBdCnt > $i1stBdL) { |
| 215 | 215 | while (1) { |
| 216 | 216 | $iBdExL++; |
| 217 | 217 | $iAllW++; |
| 218 | - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); |
|
| 219 | - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0); |
|
| 220 | - if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) { |
|
| 218 | + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); |
|
| 219 | + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); |
|
| 220 | + if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) { |
|
| 221 | 221 | break; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | . "\x00\x00\x00\x00" |
| 240 | 240 | . "\x00\x00\x00\x00" |
| 241 | 241 | . pack("V", $iBdCnt) |
| 242 | - . pack("V", $iBBcnt+$iSBDcnt) //ROOT START |
|
| 242 | + . pack("V", $iBBcnt + $iSBDcnt) //ROOT START |
|
| 243 | 243 | . pack("V", 0) |
| 244 | 244 | . pack("V", 0x1000) |
| 245 | 245 | . pack("V", 0) //Small Block Depot |
@@ -248,19 +248,19 @@ discard block |
||
| 248 | 248 | // Extra BDList Start, Count |
| 249 | 249 | if ($iBdCnt < $i1stBdL) { |
| 250 | 250 | fwrite($FILE, |
| 251 | - pack("V", -2). // Extra BDList Start |
|
| 251 | + pack("V", -2).// Extra BDList Start |
|
| 252 | 252 | pack("V", 0) // Extra BDList Count |
| 253 | 253 | ); |
| 254 | 254 | } else { |
| 255 | - fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL)); |
|
| 255 | + fwrite($FILE, pack("V", $iAll + $iBdCnt).pack("V", $iBdExL)); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // BDList |
| 259 | 259 | for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; $i++) { |
| 260 | - fwrite($FILE, pack("V", $iAll+$i)); |
|
| 260 | + fwrite($FILE, pack("V", $iAll + $i)); |
|
| 261 | 261 | } |
| 262 | 262 | if ($i < $i1stBdL) { |
| 263 | - for ($j = 0; $j < ($i1stBdL-$i); $j++) { |
|
| 263 | + for ($j = 0; $j < ($i1stBdL - $i); $j++) { |
|
| 264 | 264 | fwrite($FILE, (pack("V", -1))); |
| 265 | 265 | } |
| 266 | 266 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | if (isset($raList[$i]->_PPS_FILE)) { |
| 289 | 289 | $iLen = 0; |
| 290 | 290 | fseek($raList[$i]->_PPS_FILE, 0); // To The Top |
| 291 | - while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) { |
|
| 291 | + while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) { |
|
| 292 | 292 | $iLen += strlen($sBuff); |
| 293 | 293 | fwrite($FILE, $sBuff); |
| 294 | 294 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $raList[$i]->_StartBlock = $iStBlk; |
| 306 | 306 | $iStBlk += |
| 307 | 307 | (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + |
| 308 | - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
| 308 | + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
| 309 | 309 | } |
| 310 | 310 | // Close file for each PPS, and unlink it |
| 311 | 311 | if (isset($raList[$i]->_PPS_FILE)) { |
@@ -337,10 +337,10 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | if ($raList[$i]->Size < OLE_DATA_SIZE_SMALL) { |
| 339 | 339 | $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) |
| 340 | - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); |
|
| 340 | + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); |
|
| 341 | 341 | // Add to SBD |
| 342 | - for ($j = 0; $j < ($iSmbCnt-1); $j++) { |
|
| 343 | - fwrite($FILE, pack("V", $j+$iSmBlk+1)); |
|
| 342 | + for ($j = 0; $j < ($iSmbCnt - 1); $j++) { |
|
| 343 | + fwrite($FILE, pack("V", $j + $iSmBlk + 1)); |
|
| 344 | 344 | } |
| 345 | 345 | fwrite($FILE, pack("V", -2)); |
| 346 | 346 | |
@@ -413,16 +413,16 @@ discard block |
||
| 413 | 413 | $iBdExL = 0; |
| 414 | 414 | $iAll = $iBsize + $iPpsCnt + $iSbdSize; |
| 415 | 415 | $iAllW = $iAll; |
| 416 | - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); |
|
| 417 | - $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0); |
|
| 416 | + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); |
|
| 417 | + $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); |
|
| 418 | 418 | // Calculate BD count |
| 419 | - if ($iBdCnt >$i1stBdL) { |
|
| 419 | + if ($iBdCnt > $i1stBdL) { |
|
| 420 | 420 | while (1) { |
| 421 | 421 | $iBdExL++; |
| 422 | 422 | $iAllW++; |
| 423 | - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); |
|
| 424 | - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0); |
|
| 425 | - if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) { |
|
| 423 | + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); |
|
| 424 | + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); |
|
| 425 | + if ($iBdCnt <= ($iBdExL * $iBbCnt + $i1stBdL)) { |
|
| 426 | 426 | break; |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -432,19 +432,19 @@ discard block |
||
| 432 | 432 | // Set for SBD |
| 433 | 433 | if ($iSbdSize > 0) { |
| 434 | 434 | for ($i = 0; $i < ($iSbdSize - 1); $i++) { |
| 435 | - fwrite($FILE, pack("V", $i+1)); |
|
| 435 | + fwrite($FILE, pack("V", $i + 1)); |
|
| 436 | 436 | } |
| 437 | 437 | fwrite($FILE, pack("V", -2)); |
| 438 | 438 | } |
| 439 | 439 | // Set for B |
| 440 | 440 | for ($i = 0; $i < ($iBsize - 1); $i++) { |
| 441 | - fwrite($FILE, pack("V", $i+$iSbdSize+1)); |
|
| 441 | + fwrite($FILE, pack("V", $i + $iSbdSize + 1)); |
|
| 442 | 442 | } |
| 443 | 443 | fwrite($FILE, pack("V", -2)); |
| 444 | 444 | |
| 445 | 445 | // Set for PPS |
| 446 | 446 | for ($i = 0; $i < ($iPpsCnt - 1); $i++) { |
| 447 | - fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1)); |
|
| 447 | + fwrite($FILE, pack("V", $i + $iSbdSize + $iBsize + 1)); |
|
| 448 | 448 | } |
| 449 | 449 | fwrite($FILE, pack("V", -2)); |
| 450 | 450 | // Set for BBD itself ( 0xFFFFFFFD : BBD) |
@@ -463,17 +463,17 @@ discard block |
||
| 463 | 463 | } |
| 464 | 464 | // Extra BDList |
| 465 | 465 | if ($iBdCnt > $i1stBdL) { |
| 466 | - $iN=0; |
|
| 467 | - $iNb=0; |
|
| 468 | - for ($i = $i1stBdL;$i < $iBdCnt; $i++, $iN++) { |
|
| 466 | + $iN = 0; |
|
| 467 | + $iNb = 0; |
|
| 468 | + for ($i = $i1stBdL; $i < $iBdCnt; $i++, $iN++) { |
|
| 469 | 469 | if ($iN >= ($iBbCnt - 1)) { |
| 470 | 470 | $iN = 0; |
| 471 | 471 | $iNb++; |
| 472 | - fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb)); |
|
| 472 | + fwrite($FILE, pack("V", $iAll + $iBdCnt + $iNb)); |
|
| 473 | 473 | } |
| 474 | - fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i)); |
|
| 474 | + fwrite($FILE, pack("V", $iBsize + $iSbdSize + $iPpsCnt + $i)); |
|
| 475 | 475 | } |
| 476 | - if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) { |
|
| 476 | + if (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)) { |
|
| 477 | 477 | for ($i = 0; $i < (($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1))); $i++) { |
| 478 | 478 | fwrite($FILE, pack("V", -1)); |
| 479 | 479 | } |
@@ -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='') |
@@ -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 | } |
@@ -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 | } |
@@ -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"'; |