Completed
Push — 1.10.x ( 4aad0c...aa45e4 )
by Angel Fernando Quiroz
338:27 queued 288:42
created
main/inc/lib/pear/OLE/PPS/Root.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -32,41 +32,41 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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_;
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/Common.php 3 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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='')
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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     = '&lt;&lt; Back';
253
+    var $_prevImg = '&lt;&lt; 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
 block discarded – undo
265 265
      * @var string image/text to use as "next" link
266 266
      * @access private
267 267
      */
268
-    var $_nextImg     = 'Next &gt;&gt;';
268
+    var $_nextImg = 'Next &gt;&gt;';
269 269
 
270 270
     /**
271 271
      * image/text to use as "next" link when
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
1463 1463
         if ($separator == '&amp;') {
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
 block discarded – undo
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 == '&amp;') {
1500 1500
             $separator = '&'; //the string is escaped by htmlentities anyway...
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/HtmlWidgets.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;',
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                         '/(&|&amp;|\?)('.$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
 block discarded – undo
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
 block discarded – undo
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
                     //    '/(&|&amp;|\?)('.$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
                         '/(&|&amp;|\?)('.$this->pager->_urlVar.'=)(\d+)/',
251 251
                         '\\1\\2'.$selector,
252 252
                         api_htmlentities($href)
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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"';
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/Sliding.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
      *
108 108
      * @param integer $pageid PageID to get offsets for
109 109
      *
110
-     * @return array  First and last offsets
110
+     * @return integer[]  First and last offsets
111 111
      * @access public
112 112
      */
113 113
     function getPageRangeByPageId($pageid = null)
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
                     $this->range[$i] = false;
235 235
                     $this->_linkData[$this->_urlVar] = $i;
236 236
                     $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i)
237
-                           . $this->_spacesBefore
238
-                           . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : '');
237
+                            . $this->_spacesBefore
238
+                            . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : '');
239 239
                 }
240 240
             }
241 241
 
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
                     $this->range[$i] = false;
269 269
                     $this->_linkData[$this->_urlVar] = $i;
270 270
                     $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i)
271
-                      . $this->_spacesBefore
272
-                      . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : '');
271
+                        . $this->_spacesBefore
272
+                        . ($print_separator_flag ? $this->_separator.$this->_spacesAfter : '');
273 273
                 }
274 274
             }
275 275
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                     $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost;
286 286
                 }
287 287
                 $links .= $this->_spacesBefore
288
-                       . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
288
+                        . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
289 289
             }
290 290
         }
291 291
         return $links;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     function getPageRangeByPageId($pageid = null)
114 114
     {
115
-        $pageid = isset($pageid) ? (int)$pageid : $this->_currentPage;
115
+        $pageid = isset($pageid) ? (int) $pageid : $this->_currentPage;
116 116
         if (!isset($this->_pageData)) {
117 117
             $this->_generatePageData();
118 118
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      * @return array back/pages/next/first/last/all links
147 147
      * @access public
148 148
      */
149
-    function getLinks($pageID = null, $dummy='')
149
+    function getLinks($pageID = null, $dummy = '')
150 150
     {
151 151
         if (!is_null($pageID)) {
152 152
             $_sav = $this->_currentPage;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
                 if ($i == $this->_currentPage) {
253 253
                     $this->range[$i] = true;
254
-                    $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost;
254
+                    $links .= $this->_curPageSpanPre.$i.$this->_curPageSpanPost;
255 255
                 } else {
256 256
                     $this->range[$i] = false;
257 257
                     $this->_linkData[$this->_urlVar] = $i;
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
             }
263 263
 
264 264
             if ($this->_expanded && $expansion_after) {
265
-                $links .= $this->_separator . $this->_spacesAfter;
266
-                for ($i = $this->_currentPage + $this->_delta +1; $expansion_after; $expansion_after--, $i++) {
265
+                $links .= $this->_separator.$this->_spacesAfter;
266
+                for ($i = $this->_currentPage + $this->_delta + 1; $expansion_after; $expansion_after--, $i++) {
267 267
                     $print_separator_flag = ($expansion_after != 1);
268 268
                     $this->range[$i] = false;
269 269
                     $this->_linkData[$this->_urlVar] = $i;
@@ -275,14 +275,14 @@  discard block
 block discarded – undo
275 275
 
276 276
         } else {
277 277
             //if $this->_totalPages <= (2*Delta+1) show them all
278
-            for ($i=1; $i<=$this->_totalPages; $i++) {
278
+            for ($i = 1; $i <= $this->_totalPages; $i++) {
279 279
                 if ($i != $this->_currentPage) {
280 280
                     $this->range[$i] = false;
281 281
                     $this->_linkData[$this->_urlVar] = $i;
282 282
                     $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i);
283 283
                 } else {
284 284
                     $this->range[$i] = true;
285
-                    $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost;
285
+                    $links .= $this->_curPageSpanPre.$i.$this->_curPageSpanPost;
286 286
                 }
287 287
                 $links .= $this->_spacesBefore
288 288
                        . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
Please login to merge, or discard this patch.
main/inc/lib/pear/PEAR.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      *                  PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
491 491
      *                  PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
492 492
      *
493
-     * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
493
+     * @param integer|null $options If $mode is PEAR_ERROR_TRIGGER, this parameter
494 494
      *                  specifies the PHP-internal error level (one of
495 495
      *                  E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
496 496
      *                  If $mode is PEAR_ERROR_CALLBACK, this
@@ -581,6 +581,7 @@  discard block
 block discarded – undo
581 581
      * message, code and userinfo are enough.
582 582
      *
583 583
      * @param string $message
584
+     * @param integer $code
584 585
      *
585 586
      */
586 587
     function &throwError($message = null,
@@ -864,7 +865,7 @@  discard block
 block discarded – undo
864 865
      * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
865 866
      * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
866 867
      *
867
-     * @param mixed $options   (optional) error level, _OR_ in the case of
868
+     * @param integer $options   (optional) error level, _OR_ in the case of
868 869
      * PEAR_ERROR_CALLBACK, the callback function or object/method
869 870
      * tuple.
870 871
      *
Please login to merge, or discard this patch.
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 /**#@+
27 27
  * ERROR constants
28 28
  */
29
-define('PEAR_ERROR_RETURN',     1);
30
-define('PEAR_ERROR_PRINT',      2);
31
-define('PEAR_ERROR_TRIGGER',    4);
32
-define('PEAR_ERROR_DIE',        8);
33
-define('PEAR_ERROR_CALLBACK',  16);
29
+define('PEAR_ERROR_RETURN', 1);
30
+define('PEAR_ERROR_PRINT', 2);
31
+define('PEAR_ERROR_TRIGGER', 4);
32
+define('PEAR_ERROR_DIE', 8);
33
+define('PEAR_ERROR_CALLBACK', 16);
34 34
 /**
35 35
  * WARNING: obsolete
36 36
  * @deprecated
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 if (substr(PHP_OS, 0, 3) == 'WIN') {
44 44
     define('OS_WINDOWS', true);
45
-    define('OS_UNIX',    false);
46
-    define('PEAR_OS',    'Windows');
45
+    define('OS_UNIX', false);
46
+    define('PEAR_OS', 'Windows');
47 47
 } else {
48 48
     define('OS_WINDOWS', false);
49
-    define('OS_UNIX',    true);
50
-    define('PEAR_OS',    'Unix'); // blatant assumption
49
+    define('OS_UNIX', true);
50
+    define('PEAR_OS', 'Unix'); // blatant assumption
51 51
 }
52 52
 
53 53
 $GLOBALS['_PEAR_default_error_mode']     = PEAR_ERROR_RETURN;
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
             // $error_code is a non-empty array here;
452 452
             // we walk through it trying to unset all
453 453
             // values
454
-            foreach($error_code as $key => $error) {
454
+            foreach ($error_code as $key => $error) {
455 455
                 if ($this->_checkDelExpect($error)) {
456
-                    $deleted =  true;
456
+                    $deleted = true;
457 457
                 } else {
458 458
                     $deleted = false;
459 459
                 }
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
      */
987 987
     function getMessage()
988 988
     {
989
-        return ($this->error_message_prefix . $this->message);
989
+        return ($this->error_message_prefix.$this->message);
990 990
     }
991 991
 
992 992
 
@@ -1103,8 +1103,7 @@  discard block
 block discarded – undo
1103 1103
         if ($this->mode & PEAR_ERROR_CALLBACK) {
1104 1104
             if (is_array($this->callback)) {
1105 1105
                 $callback = (is_object($this->callback[0]) ?
1106
-                    strtolower(get_class($this->callback[0])) :
1107
-                    $this->callback[0]) . '::' .
1106
+                    strtolower(get_class($this->callback[0])) : $this->callback[0]).'::'.
1108 1107
                     $this->callback[1];
1109 1108
             } else {
1110 1109
                 $callback = $this->callback;
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
     // {{{ getStaticProperty()
206 206
 
207 207
     /**
208
-    * If you have a class that's mostly/entirely static, and you need static
209
-    * properties, you can use this method to simulate them. Eg. in your method(s)
210
-    * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
211
-    * You MUST use a reference, or they will not persist!
212
-    *
213
-    * @access public
214
-    * @param  string $class  The calling classname, to prevent clashes
215
-    * @param  string $var    The variable to retrieve.
216
-    * @return mixed   A reference to the variable. If not set it will be
217
-    *                 auto initialised to NULL.
218
-    */
208
+     * If you have a class that's mostly/entirely static, and you need static
209
+     * properties, you can use this method to simulate them. Eg. in your method(s)
210
+     * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
211
+     * You MUST use a reference, or they will not persist!
212
+     *
213
+     * @access public
214
+     * @param  string $class  The calling classname, to prevent clashes
215
+     * @param  string $var    The variable to retrieve.
216
+     * @return mixed   A reference to the variable. If not set it will be
217
+     *                 auto initialised to NULL.
218
+     */
219 219
     function &getStaticProperty($class, $var)
220 220
     {
221 221
         static $properties;
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
     // {{{ registerShutdownFunc()
235 235
 
236 236
     /**
237
-    * Use this function to register a shutdown method for static
238
-    * classes.
239
-    *
240
-    * @access public
241
-    * @param  mixed $func  The function name (or array of class/method) to call
242
-    * @param  mixed $args  The arguments to pass to the function
243
-    * @return void
244
-    */
237
+     * Use this function to register a shutdown method for static
238
+     * classes.
239
+     *
240
+     * @access public
241
+     * @param  mixed $func  The function name (or array of class/method) to call
242
+     * @param  mixed $args  The arguments to pass to the function
243
+     * @return void
244
+     */
245 245
     function registerShutdownFunc($func, $args = array())
246 246
     {
247 247
         // if we are called statically, there is a potential
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
      * @since PHP 4.0.5
514 514
      */
515 515
     function &raiseError($message = null,
516
-                         $code = null,
517
-                         $mode = null,
518
-                         $options = null,
519
-                         $userinfo = null,
520
-                         $error_class = null,
521
-                         $skipmsg = false)
516
+                            $code = null,
517
+                            $mode = null,
518
+                            $options = null,
519
+                            $userinfo = null,
520
+                            $error_class = null,
521
+                            $skipmsg = false)
522 522
     {
523 523
         // The error is yet a PEAR error object
524 524
         if (is_object($message)) {
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
      *
585 585
      */
586 586
     function &throwError($message = null,
587
-                         $code = null,
588
-                         $userinfo = null)
587
+                            $code = null,
588
+                            $userinfo = null)
589 589
     {
590 590
         if (isset($this) && is_a($this, 'PEAR')) {
591 591
             $a = &$this->raiseError($message, $code, null, null, $userinfo);
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
     // {{{ popErrorHandling()
708 708
 
709 709
     /**
710
-    * Pop the last error handler used
711
-    *
712
-    * @return bool Always true
713
-    *
714
-    * @see PEAR::pushErrorHandling
715
-    */
710
+     * Pop the last error handler used
711
+     *
712
+     * @return bool Always true
713
+     *
714
+     * @see PEAR::pushErrorHandling
715
+     */
716 716
     function popErrorHandling()
717 717
     {
718 718
         $stack = &$GLOBALS['_PEAR_error_handler_stack'];
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
     // {{{ loadExtension()
732 732
 
733 733
     /**
734
-    * OS independant PHP extension load. Remember to take care
735
-    * on the correct extension name for case sensitive OSes.
736
-    *
737
-    * @param string $ext The extension name
738
-    * @return bool Success or not on the dl() call
739
-    */
734
+     * OS independant PHP extension load. Remember to take care
735
+     * on the correct extension name for case sensitive OSes.
736
+     *
737
+     * @param string $ext The extension name
738
+     * @return bool Success or not on the dl() call
739
+     */
740 740
     function loadExtension($ext)
741 741
     {
742 742
         if (!extension_loaded($ext)) {
@@ -999,10 +999,10 @@  discard block
 block discarded – undo
999 999
      * @return int error code
1000 1000
      * @access public
1001 1001
      */
1002
-     function getCode()
1003
-     {
1002
+        function getCode()
1003
+        {
1004 1004
         return $this->code;
1005
-     }
1005
+        }
1006 1006
 
1007 1007
     // }}}
1008 1008
     // {{{ getType()
@@ -1110,10 +1110,10 @@  discard block
 block discarded – undo
1110 1110
                 $callback = $this->callback;
1111 1111
             }
1112 1112
             return sprintf('[%s: message="%s" code=%d mode=callback '.
1113
-                           'callback=%s prefix="%s" info="%s"]',
1114
-                           strtolower(get_class($this)), $this->message, $this->code,
1115
-                           $callback, $this->error_message_prefix,
1116
-                           $this->userinfo);
1113
+                            'callback=%s prefix="%s" info="%s"]',
1114
+                            strtolower(get_class($this)), $this->message, $this->code,
1115
+                            $callback, $this->error_message_prefix,
1116
+                            $this->userinfo);
1117 1117
         }
1118 1118
         if ($this->mode & PEAR_ERROR_PRINT) {
1119 1119
             $modes[] = 'print';
@@ -1128,11 +1128,11 @@  discard block
 block discarded – undo
1128 1128
             $modes[] = 'return';
1129 1129
         }
1130 1130
         return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
1131
-                       'prefix="%s" info="%s"]',
1132
-                       strtolower(get_class($this)), $this->message, $this->code,
1133
-                       implode("|", $modes), $levels[$this->level],
1134
-                       $this->error_message_prefix,
1135
-                       $this->userinfo);
1131
+                        'prefix="%s" info="%s"]',
1132
+                        strtolower(get_class($this)), $this->message, $this->code,
1133
+                        implode("|", $modes), $levels[$this->level],
1134
+                        $this->error_message_prefix,
1135
+                        $this->userinfo);
1136 1136
     }
1137 1137
 
1138 1138
     // }}}
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Engine/native.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -147,6 +147,7 @@  discard block
 block discarded – undo
147 147
      * the two files do not match, and likewise that the last lines do not
148 148
      * match.  The caller must trim matching lines from the beginning and end
149 149
      * of the portions it is going to specify.
150
+     * @param double $nchunks
150 151
      */
151 152
     function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
152 153
     {
@@ -267,6 +268,10 @@  discard block
 block discarded – undo
267 268
      *
268 269
      * Note that XLIM, YLIM are exclusive bounds.  All line numbers are
269 270
      * origin-0 and discarded lines are not counted.
271
+     * @param integer $xoff
272
+     * @param integer $xlim
273
+     * @param integer $yoff
274
+     * @param integer $ylim
270 275
      */
271 276
     function _compareseq ($xoff, $xlim, $yoff, $ylim)
272 277
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      * match.  The caller must trim matching lines from the beginning and end
149 149
      * of the portions it is going to specify.
150 150
      */
151
-    function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
151
+    function _diag($xoff, $xlim, $yoff, $ylim, $nchunks)
152 152
     {
153 153
         $flip = false;
154 154
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         }
172 172
 
173 173
         $this->lcs = 0;
174
-        $this->seq[0]= $yoff - 1;
174
+        $this->seq[0] = $yoff - 1;
175 175
         $this->in_seq = array();
176 176
         $ymids[0] = array();
177 177
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                 }
185 185
             }
186 186
 
187
-            $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
187
+            $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $chunk) / $nchunks);
188 188
             for (; $x < $x1; $x++) {
189 189
                 $line = $flip ? $this->yv[$x] : $this->xv[$x];
190 190
                 if (empty($ymatches[$line])) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
221 221
         $ymid = $ymids[$this->lcs];
222 222
         for ($n = 0; $n < $nchunks - 1; $n++) {
223
-            $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
223
+            $x1 = $xoff + (int) (($numer + ($xlim - $xoff) * $n) / $nchunks);
224 224
             $y1 = $ymid[$n] + 1;
225 225
             $seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
226 226
         }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
         $beg = 1;
242 242
         while ($beg < $end) {
243
-            $mid = (int)(($beg + $end) / 2);
243
+            $mid = (int) (($beg + $end) / 2);
244 244
             if ($ypos > $this->seq[$mid]) {
245 245
                 $beg = $mid + 1;
246 246
             } else {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
      * Note that XLIM, YLIM are exclusive bounds.  All line numbers are
269 269
      * origin-0 and discarded lines are not counted.
270 270
      */
271
-    function _compareseq ($xoff, $xlim, $yoff, $ylim)
271
+    function _compareseq($xoff, $xlim, $yoff, $ylim)
272 272
     {
273 273
         /* Slide down the bottom initial diagonal. */
274 274
         while ($xoff < $xlim && $yoff < $ylim
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             reset($seps);
310 310
             $pt1 = $seps[0];
311 311
             while ($pt2 = next($seps)) {
312
-                $this->_compareseq ($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
312
+                $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]);
313 313
                 $pt1 = $pt2;
314 314
             }
315 315
         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                 $j++;
353 353
             }
354 354
 
355
-            while ($i < $len && ! $changed[$i]) {
355
+            while ($i < $len && !$changed[$i]) {
356 356
                 assert('$j < $other_len && ! $other_changed[$j]');
357 357
                 $i++; $j++;
358 358
                 while ($j < $other_len && $other_changed[$j]) {
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Renderer.php 4 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -143,6 +143,12 @@  discard block
 block discarded – undo
143 143
         return $output . $this->_endDiff();
144 144
     }
145 145
 
146
+    /**
147
+     * @param integer $xbeg
148
+     * @param integer $xlen
149
+     * @param integer $ybeg
150
+     * @param integer $ylen
151
+     */
146 152
     function _block($xbeg, $xlen, $ybeg, $ylen, &$edits)
147 153
     {
148 154
         $output = $this->_startBlock($this->_blockHeader($xbeg, $xlen, $ybeg, $ylen));
@@ -199,6 +205,9 @@  discard block
 block discarded – undo
199 205
         return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
200 206
     }
201 207
 
208
+    /**
209
+     * @param string $header
210
+     */
202 211
     function _startBlock($header)
203 212
     {
204 213
         return $header . "\n";
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
                         }
105 105
                         /* @todo */
106 106
                         $output .= $this->_block($x0, $ntrail + $xi - $x0,
107
-                                                 $y0, $ntrail + $yi - $y0,
108
-                                                 $block);
107
+                                                    $y0, $ntrail + $yi - $y0,
108
+                                                    $block);
109 109
                         $block = false;
110 110
                     }
111 111
                 }
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 
137 137
         if (is_array($block)) {
138 138
             $output .= $this->_block($x0, $xi - $x0,
139
-                                     $y0, $yi - $y0,
140
-                                     $block);
139
+                                        $y0, $yi - $y0,
140
+                                        $block);
141 141
         }
142 142
 
143 143
         return $output . $this->_endDiff();
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -149,21 +149,21 @@
 block discarded – undo
149 149
 
150 150
         foreach ($edits as $edit) {
151 151
             switch (strtolower(get_class($edit))) {
152
-            case 'text_diff_op_copy':
153
-                $output .= $this->_context($edit->orig);
154
-                break;
152
+                case 'text_diff_op_copy':
153
+                    $output .= $this->_context($edit->orig);
154
+                    break;
155 155
 
156
-            case 'text_diff_op_add':
157
-                $output .= $this->_added($edit->final);
158
-                break;
156
+                case 'text_diff_op_add':
157
+                    $output .= $this->_added($edit->final);
158
+                    break;
159 159
 
160
-            case 'text_diff_op_delete':
161
-                $output .= $this->_deleted($edit->orig);
162
-                break;
160
+                case 'text_diff_op_delete':
161
+                    $output .= $this->_deleted($edit->orig);
162
+                    break;
163 163
 
164
-            case 'text_diff_op_change':
165
-                $output .= $this->_changed($edit->orig, $edit->final);
166
-                break;
164
+                case 'text_diff_op_change':
165
+                    $output .= $this->_changed($edit->orig, $edit->final);
166
+                    break;
167 167
             }
168 168
         }
169 169
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     function Text_Diff_Renderer($params = array())
39 39
     {
40 40
         foreach ($params as $param => $value) {
41
-            $v = '_' . $param;
41
+            $v = '_'.$param;
42 42
             if (isset($this->$v)) {
43 43
                 $this->$v = $value;
44 44
             }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                                      $block);
141 141
         }
142 142
 
143
-        return $output . $this->_endDiff();
143
+        return $output.$this->_endDiff();
144 144
     }
145 145
 
146 146
     function _block($xbeg, $xlen, $ybeg, $ylen, &$edits)
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             }
168 168
         }
169 169
 
170
-        return $output . $this->_endBlock();
170
+        return $output.$this->_endBlock();
171 171
     }
172 172
 
173 173
     function _startDiff()
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
     function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
184 184
     {
185 185
         if ($xlen > 1) {
186
-            $xbeg .= ',' . ($xbeg + $xlen - 1);
186
+            $xbeg .= ','.($xbeg + $xlen - 1);
187 187
         }
188 188
         if ($ylen > 1) {
189
-            $ybeg .= ',' . ($ybeg + $ylen - 1);
189
+            $ybeg .= ','.($ybeg + $ylen - 1);
190 190
         }
191 191
 
192 192
         // this matches the GNU Diff behaviour
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
             $xbeg--;
197 197
         }
198 198
 
199
-        return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg;
199
+        return $xbeg.($xlen ? ($ylen ? 'c' : 'd') : 'a').$ybeg;
200 200
     }
201 201
 
202 202
     function _startBlock($header)
203 203
     {
204
-        return $header . "\n";
204
+        return $header."\n";
205 205
     }
206 206
 
207 207
     function _endBlock()
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
     function _lines($lines, $prefix = ' ')
213 213
     {
214
-        return $prefix . implode("\n$prefix", $lines) . "\n";
214
+        return $prefix.implode("\n$prefix", $lines)."\n";
215 215
     }
216 216
 
217 217
     function _context($lines)
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
     function _changed($orig, $final)
233 233
     {
234
-        return $this->_deleted($orig) . "---\n" . $this->_added($final);
234
+        return $this->_deleted($orig)."---\n".$this->_added($final);
235 235
     }
236 236
 
237 237
 }
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Renderer/inline.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -74,6 +74,9 @@  discard block
 block discarded – undo
74 74
         return $header;
75 75
     }
76 76
 
77
+    /**
78
+     * @param string[] $lines
79
+     */
77 80
     function _lines($lines, $prefix = ' ', $encode = true)
78 81
     {
79 82
         if ($encode) {
@@ -141,6 +144,9 @@  discard block
 block discarded – undo
141 144
         return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
142 145
     }
143 146
 
147
+    /**
148
+     * @param string $string
149
+     */
144 150
     function _splitOnWords($string, $newlineEscape = "\n")
145 151
     {
146 152
         // Ignore \0; otherwise the while loop will never finish.
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,13 +129,13 @@
 block discarded – undo
129 129
          * preserve whitespace as well. Therefore we split on words,
130 130
          * but include all blocks of whitespace in the wordlist. */
131 131
         $diff = new Text_Diff('native',
132
-                              array($this->_splitOnWords($text1, $nl),
132
+                                array($this->_splitOnWords($text1, $nl),
133 133
                                     $this->_splitOnWords($text2, $nl)));
134 134
 
135 135
         /* Get the diff in inline format. */
136 136
         $renderer = new Text_Diff_Renderer_inline
137 137
             (array_merge($this->getParams(),
138
-                         array('split_level' => 'words')));
138
+                            array('split_level' => 'words')));
139 139
 
140 140
         /* Run the diff and get the output. */
141 141
         return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
Please login to merge, or discard this patch.
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
         if ($this->_split_level == 'words') {
84 84
             return implode('', $lines);
85 85
         } else {
86
-            return implode("\n", $lines) . "\n";
86
+            return implode("\n", $lines)."\n";
87 87
         }
88 88
     }
89 89
 
90 90
     function _added($lines)
91 91
     {
92 92
         array_walk($lines, array(&$this, '_encode'));
93
-        $lines[0] = $this->_ins_prefix . $lines[0];
93
+        $lines[0] = $this->_ins_prefix.$lines[0];
94 94
         $lines[count($lines) - 1] .= $this->_ins_suffix;
95 95
         return $this->_lines($lines, ' ', false);
96 96
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     function _deleted($lines, $words = false)
99 99
     {
100 100
         array_walk($lines, array(&$this, '_encode'));
101
-        $lines[0] = $this->_del_prefix . $lines[0];
101
+        $lines[0] = $this->_del_prefix.$lines[0];
102 102
         $lines[count($lines) - 1] .= $this->_del_suffix;
103 103
         return $this->_lines($lines, ' ', false);
104 104
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                 $orig[0] = substr($orig[0], 1);
117 117
                 $final[0] = substr($final[0], 1);
118 118
             }
119
-            return $prefix . $this->_deleted($orig) . $this->_added($final);
119
+            return $prefix.$this->_deleted($orig).$this->_added($final);
120 120
         }
121 121
 
122 122
         $text1 = implode("\n", $orig);
@@ -133,12 +133,11 @@  discard block
 block discarded – undo
133 133
                                     $this->_splitOnWords($text2, $nl)));
134 134
 
135 135
         /* Get the diff in inline format. */
136
-        $renderer = new Text_Diff_Renderer_inline
137
-            (array_merge($this->getParams(),
136
+        $renderer = new Text_Diff_Renderer_inline(array_merge($this->getParams(),
138 137
                          array('split_level' => 'words')));
139 138
 
140 139
         /* Run the diff and get the output. */
141
-        return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
140
+        return str_replace($nl, "\n", $renderer->render($diff))."\n";
142 141
     }
143 142
 
144 143
     function _splitOnWords($string, $newlineEscape = "\n")
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Password.php 4 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -180,6 +180,7 @@  discard block
 block discarded – undo
180 180
      * @access private
181 181
      * @param  string  Login
182 182
      * @param  integer Key
183
+     * @param integer $key
183 184
      * @return string
184 185
      */
185 186
     function _xor($login, $key)
@@ -208,6 +209,7 @@  discard block
 block discarded – undo
208 209
      * @access private
209 210
      * @param  string  Login
210 211
      * @param  integer Key
212
+     * @param integer $key
211 213
      * @return string
212 214
      */
213 215
     function _rotx($login, $key)
@@ -241,6 +243,7 @@  discard block
 block discarded – undo
241 243
      * @access private
242 244
      * @param  string  Login
243 245
      * @param  integer Key
246
+     * @param integer $key
244 247
      * @return string
245 248
      */
246 249
     function _rotxpp($login, $key)
@@ -274,6 +277,7 @@  discard block
 block discarded – undo
274 277
      * @access private
275 278
      * @param  string  Login
276 279
      * @param  integer Key
280
+     * @param integer $key
277 281
      * @return string
278 282
      */
279 283
     function _rotxmm($login, $key)
@@ -306,6 +310,7 @@  discard block
 block discarded – undo
306 310
      * @access private
307 311
      * @param  string  Login
308 312
      * @param  integer Key
313
+     * @param integer $key
309 314
      * @return string
310 315
      */
311 316
     function _asciiRotx($login, $key)
@@ -340,6 +345,7 @@  discard block
 block discarded – undo
340 345
      * @access private
341 346
      * @param  string  Login
342 347
      * @param  integer Key
348
+     * @param integer $key
343 349
      * @return string
344 350
      */
345 351
     function _asciiRotxpp($login, $key)
@@ -374,6 +380,7 @@  discard block
 block discarded – undo
374 380
      * @access private
375 381
      * @param  string  Login
376 382
      * @param  integer Key
383
+     * @param integer $key
377 384
      * @return string
378 385
      */
379 386
     function _asciiRotxmm($login, $key)
@@ -430,6 +437,7 @@  discard block
 block discarded – undo
430 437
      *
431 438
      * @access private
432 439
      * @param  integer Length of the password
440
+     * @param integer $length
433 441
      * @return string  Returns the password
434 442
      */
435 443
     function _createPronounceable($length)
@@ -475,6 +483,8 @@  discard block
 block discarded – undo
475 483
      * @param  string  Character which could be use in the
476 484
      *                 unpronounceable password ex : 'ABCDEFG'
477 485
      *                 or numeric, alphabetical or alphanumeric.
486
+     * @param integer $length
487
+     * @param string $chars
478 488
      * @return string  Returns the password
479 489
      */
480 490
     function _createUnpronounceable($length, $chars)
Please login to merge, or discard this patch.
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
          * List of vowels and vowel sounds
442 442
          */
443 443
         $v = array('a', 'e', 'i', 'o', 'u', 'ae', 'ou', 'io',
444
-                   'ea', 'ou', 'ia', 'ai'
445
-                   );
444
+                    'ea', 'ou', 'ia', 'ai'
445
+                    );
446 446
 
447 447
         /**
448 448
          * List of consonants and consonant sounds
449 449
          */
450 450
         $c = array('b', 'c', 'd', 'g', 'h', 'j', 'k', 'l', 'm',
451
-                   'n', 'p', 'r', 's', 't', 'u', 'v', 'w',
452
-                   'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th',
453
-                   'ch', 'ph', 'st', 'sl', 'cl'
454
-                   );
451
+                    'n', 'p', 'r', 's', 't', 'u', 'v', 'w',
452
+                    'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th',
453
+                    'ch', 'ph', 'st', 'sl', 'cl'
454
+                    );
455 455
 
456 456
         $v_count = 12;
457 457
         $c_count = 29;
@@ -484,50 +484,50 @@  discard block
 block discarded – undo
484 484
         /**
485 485
          * List of character which could be use in the password
486 486
          */
487
-         switch($chars) {
487
+            switch($chars) {
488 488
 
489
-         case 'alphanumeric':
489
+            case 'alphanumeric':
490 490
              $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
491
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
-             break;
491
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
+                break;
493 493
 
494
-         case 'alphabetical':
494
+            case 'alphabetical':
495 495
              $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
496
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
-             break;
496
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
+                break;
498 498
 
499
-         case 'numeric':
499
+            case 'numeric':
500 500
              $chars = '0123456789';
501
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
-             break;
501
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
+                break;
503 503
 
504
-         case '':
504
+            case '':
505 505
              $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
506
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
-             break;
506
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
+                break;
508 508
 
509
-         default:
509
+            default:
510 510
              /**
511 511
               * Some characters shouldn't be used
512 512
               */
513 513
              $chars = trim($chars);
514
-             $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
515
-
516
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
517
-         }
518
-
519
-         /**
520
-          * Generate password
521
-          */
522
-         for ($i = 0; $i < $length; $i++) {
523
-             $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1);
524
-             $password .= $chars{$num};
525
-         }
526
-
527
-         /**
528
-          * Return password
529
-          */
530
-         return $password;
514
+                $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
515
+
516
+                $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
517
+            }
518
+
519
+            /**
520
+             * Generate password
521
+             */
522
+            for ($i = 0; $i < $length; $i++) {
523
+                $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1);
524
+                $password .= $chars{$num};
525
+            }
526
+
527
+            /**
528
+             * Return password
529
+             */
530
+            return $password;
531 531
     }
532 532
 }
533 533
 ?>
Please login to merge, or discard this patch.
Switch Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
     function create($length = 10, $type = 'pronounceable', $chars = '')
56 56
     {
57 57
         switch ($type) {
58
-        case 'unpronounceable' :
59
-            return Text_Password::_createUnpronounceable($length, $chars);
58
+            case 'unpronounceable' :
59
+                return Text_Password::_createUnpronounceable($length, $chars);
60 60
 
61
-        case 'pronounceable' :
62
-        default :
63
-            return Text_Password::_createPronounceable($length);
61
+            case 'pronounceable' :
62
+            default :
63
+                return Text_Password::_createPronounceable($length);
64 64
         }
65 65
     }
66 66
 
@@ -110,35 +110,35 @@  discard block
 block discarded – undo
110 110
     function createFromLogin($login, $type, $key = 0)
111 111
     {
112 112
         switch ($type) {
113
-        case 'reverse':
114
-            return strrev($login);
113
+            case 'reverse':
114
+                return strrev($login);
115 115
 
116
-        case 'shuffle':
117
-            return Text_Password::_shuffle($login);
116
+            case 'shuffle':
117
+                return Text_Password::_shuffle($login);
118 118
 
119
-        case 'xor':
120
-            return Text_Password::_xor($login, $key);
119
+            case 'xor':
120
+                return Text_Password::_xor($login, $key);
121 121
 
122
-        case 'rot13':
123
-            return str_rot13($login);
122
+            case 'rot13':
123
+                return str_rot13($login);
124 124
 
125
-        case 'rotx':
126
-            return Text_Password::_rotx($login, $key);
125
+            case 'rotx':
126
+                return Text_Password::_rotx($login, $key);
127 127
 
128
-        case 'rotx++':
129
-            return Text_Password::_rotxpp($login, $key);
128
+            case 'rotx++':
129
+                return Text_Password::_rotxpp($login, $key);
130 130
 
131
-        case 'rotx--':
132
-            return Text_Password::_rotxmm($login, $key);
131
+            case 'rotx--':
132
+                return Text_Password::_rotxmm($login, $key);
133 133
 
134
-        case 'ascii_rotx':
135
-            return Text_Password::_asciiRotx($login, $key);
134
+            case 'ascii_rotx':
135
+                return Text_Password::_asciiRotx($login, $key);
136 136
 
137
-        case 'ascii_rotx++':
138
-            return Text_Password::_asciiRotxpp($login, $key);
137
+            case 'ascii_rotx++':
138
+                return Text_Password::_asciiRotxpp($login, $key);
139 139
 
140
-        case 'ascii_rotx--':
141
-            return Text_Password::_asciiRotxmm($login, $key);
140
+            case 'ascii_rotx--':
141
+                return Text_Password::_asciiRotxmm($login, $key);
142 142
         }
143 143
     }
144 144
 
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
                 $next += 255;
321 321
             }
322 322
             switch ($next) { // delete white space
323
-            case 0x09:
324
-            case 0x20:
325
-            case 0x0A:
326
-            case 0x0D:
327
-                $next++;
323
+                case 0x09:
324
+                case 0x20:
325
+                case 0x0A:
326
+                case 0x0D:
327
+                    $next++;
328 328
             }
329 329
             $tmp .= chr($next);
330 330
         }
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
                 $next += 255;
355 355
             }
356 356
             switch ($next) { // delete white space
357
-            case 0x09:
358
-            case 0x20:
359
-            case 0x0A:
360
-            case 0x0D:
361
-                $next++;
357
+                case 0x09:
358
+                case 0x20:
359
+                case 0x0A:
360
+                case 0x0D:
361
+                    $next++;
362 362
             }
363 363
             $tmp .= chr($next);
364 364
         }
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
                 $next += 255;
389 389
             }
390 390
             switch ($next) { // delete white space
391
-            case 0x09:
392
-            case 0x20:
393
-            case 0x0A:
394
-            case 0x0D:
395
-                $next++;
391
+                case 0x09:
392
+                case 0x20:
393
+                case 0x0A:
394
+                case 0x0D:
395
+                    $next++;
396 396
             }
397 397
             $tmp .= chr($next);
398 398
         }
@@ -486,34 +486,34 @@  discard block
 block discarded – undo
486 486
          */
487 487
          switch($chars) {
488 488
 
489
-         case 'alphanumeric':
490
-             $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
491
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
-             break;
489
+             case 'alphanumeric':
490
+                 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
491
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62;
492
+                 break;
493 493
 
494
-         case 'alphabetical':
495
-             $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
496
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
-             break;
494
+             case 'alphabetical':
495
+                 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
496
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52;
497
+                 break;
498 498
 
499
-         case 'numeric':
500
-             $chars = '0123456789';
501
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
-             break;
499
+             case 'numeric':
500
+                 $chars = '0123456789';
501
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10;
502
+                 break;
503 503
 
504
-         case '':
505
-             $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
506
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
-             break;
504
+             case '':
505
+                 $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
506
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67;
507
+                 break;
508 508
 
509
-         default:
510
-             /**
509
+             default:
510
+                 /**
511 511
               * Some characters shouldn't be used
512 512
               */
513
-             $chars = trim($chars);
514
-             $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
513
+                 $chars = trim($chars);
514
+                 $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars);
515 515
 
516
-             $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
516
+                 $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars);
517 517
          }
518 518
 
519 519
          /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
         $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = $v_count + $c_count;
460 460
 
461 461
         for ($i = 0; $i < $length; $i++) {
462
-            $retVal .= $c[mt_rand(0, $c_count-1)] . $v[mt_rand(0, $v_count-1)];
462
+            $retVal .= $c[mt_rand(0, $c_count - 1)].$v[mt_rand(0, $v_count - 1)];
463 463
         }
464 464
 
465 465
         return substr($retVal, 0, $length);
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
         /**
485 485
          * List of character which could be use in the password
486 486
          */
487
-         switch($chars) {
487
+         switch ($chars) {
488 488
 
489 489
          case 'alphanumeric':
490 490
              $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
Please login to merge, or discard this patch.