GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#1133)
by
unknown
18:02
created
phpmyfaq/services/twitter/clearsessions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 //
28 28
 // Bootstrapping
29 29
 //
30
-require PMF_ROOT_DIR . '/inc/Bootstrap.php';
30
+require PMF_ROOT_DIR.'/inc/Bootstrap.php';
31 31
 
32 32
 if ($faqConfig->get('socialnetworks.twitterConsumerKey') === '' ||
33 33
     $faqConfig->get('socialnetworks.twitterConsumerSecret') === '') {
Please login to merge, or discard this patch.
phpmyfaq/contact.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@
 block discarded – undo
19 19
 
20 20
 if (!defined('IS_VALID_PHPMYFAQ')) {
21 21
     $protocol = 'http';
22
-    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
22
+    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
23 23
         $protocol = 'https';
24 24
     }
25
-    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
25
+    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
26 26
     exit();
27 27
 }
28 28
 
29 29
 $faqsession->userTracking('open_questions', 0);
30 30
 
31
-$tpl->parse (
31
+$tpl->parse(
32 32
     'writeContent',
33 33
     array(
34 34
         'msgOpenQuestions'   => $PMF_LANG['msgOpenQuestions'],
Please login to merge, or discard this patch.
phpmyfaq/sitemap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@
 block discarded – undo
19 19
 
20 20
 if (!defined('IS_VALID_PHPMYFAQ')) {
21 21
     $protocol = 'http';
22
-    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
22
+    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
23 23
         $protocol = 'https';
24 24
     }
25
-    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
25
+    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
26 26
     exit();
27 27
 }
28 28
 
29 29
 $faqsession->userTracking('open_questions', 0);
30 30
 
31
-$tpl->parse (
31
+$tpl->parse(
32 32
     'writeContent',
33 33
     array(
34 34
         'msgOpenQuestions'   => $PMF_LANG['msgOpenQuestions'],
Please login to merge, or discard this patch.
phpmyfaq/admin/ajax.autosave.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     $dateEnd       = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING);
41 41
     $question      = PMF_Filter::filterInput(INPUT_POST, 'question', FILTER_SANITIZE_STRING);
42 42
     $categories    = PMF_Filter::filterInputArray(INPUT_POST, array('rubrik' => array('filter' => FILTER_VALIDATE_INT,
43
-                                                                                      'flags'  => FILTER_REQUIRE_ARRAY)));
43
+                                                                                        'flags'  => FILTER_REQUIRE_ARRAY)));
44 44
     $record_lang   = PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING);
45 45
     $tags          = PMF_Filter::filterInput(INPUT_POST, 'tags', FILTER_SANITIZE_STRING);
46 46
     $active        = PMF_Filter::filterInput(INPUT_POST, 'active', FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 
22 22
 if (!defined('IS_VALID_PHPMYFAQ')) {
23 23
     $protocol = 'http';
24
-    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
24
+    if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
25 25
         $protocol = 'https';
26 26
     }
27
-    header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
27
+    header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
28 28
     exit();
29 29
 }
30 30
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     ($user->perm->checkRight($user->getUserId(), 'editbt') || $user->perm->checkRight($user->getUserId(), 'addbt')) ||
37 37
     'saveentry' === $do && $user->perm->checkRight($user->getUserId(), 'editbt')) {
38 38
 
39
-    $user     = PMF_User_CurrentUser::getFromSession($faqConfig);
39
+    $user = PMF_User_CurrentUser::getFromSession($faqConfig);
40 40
 
41 41
     $dateStart     = PMF_Filter::filterInput(INPUT_POST, 'dateStart', FILTER_SANITIZE_STRING);
42 42
     $dateEnd       = PMF_Filter::filterInput(INPUT_POST, 'dateEnd', FILTER_SANITIZE_STRING);
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
             'email'         => $email,
90 90
             'comment'       => (!is_null($comment) ? 'y' : 'n'),
91 91
             'date'          => empty($date) ? date('YmdHis') : str_replace(array('-', ':', ' '), '', $date),
92
-            'dateStart'     => (empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart) . '000000'),
93
-            'dateEnd'       => (empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd) . '235959'),
92
+            'dateStart'     => (empty($dateStart) ? '00000000000000' : str_replace('-', '', $dateStart).'000000'),
93
+            'dateEnd'       => (empty($dateEnd) ? '99991231235959' : str_replace('-', '', $dateEnd).'235959'),
94 94
             'linkState'     => '',
95 95
             'linkDateCheck' => 0
96 96
         );
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 $faq->addCategoryRelations($categories['rubrik'], $record_id, $recordData['lang']);
145 145
 
146 146
                 if ($tags != '') {
147
-                    $tagging->saveTags($record_id, explode(',',$tags));
147
+                    $tagging->saveTags($record_id, explode(',', $tags));
148 148
                 }
149 149
 
150 150
                 $faq->addPermission('user', $record_id, $restricted_users);
Please login to merge, or discard this patch.
phpmyfaq/inc/PMF/Mail.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -932,7 +932,7 @@
 block discarded – undo
932 932
         }
933 933
         
934 934
         if (false === filter_var($address, FILTER_VALIDATE_EMAIL)) {
935
-          return false;
935
+            return false;
936 936
         }
937 937
         
938 938
         return true;
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         $this->headers     = [];
241 241
         $this->message     = '';
242 242
         $this->messageAlt  = '';
243
-        $this->messageId   = '<'.$_SERVER['REQUEST_TIME'] . '.'. md5(microtime()) . '@' . self::getServerName() . '>';
243
+        $this->messageId   = '<'.$_SERVER['REQUEST_TIME'].'.'.md5(microtime()).'@'.self::getServerName().'>';
244 244
         $this->priority    = 3; // 3 -> Normal
245 245
         $this->subject     = '';
246 246
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         $this->_bcc        = [];
250 250
         $this->_cc         = [];
251 251
         $this->_from       = [];
252
-        $this->_mailer     = 'phpMyFAQ on PHP/' . PHP_VERSION;
252
+        $this->_mailer     = 'phpMyFAQ on PHP/'.PHP_VERSION;
253 253
         $this->_notifyTo   = [];
254 254
         $this->_replyTo    = [];
255 255
         $this->_returnPath = [];
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $this->_to         = [];
258 258
 
259 259
         // Set phpMyFAQ related data
260
-        $this->_mailer = 'phpMyFAQ/' . $this->_config->get('main.currentVersion');
260
+        $this->_mailer = 'phpMyFAQ/'.$this->_config->get('main.currentVersion');
261 261
         $this->setFrom($this->_config->get('main.administrationMail'));
262 262
     }
263 263
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             
305 305
             // Wrap the displayed name in quotes (to fix problems with commas etc),
306 306
             // and escape any existing quotes
307
-            $name = '"' . str_replace('"', '\"', $name) . '"';
307
+            $name = '"'.str_replace('"', '\"', $name).'"';
308 308
         }
309 309
 
310 310
         // Add the e-mail address into the target array
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
         // Disposition-Notification-To, RFC 3798
434 434
         $notifyTos = [];
435
-        foreach($this->_notifyTo as $address => $name) {
435
+        foreach ($this->_notifyTo as $address => $name) {
436 436
             $notifyTos[] = (empty($name) ? '' : $name.' ').'<'.$address.'>';
437 437
         }
438 438
         $notifyTo = implode(',', $notifyTos);
@@ -442,17 +442,17 @@  discard block
 block discarded – undo
442 442
 
443 443
         // From
444 444
         foreach ($this->_from as $address => $name) {
445
-            $this->headers['From'] = (empty($name) ? '' : $name.' ') . '<' . $address . '>';
445
+            $this->headers['From'] = (empty($name) ? '' : $name.' ').'<'.$address.'>';
446 446
         }
447 447
 
448 448
         // CC
449 449
         foreach ($this->_cc as $address => $name) {
450
-            $this->headers['CC'] = (empty($name) ? '' : $name.' ') . '<' . $address . '>';
450
+            $this->headers['CC'] = (empty($name) ? '' : $name.' ').'<'.$address.'>';
451 451
         }
452 452
 
453 453
         // BCC
454 454
         foreach ($this->_bcc as $address => $name) {
455
-            $this->headers['BCC'] = (empty($name) ? '' : $name.' ') . '<' . $address . '>';
455
+            $this->headers['BCC'] = (empty($name) ? '' : $name.' ').'<'.$address.'>';
456 456
         }
457 457
 
458 458
         // Message-Id
@@ -463,21 +463,21 @@  discard block
 block discarded – undo
463 463
 
464 464
         // Reply-To
465 465
         $this->headers['Reply-To'] = $this->headers['From'];
466
-        foreach($this->_replyTo as $address => $name) {
466
+        foreach ($this->_replyTo as $address => $name) {
467 467
             $this->headers['Reply-To'] = (empty($name) ? '' : $name.' ').'<'.$address.'>';
468 468
         }
469 469
 
470 470
         // Return-Path
471
-        foreach($this->_from as $address => $name) {
471
+        foreach ($this->_from as $address => $name) {
472 472
             $this->headers['Return-Path'] = '<'.$address.'>';
473 473
         }
474
-        foreach($this->_returnPath as $address => $name) {
474
+        foreach ($this->_returnPath as $address => $name) {
475 475
             $this->headers['Return-Path'] = '<'.$address.'>';
476 476
         }
477 477
 
478 478
         // Sender
479 479
         $this->headers['Sender'] = $this->headers['From'];
480
-        foreach($this->_sender as $address => $name) {
480
+        foreach ($this->_sender as $address => $name) {
481 481
             $this->headers['Sender'] = (empty($name) ? '' : $name.' ').'<'.$address.'>';
482 482
         }
483 483
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
      */          
622 622
     public static function createBoundary()
623 623
     {
624
-        return '-----'  .md5(microtime());
624
+        return '-----'.md5(microtime());
625 625
     }
626 626
 
627 627
     /**
@@ -637,9 +637,9 @@  discard block
 block discarded – undo
637 637
         // Assure that anything among CRLF, CR will be replaced with just LF
638 638
         $text = str_replace(
639 639
             array(
640
-                "\r\n",// CRLF
640
+                "\r\n", // CRLF
641 641
                 "\r", // CR
642
-                "\n",// LF
642
+                "\n", // LF
643 643
             ),
644 644
             "\n", // LF
645 645
             $text
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
         // Prepare the recipients
766 766
         $to = [];
767
-        foreach($this->_to as $address => $name) {
767
+        foreach ($this->_to as $address => $name) {
768 768
             $to[] = (empty($name) ? '' : $name.' ').'<'.$address.'>';
769 769
         }
770 770
         $recipients = implode(',', $to);
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
         $this->_createBody();
781 781
 
782 782
         // Send the email adopting to the given MUA
783
-        $mua  = self::getMUA($this->agent);
783
+        $mua = self::getMUA($this->agent);
784 784
         switch ($this->agent) {
785 785
             case 'built-in':
786 786
                 $sent = $mua->send($recipients, $this->headers, $this->body);
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
             return false;
927 927
         }
928 928
         
929
-        $unsafe = array ("\r", "\n");
929
+        $unsafe = array("\r", "\n");
930 930
         if ($address !== str_replace($unsafe, '', $address)) {
931 931
             return false;
932 932
         }
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
     public function safeEmail($email)
981 981
     {
982 982
         if ($this->_config->get('spam.enableSafeEmail')) {
983
-            return str_replace ( array ('@', '.' ), array ('_AT_', '_DOT_' ), $email );
983
+            return str_replace(array('@', '.'), array('_AT_', '_DOT_'), $email);
984 984
         } else {
985 985
             return $email;
986 986
         }
Please login to merge, or discard this patch.
phpmyfaq/inc/PMF/Mail/IMUA.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
  * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
32 32
  * @link      http://www.phpmyfaq.de
33 33
  * @since     2009-09-11
34
-  */ 
34
+ */ 
35 35
 interface PMF_Mail_IMUA
36 36
 {
37 37
     /**
Please login to merge, or discard this patch.
phpmyfaq/inc/PMF/DB/Mysqli.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
     }
123 123
 
124 124
     /**
125
-    * Escapes a string for use in a query
126
-    *
127
-    * @param   string
128
-    * @return  string
129
-    */
125
+     * Escapes a string for use in a query
126
+     *
127
+     * @param   string
128
+     * @return  string
129
+     */
130 130
     public function escape($string)
131 131
     {
132 132
         return $this->conn->real_escape_string($string);
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
         return $this->sqllog;
208 208
     }
209 209
 
210
-     /**
211
-      * This function returns the table status.
212
-      *
213
-      * @return array
214
-      */
210
+        /**
211
+         * This function returns the table status.
212
+         *
213
+         * @return array
214
+         */
215 215
     public function getTableStatus()
216 216
     {
217 217
         $arr = array();
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
                MAX(%s) AS current_id
238 238
            FROM
239 239
                %s",
240
-           $id,
241
-           $table);
240
+            $id,
241
+            $table);
242 242
            
243 243
         $result  = $this->query($select);
244 244
         $current = $result->fetch_row();
245 245
         return $current[0] + 1;
246 246
     }
247 247
 
248
-     /**
249
-      * Returns the error string.
250
-      *
251
-      * @return string
252
-      */
248
+        /**
249
+         * Returns the error string.
250
+         *
251
+         * @return string
252
+         */
253 253
     public function error()
254 254
     {
255 255
         return $this->conn->error;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @throws PMF_Exception
70 70
      *
71
-     * @return  boolean true, if connected, otherwise false
71
+     * @return  null|boolean true, if connected, otherwise false
72 72
      */
73 73
     public function connect($host, $user, $password, $database = '')
74 74
     {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      *
285 285
      * @param  string $prefix Table prefix
286 286
      *
287
-     * @return array
287
+     * @return string[]
288 288
      */
289 289
     function getTableNames($prefix = '')
290 290
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function connect($host, $user, $password, $database = '')
74 74
     {
75
-        if (substr($host, 0, 1)=='/') {
75
+        if (substr($host, 0, 1) == '/') {
76 76
                 // Connect to MySQL via socket
77 77
                 $this->conn = new mysqli(null, $user, $password, null, null, $host);
78 78
         } else {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                 $this->conn = new mysqli($host, $user, $password);
81 81
         }
82 82
         if ($this->conn->connect_error) {
83
-            PMF_Db::errorPage($this->conn->connect_errno . ': ' . $this->conn->connect_error);
83
+            PMF_Db::errorPage($this->conn->connect_errno.': '.$this->conn->connect_error);
84 84
             die();
85 85
         }
86 86
         
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
         }
91 91
 
92 92
         if ('' !== $database) {
93
-            if (! $this->conn->select_db($database)) {
94
-                throw new PMF_Exception('Cannot connect to database ' . $database);
93
+            if (!$this->conn->select_db($database)) {
94
+                throw new PMF_Exception('Cannot connect to database '.$database);
95 95
             }
96 96
         }
97 97
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     {
177 177
         $ret = [];
178 178
         if (false === $result) {
179
-            throw new Exception('Error while fetching result: ' . $this->error());
179
+            throw new Exception('Error while fetching result: '.$this->error());
180 180
         }
181 181
         
182 182
         while ($row = $this->fetchObject($result)) {
Please login to merge, or discard this patch.
phpmyfaq/inc/PMF/Category.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -574,10 +574,10 @@  discard block
 block discarded – undo
574 574
     }
575 575
 
576 576
     /**
577
-    * print the static tree with the number of records
578
-    *
579
-    * @return string
580
-    */
577
+     * print the static tree with the number of records
578
+     *
579
+     * @return string
580
+     */
581 581
     public function viewTree()
582 582
     {
583 583
         global $sids, $PMF_LANG, $plr;
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
             PMF_Db::getTablePrefix(),
1226 1226
             $category_id);
1227 1227
         if (!$delete_all) {
1228
-           $query .= " AND lang = '".$category_lang."'";
1228
+            $query .= " AND lang = '".$category_lang."'";
1229 1229
         }
1230 1230
         $this->_config->getDb()->query($query);
1231 1231
 
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
             PMF_Db::getTablePrefix(),
1250 1250
             $category_id);
1251 1251
         if (!$delete_all) {
1252
-           $query .= " AND category_lang = '".$category_lang."'";
1252
+            $query .= " AND category_lang = '".$category_lang."'";
1253 1253
         }
1254 1254
         $this->_config->getDb()->query($query);
1255 1255
 
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
         $translated   = array();
1274 1274
 
1275 1275
         foreach ($existcatlang as $language) {
1276
-           $query = sprintf("
1276
+            $query = sprintf("
1277 1277
                SELECT
1278 1278
                   name, description
1279 1279
                FROM
@@ -1282,13 +1282,13 @@  discard block
 block discarded – undo
1282 1282
                    id = %d
1283 1283
                AND
1284 1284
                    lang = '%s'",
1285
-               PMF_Db::getTablePrefix(),
1286
-               $category_id,
1287
-               $language);
1288
-           $result = $this->_config->getDb()->query($query);
1289
-           if ($row = $this->_config->getDb()->fetchArray($result)) {
1290
-              $translated[$languageCodes[strtoupper($language)]] = $row['name'].('' == $row['description'] ? '' : '  ('.$row['description'].')');
1291
-           }
1285
+                PMF_Db::getTablePrefix(),
1286
+                $category_id,
1287
+                $language);
1288
+            $result = $this->_config->getDb()->query($query);
1289
+            if ($row = $this->_config->getDb()->fetchArray($result)) {
1290
+                $translated[$languageCodes[strtoupper($language)]] = $row['name'].('' == $row['description'] ? '' : '  ('.$row['description'].')');
1291
+            }
1292 1292
         }
1293 1293
         ksort($translated);
1294 1294
 
@@ -1342,9 +1342,9 @@  discard block
 block discarded – undo
1342 1342
         $result = $this->_config->getDb()->query($query);
1343 1343
         while ($row = $this->_config->getDb()->fetchArray($result)) {
1344 1344
             if (!array_key_exists($row['id'],$this->categoryName)) {
1345
-               $this->categoryName[$row['id']] = $row;
1346
-               $this->categories[] =& $this->categoryName[$row['id']];
1347
-               $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']];
1345
+                $this->categoryName[$row['id']] = $row;
1346
+                $this->categories[] =& $this->categoryName[$row['id']];
1347
+                $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']];
1348 1348
             }
1349 1349
         }
1350 1350
     }
@@ -1540,8 +1540,8 @@  discard block
 block discarded – undo
1540 1540
                 fd.lang = fcr.category_lang
1541 1541
             ORDER BY
1542 1542
                 fcr.category_id, fd.id',
1543
-             PMF_Db::getTablePrefix(),
1544
-             PMF_Db::getTablePrefix());
1543
+                PMF_Db::getTablePrefix(),
1544
+                PMF_Db::getTablePrefix());
1545 1545
         $result = $this->_config->getDb()->query($query);
1546 1546
 
1547 1547
         if ($this->_config->getDb()->numRows($result) > 0) {
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
      * of associative arrays with the keys 'name', 'id', 'lang',
907 907
      * 'parent_id' and 'description'.
908 908
      *
909
-     * @param integer $article_id Record id
909
+     * @param integer $articleId Record id
910 910
      *
911 911
      * @return  array
912 912
      */
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
      *
1096 1096
      * @param  integer $category_id   Category id
1097 1097
      * @param  string  $category_lang Category language
1098
-     * @return boolean
1098
+     * @return integer
1099 1099
      */
1100 1100
     public function checkLanguage($category_id, $category_lang)
1101 1101
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 
228 228
         while ($row = $this->_config->getDb()->fetchArray($result)) {
229 229
             $this->categoryName[$row['id']] = $row;
230
-            $this->categories[] =& $this->categoryName[$row['id']];
231
-            $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']];
230
+            $this->categories[] = & $this->categoryName[$row['id']];
231
+            $this->children[$row['parent_id']][$row['id']] = & $this->categoryName[$row['id']];
232 232
         }
233 233
 
234 234
         return $this->categories;
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
             $symbol = 'minus';
395 395
         } else {
396 396
             $temp = isset($this->children[$thisParent_id]) ? array_keys($this->children[$thisParent_id]) : [];
397
-            if (isset($temp[count($temp)-1])) {
398
-                $symbol = ($id == $temp[count($temp)-1]) ? 'angle' : 'medium';
397
+            if (isset($temp[count($temp) - 1])) {
398
+                $symbol = ($id == $temp[count($temp) - 1]) ? 'angle' : 'medium';
399 399
             }
400 400
         }
401 401
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
         $childs = [];
469 469
 
470 470
         if (isset($this->children[$id])) {
471
-            foreach(array_keys($this->children[$id]) as $childId) {
471
+            foreach (array_keys($this->children[$id]) as $childId) {
472 472
                 $childs = array_merge($childs, array($childId));
473 473
                 $childs = array_merge($childs, $this->getChildNodes($childId));
474 474
             }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
         $open   = 0;
626 626
         $this->expandAll();
627 627
 
628
-        for ($y = 0 ;$y < $this->height(); $y = $this->getNextLineTree($y)) {
628
+        for ($y = 0; $y < $this->height(); $y = $this->getNextLineTree($y)) {
629 629
 
630 630
             list($hasChild, $categoryName, $parent, $description) = $this->getLineDisplay($y);
631 631
             $level     = $this->treeTab[$y]['level'];
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
                 $numFaqs = '';
672 672
             } else {
673 673
                 $totFaqRecords += $number[$parent];
674
-                $numFaqs = '<span class="rssCategoryLink"> (' . $plr->GetMsg('plmsgEntries', $number[$parent]);
674
+                $numFaqs = '<span class="rssCategoryLink"> ('.$plr->GetMsg('plmsgEntries', $number[$parent]);
675 675
                 if ($this->_config->get('main.enableRssFeeds')) {
676 676
                     $numFaqs .= sprintf(
677 677
                         ' <a href="feed/category/rss.php?category_id=%d&category_lang=%s" target="_blank"><i class="fa fa-rss"></i></a>',
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
             $oLink->text      = $categoryName;
695 695
             $oLink->tooltip   = $description;
696 696
 
697
-            $output .= $oLink->toHtmlAnchor() . $numFaqs;
697
+            $output .= $oLink->toHtmlAnchor().$numFaqs;
698 698
             $open    = $level;
699 699
         }
700 700
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
             return $l + 1;
739 739
         } else {
740 740
             for ($i = $l + 1; $i < $this->height(); $i++) {
741
-                if ($this->treeTab[$i]["level"]<=$this->treeTab[$l]["level"]) {
741
+                if ($this->treeTab[$i]["level"] <= $this->treeTab[$l]["level"]) {
742 742
                     return $i;
743 743
                 }
744 744
             }
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
         );
779 779
 
780 780
         $oLink            = new PMF_Link($url, $this->_config);
781
-        $oLink->id        = 'category_' . $categoryId;
781
+        $oLink->id        = 'category_'.$categoryId;
782 782
         $oLink->itemTitle = $categoryName;
783 783
         $oLink->text      = $categoryName;
784 784
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
                 if ($lang == $selected_lang) {
1322 1322
                     $output .= " selected=\"selected\"";
1323 1323
                 }
1324
-                $output .=  ">".$langname."</option>\n";
1324
+                $output .= ">".$langname."</option>\n";
1325 1325
             }
1326 1326
         }
1327 1327
 
@@ -1348,10 +1348,10 @@  discard block
 block discarded – undo
1348 1348
         $query .= ' ORDER BY id';
1349 1349
         $result = $this->_config->getDb()->query($query);
1350 1350
         while ($row = $this->_config->getDb()->fetchArray($result)) {
1351
-            if (!array_key_exists($row['id'],$this->categoryName)) {
1351
+            if (!array_key_exists($row['id'], $this->categoryName)) {
1352 1352
                $this->categoryName[$row['id']] = $row;
1353
-               $this->categories[] =& $this->categoryName[$row['id']];
1354
-               $this->children[$row['parent_id']][$row['id']] =& $this->categoryName[$row['id']];
1353
+               $this->categories[] = & $this->categoryName[$row['id']];
1354
+               $this->children[$row['parent_id']][$row['id']] = & $this->categoryName[$row['id']];
1355 1355
             }
1356 1356
         }
1357 1357
     }
Please login to merge, or discard this patch.
phpmyfaq/inc/libs/tcpdf/tcpdf_filters.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * ASCIIHexDecode
146 146
 	 * Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data.
147 147
 	 * @param $data (string) Data to decode.
148
-	 * @return Decoded data string.
148
+	 * @return string data string.
149 149
 	 * @public
150 150
 	 * @since 1.0.000 (2011-05-23)
151 151
 	 */
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * ASCII85Decode
186 186
 	 * Decodes data encoded in an ASCII base-85 representation, reproducing the original binary data.
187 187
 	 * @param $data (string) Data to decode.
188
-	 * @return Decoded data string.
188
+	 * @return string data string.
189 189
 	 * @public
190 190
 	 * @since 1.0.000 (2011-05-23)
191 191
 	 */
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * LZWDecode
270 270
 	 * Decompresses data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data.
271 271
 	 * @param $data (string) Data to decode.
272
-	 * @return Decoded data string.
272
+	 * @return string data string.
273 273
 	 * @public
274 274
 	 * @since 1.0.000 (2011-05-23)
275 275
 	 */
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 * FlateDecode
351 351
 	 * Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data.
352 352
 	 * @param $data (string) Data to decode.
353
-	 * @return Decoded data string.
353
+	 * @return string data string.
354 354
 	 * @public
355 355
 	 * @since 1.0.000 (2011-05-23)
356 356
 	 */
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
 	/**
465 465
 	 * This method is automatically called in case of fatal error; it simply outputs the message and halts the execution.
466
-	 * @param $msg (string) The error message
466
+	 * @param string $msg (string) The error message
467 467
 	 * @public
468 468
 	 * @since 1.0.000 (2011-05-23)
469 469
 	 */
Please login to merge, or discard this patch.
Indentation   +401 added lines, -401 removed lines patch added patch discarded remove patch
@@ -52,425 +52,425 @@
 block discarded – undo
52 52
  */
53 53
 class TCPDF_FILTERS {
54 54
 
55
-	/**
56
-	 * Define a list of available filter decoders.
57
-	 * @private
58
-	 */
59
-	private $available_filters = array('ASCIIHexDecode', 'ASCII85Decode', 'LZWDecode', 'FlateDecode', 'RunLengthDecode');
55
+    /**
56
+     * Define a list of available filter decoders.
57
+     * @private
58
+     */
59
+    private $available_filters = array('ASCIIHexDecode', 'ASCII85Decode', 'LZWDecode', 'FlateDecode', 'RunLengthDecode');
60 60
 
61 61
 // -----------------------------------------------------------------------------
62 62
 
63
-	/**
64
-	 * Get a list of available decoding filters.
65
-	 * @return (array) Array of available filter decoders.
66
-	 * @public
67
-	 * @since 1.0.000 (2011-05-23)
68
-	 */
69
-	public function getAvailableFilters() {
70
-		return $this->available_filters;
71
-	}
63
+    /**
64
+     * Get a list of available decoding filters.
65
+     * @return (array) Array of available filter decoders.
66
+     * @public
67
+     * @since 1.0.000 (2011-05-23)
68
+     */
69
+    public function getAvailableFilters() {
70
+        return $this->available_filters;
71
+    }
72 72
 
73
-	/**
74
-	 * Decode data using the specified filter type.
75
-	 * @param $filter (string) Filter name.
76
-	 * @param $data (string) Data to decode.
77
-	 * @return Decoded data string.
78
-	 * @public
79
-	 * @since 1.0.000 (2011-05-23)
80
-	 */
81
-	public function decodeFilter($filter, $data) {
82
-		switch ($filter) {
83
-			case 'ASCIIHexDecode': {
84
-				return $this->decodeFilterASCIIHexDecode($data);
85
-				break;
86
-			}
87
-			case 'ASCII85Decode': {
88
-				return $this->decodeFilterASCII85Decode($data);
89
-				break;
90
-			}
91
-			case 'LZWDecode': {
92
-				return $this->decodeFilterLZWDecode($data);
93
-				break;
94
-			}
95
-			case 'FlateDecode': {
96
-				return $this->decodeFilterFlateDecode($data);
97
-				break;
98
-			}
99
-			case 'RunLengthDecode': {
100
-				return $this->decodeFilterRunLengthDecode($data);
101
-				break;
102
-			}
103
-			case 'CCITTFaxDecode': {
104
-				return $this->decodeFilterCCITTFaxDecode($data);
105
-				break;
106
-			}
107
-			case 'JBIG2Decode': {
108
-				return $this->decodeFilterJBIG2Decode($data);
109
-				break;
110
-			}
111
-			case 'DCTDecode': {
112
-				return $this->decodeFilterDCTDecode($data);
113
-				break;
114
-			}
115
-			case 'JPXDecode': {
116
-				return $this->decodeFilterJPXDecode($data);
117
-				break;
118
-			}
119
-			case 'Crypt': {
120
-				return $this->decodeFilterCrypt($data);
121
-				break;
122
-			}
123
-			default: {
124
-				return decodeFilterStandard($data);
125
-				break;
126
-			}
127
-		}
128
-	}
73
+    /**
74
+     * Decode data using the specified filter type.
75
+     * @param $filter (string) Filter name.
76
+     * @param $data (string) Data to decode.
77
+     * @return Decoded data string.
78
+     * @public
79
+     * @since 1.0.000 (2011-05-23)
80
+     */
81
+    public function decodeFilter($filter, $data) {
82
+        switch ($filter) {
83
+            case 'ASCIIHexDecode': {
84
+                return $this->decodeFilterASCIIHexDecode($data);
85
+                break;
86
+            }
87
+            case 'ASCII85Decode': {
88
+                return $this->decodeFilterASCII85Decode($data);
89
+                break;
90
+            }
91
+            case 'LZWDecode': {
92
+                return $this->decodeFilterLZWDecode($data);
93
+                break;
94
+            }
95
+            case 'FlateDecode': {
96
+                return $this->decodeFilterFlateDecode($data);
97
+                break;
98
+            }
99
+            case 'RunLengthDecode': {
100
+                return $this->decodeFilterRunLengthDecode($data);
101
+                break;
102
+            }
103
+            case 'CCITTFaxDecode': {
104
+                return $this->decodeFilterCCITTFaxDecode($data);
105
+                break;
106
+            }
107
+            case 'JBIG2Decode': {
108
+                return $this->decodeFilterJBIG2Decode($data);
109
+                break;
110
+            }
111
+            case 'DCTDecode': {
112
+                return $this->decodeFilterDCTDecode($data);
113
+                break;
114
+            }
115
+            case 'JPXDecode': {
116
+                return $this->decodeFilterJPXDecode($data);
117
+                break;
118
+            }
119
+            case 'Crypt': {
120
+                return $this->decodeFilterCrypt($data);
121
+                break;
122
+            }
123
+            default: {
124
+                return decodeFilterStandard($data);
125
+                break;
126
+            }
127
+        }
128
+    }
129 129
 
130
-	// --- FILTERS (PDF 32000-2008 - 7.4 Filters) ------------------------------
130
+    // --- FILTERS (PDF 32000-2008 - 7.4 Filters) ------------------------------
131 131
 
132
-	/**
133
-	 * Standard
134
-	 * Default decoding filter (leaves data unchanged).
135
-	 * @param $data (string) Data to decode.
136
-	 * @return Decoded data string.
137
-	 * @public
138
-	 * @since 1.0.000 (2011-05-23)
139
-	 */
140
-	public function decodeFilterStandard($data) {
141
-		return $data;
142
-	}
132
+    /**
133
+     * Standard
134
+     * Default decoding filter (leaves data unchanged).
135
+     * @param $data (string) Data to decode.
136
+     * @return Decoded data string.
137
+     * @public
138
+     * @since 1.0.000 (2011-05-23)
139
+     */
140
+    public function decodeFilterStandard($data) {
141
+        return $data;
142
+    }
143 143
 
144
-	/**
145
-	 * ASCIIHexDecode
146
-	 * Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data.
147
-	 * @param $data (string) Data to decode.
148
-	 * @return Decoded data string.
149
-	 * @public
150
-	 * @since 1.0.000 (2011-05-23)
151
-	 */
152
-	public function decodeFilterASCIIHexDecode($data) {
153
-		// intialize string to return
154
-		$decoded = '';
155
-		// all white-space characters shall be ignored
156
-		$data = preg_replace('/[\s]/', '', $data);
157
-		// check for EOD character: GREATER-THAN SIGN (3Eh)
158
-		$eod = strpos($data, '>');
159
-		if ($eod !== false) {
160
-			// remove EOD and extra data (if any)
161
-			$data = substr($data, 0, $eod);
162
-			$eod = true;
163
-		}
164
-		// get data length
165
-		$data_length = strlen($data);
166
-		if (($data_length % 2) != 0) {
167
-			// odd number of hexadecimal digits
168
-			if ($eod) {
169
-				// EOD shall behave as if a 0 (zero) followed the last digit
170
-				$data = substr($data, 0, -1).'0'.substr($data, -1);
171
-			} else {
172
-				$this->Error('decodeASCIIHex: invalid code');
173
-			}
174
-		}
175
-		// check for invalid characters
176
-		if (preg_match('/[^a-fA-F\d]/', $data) > 0) {
177
-			$this->Error('decodeASCIIHex: invalid code');
178
-		}
179
-		// get one byte of binary data for each pair of ASCII hexadecimal digits
180
-		$decoded = pack('H*', $data);
181
-		return $decoded;
182
-	}
144
+    /**
145
+     * ASCIIHexDecode
146
+     * Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data.
147
+     * @param $data (string) Data to decode.
148
+     * @return Decoded data string.
149
+     * @public
150
+     * @since 1.0.000 (2011-05-23)
151
+     */
152
+    public function decodeFilterASCIIHexDecode($data) {
153
+        // intialize string to return
154
+        $decoded = '';
155
+        // all white-space characters shall be ignored
156
+        $data = preg_replace('/[\s]/', '', $data);
157
+        // check for EOD character: GREATER-THAN SIGN (3Eh)
158
+        $eod = strpos($data, '>');
159
+        if ($eod !== false) {
160
+            // remove EOD and extra data (if any)
161
+            $data = substr($data, 0, $eod);
162
+            $eod = true;
163
+        }
164
+        // get data length
165
+        $data_length = strlen($data);
166
+        if (($data_length % 2) != 0) {
167
+            // odd number of hexadecimal digits
168
+            if ($eod) {
169
+                // EOD shall behave as if a 0 (zero) followed the last digit
170
+                $data = substr($data, 0, -1).'0'.substr($data, -1);
171
+            } else {
172
+                $this->Error('decodeASCIIHex: invalid code');
173
+            }
174
+        }
175
+        // check for invalid characters
176
+        if (preg_match('/[^a-fA-F\d]/', $data) > 0) {
177
+            $this->Error('decodeASCIIHex: invalid code');
178
+        }
179
+        // get one byte of binary data for each pair of ASCII hexadecimal digits
180
+        $decoded = pack('H*', $data);
181
+        return $decoded;
182
+    }
183 183
 
184
-	/**
185
-	 * ASCII85Decode
186
-	 * Decodes data encoded in an ASCII base-85 representation, reproducing the original binary data.
187
-	 * @param $data (string) Data to decode.
188
-	 * @return Decoded data string.
189
-	 * @public
190
-	 * @since 1.0.000 (2011-05-23)
191
-	 */
192
-	public function decodeFilterASCII85Decode($data) {
193
-		// intialize string to return
194
-		$decoded = '';
195
-		// all white-space characters shall be ignored
196
-		$data = preg_replace('/[\s]/', '', $data);
197
-		// remove start sequence 2-character sequence <~ (3Ch)(7Eh)
198
-		if (strpos($data, '<~') !== false) {
199
-			// remove EOD and extra data (if any)
200
-			$data = substr($data, 2);
201
-		}
202
-		// check for EOD: 2-character sequence ~> (7Eh)(3Eh)
203
-		$eod = strpos($data, '~>');
204
-		if ($eod !== false) {
205
-			// remove EOD and extra data (if any)
206
-			$data = substr($data, 0, $eod);
207
-		}
208
-		// data length
209
-		$data_length = strlen($data);
210
-		// check for invalid characters
211
-		if (preg_match('/[^\x21-\x75,\x74]/', $data) > 0) {
212
-			$this->Error('decodeASCII85: invalid code');
213
-		}
214
-		// z sequence
215
-		$zseq = chr(0).chr(0).chr(0).chr(0);
216
-		// position inside a group of 4 bytes (0-3)
217
-		$group_pos = 0;
218
-		$tuple = 0;
219
-		$pow85 = array((85*85*85*85), (85*85*85), (85*85), 85, 1);
220
-		$last_pos = ($data_length - 1);
221
-		// for each byte
222
-		for ($i = 0; $i < $data_length; ++$i) {
223
-			// get char value
224
-			$char = ord($data[$i]);
225
-			if ($char == 122) { // 'z'
226
-				if ($group_pos == 0) {
227
-					$decoded .= $zseq;
228
-				} else {
229
-					$this->Error('decodeASCII85: invalid code');
230
-				}
231
-			} else {
232
-				// the value represented by a group of 5 characters should never be greater than 2^32 - 1
233
-				$tuple += (($char - 33) * $pow85[$group_pos]);
234
-				if ($group_pos == 4) {
235
-					$decoded .= chr($tuple >> 24).chr($tuple >> 16).chr($tuple >> 8).chr($tuple);
236
-					$tuple = 0;
237
-					$group_pos = 0;
238
-				} else {
239
-					++$group_pos;
240
-				}
241
-			}
242
-		}
243
-		if ($group_pos > 1) {
244
-			$tuple += $pow85[($group_pos - 1)];
245
-		}
246
-		// last tuple (if any)
247
-		switch ($group_pos) {
248
-			case 4: {
249
-				$decoded .= chr($tuple >> 24).chr($tuple >> 16).chr($tuple >> 8);
250
-				break;
251
-			}
252
-			case 3: {
253
-				$decoded .= chr($tuple >> 24).chr($tuple >> 16);
254
-				break;
255
-			}
256
-			case 2: {
257
-				$decoded .= chr($tuple >> 24);
258
-				break;
259
-			}
260
-			case 1: {
261
-				$this->Error('decodeASCII85: invalid code');
262
-				break;
263
-			}
264
-		}
265
-		return $decoded;
266
-	}
184
+    /**
185
+     * ASCII85Decode
186
+     * Decodes data encoded in an ASCII base-85 representation, reproducing the original binary data.
187
+     * @param $data (string) Data to decode.
188
+     * @return Decoded data string.
189
+     * @public
190
+     * @since 1.0.000 (2011-05-23)
191
+     */
192
+    public function decodeFilterASCII85Decode($data) {
193
+        // intialize string to return
194
+        $decoded = '';
195
+        // all white-space characters shall be ignored
196
+        $data = preg_replace('/[\s]/', '', $data);
197
+        // remove start sequence 2-character sequence <~ (3Ch)(7Eh)
198
+        if (strpos($data, '<~') !== false) {
199
+            // remove EOD and extra data (if any)
200
+            $data = substr($data, 2);
201
+        }
202
+        // check for EOD: 2-character sequence ~> (7Eh)(3Eh)
203
+        $eod = strpos($data, '~>');
204
+        if ($eod !== false) {
205
+            // remove EOD and extra data (if any)
206
+            $data = substr($data, 0, $eod);
207
+        }
208
+        // data length
209
+        $data_length = strlen($data);
210
+        // check for invalid characters
211
+        if (preg_match('/[^\x21-\x75,\x74]/', $data) > 0) {
212
+            $this->Error('decodeASCII85: invalid code');
213
+        }
214
+        // z sequence
215
+        $zseq = chr(0).chr(0).chr(0).chr(0);
216
+        // position inside a group of 4 bytes (0-3)
217
+        $group_pos = 0;
218
+        $tuple = 0;
219
+        $pow85 = array((85*85*85*85), (85*85*85), (85*85), 85, 1);
220
+        $last_pos = ($data_length - 1);
221
+        // for each byte
222
+        for ($i = 0; $i < $data_length; ++$i) {
223
+            // get char value
224
+            $char = ord($data[$i]);
225
+            if ($char == 122) { // 'z'
226
+                if ($group_pos == 0) {
227
+                    $decoded .= $zseq;
228
+                } else {
229
+                    $this->Error('decodeASCII85: invalid code');
230
+                }
231
+            } else {
232
+                // the value represented by a group of 5 characters should never be greater than 2^32 - 1
233
+                $tuple += (($char - 33) * $pow85[$group_pos]);
234
+                if ($group_pos == 4) {
235
+                    $decoded .= chr($tuple >> 24).chr($tuple >> 16).chr($tuple >> 8).chr($tuple);
236
+                    $tuple = 0;
237
+                    $group_pos = 0;
238
+                } else {
239
+                    ++$group_pos;
240
+                }
241
+            }
242
+        }
243
+        if ($group_pos > 1) {
244
+            $tuple += $pow85[($group_pos - 1)];
245
+        }
246
+        // last tuple (if any)
247
+        switch ($group_pos) {
248
+            case 4: {
249
+                $decoded .= chr($tuple >> 24).chr($tuple >> 16).chr($tuple >> 8);
250
+                break;
251
+            }
252
+            case 3: {
253
+                $decoded .= chr($tuple >> 24).chr($tuple >> 16);
254
+                break;
255
+            }
256
+            case 2: {
257
+                $decoded .= chr($tuple >> 24);
258
+                break;
259
+            }
260
+            case 1: {
261
+                $this->Error('decodeASCII85: invalid code');
262
+                break;
263
+            }
264
+        }
265
+        return $decoded;
266
+    }
267 267
 
268
-	/**
269
-	 * LZWDecode
270
-	 * Decompresses data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data.
271
-	 * @param $data (string) Data to decode.
272
-	 * @return Decoded data string.
273
-	 * @public
274
-	 * @since 1.0.000 (2011-05-23)
275
-	 */
276
-	public function decodeFilterLZWDecode($data) {
277
-		// intialize string to return
278
-		$decoded = '';
279
-		// data length
280
-		$data_length = strlen($data);
281
-		// convert string to binary string
282
-		$bitstring = '';
283
-		for ($i = 0; $i < $data_length; ++$i) {
284
-			$bitstring .= sprintf('%08b', ord($data{$i}));
285
-		}
286
-		// get the number of bits
287
-		$data_length = strlen($bitstring);
288
-		// initialize code length in bits
289
-		$bitlen = 9;
290
-		// initialize dictionary index
291
-		$dix = 258;
292
-		// initialize the dictionary (with the first 256 entries).
293
-		$dictionary = array();
294
-		for ($i = 0; $i < 256; ++$i) {
295
-			$dictionary[$i] = chr($i);
296
-		}
297
-		// previous val
298
-		$prev_index = 0;
299
-		// while we encounter EOD marker (257), read code_length bits
300
-		while (($data_length > 0) AND (($index = bindec(substr($bitstring, 0, $bitlen))) != 257)) {
301
-			// remove read bits from string
302
-			$bitstring = substr($bitstring, $bitlen);
303
-			// update number of bits
304
-			$data_length -= $bitlen;
305
-			if ($index == 256) { // clear-table marker
306
-				// reset code length in bits
307
-				$bitlen = 9;
308
-				// reset dictionary index
309
-				$dix = 258;
310
-				$prev_index = 256;
311
-				// reset the dictionary (with the first 256 entries).
312
-				$dictionary = array();
313
-				for ($i = 0; $i < 256; ++$i) {
314
-					$dictionary[$i] = chr($i);
315
-				}
316
-			} elseif ($prev_index == 256) {
317
-				// first entry
318
-				$decoded .= $dictionary[$index];
319
-				$prev_index = $index;
320
-			} else {
321
-				// check if index exist in the dictionary
322
-				if ($index < $dix) {
323
-					// index exist on dictionary
324
-					$decoded .= $dictionary[$index];
325
-					$dic_val = $dictionary[$prev_index].$dictionary[$index]{0};
326
-					// store current index
327
-					$prev_index = $index;
328
-				} else {
329
-					// index do not exist on dictionary
330
-					$dic_val = $dictionary[$prev_index].$dictionary[$prev_index]{0};
331
-					$decoded .= $dic_val;
332
-				}
333
-				// update dictionary
334
-				$dictionary[$dix] = $dic_val;
335
-				++$dix;
336
-				// change bit length by case
337
-				if ($dix == 2047) {
338
-					$bitlen = 12;
339
-				} elseif ($dix == 1023) {
340
-					$bitlen = 11;
341
-				} elseif ($dix == 511) {
342
-					$bitlen = 10;
343
-				}
344
-			}
345
-		}
346
-		return $decoded;
347
-	}
268
+    /**
269
+     * LZWDecode
270
+     * Decompresses data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data.
271
+     * @param $data (string) Data to decode.
272
+     * @return Decoded data string.
273
+     * @public
274
+     * @since 1.0.000 (2011-05-23)
275
+     */
276
+    public function decodeFilterLZWDecode($data) {
277
+        // intialize string to return
278
+        $decoded = '';
279
+        // data length
280
+        $data_length = strlen($data);
281
+        // convert string to binary string
282
+        $bitstring = '';
283
+        for ($i = 0; $i < $data_length; ++$i) {
284
+            $bitstring .= sprintf('%08b', ord($data{$i}));
285
+        }
286
+        // get the number of bits
287
+        $data_length = strlen($bitstring);
288
+        // initialize code length in bits
289
+        $bitlen = 9;
290
+        // initialize dictionary index
291
+        $dix = 258;
292
+        // initialize the dictionary (with the first 256 entries).
293
+        $dictionary = array();
294
+        for ($i = 0; $i < 256; ++$i) {
295
+            $dictionary[$i] = chr($i);
296
+        }
297
+        // previous val
298
+        $prev_index = 0;
299
+        // while we encounter EOD marker (257), read code_length bits
300
+        while (($data_length > 0) AND (($index = bindec(substr($bitstring, 0, $bitlen))) != 257)) {
301
+            // remove read bits from string
302
+            $bitstring = substr($bitstring, $bitlen);
303
+            // update number of bits
304
+            $data_length -= $bitlen;
305
+            if ($index == 256) { // clear-table marker
306
+                // reset code length in bits
307
+                $bitlen = 9;
308
+                // reset dictionary index
309
+                $dix = 258;
310
+                $prev_index = 256;
311
+                // reset the dictionary (with the first 256 entries).
312
+                $dictionary = array();
313
+                for ($i = 0; $i < 256; ++$i) {
314
+                    $dictionary[$i] = chr($i);
315
+                }
316
+            } elseif ($prev_index == 256) {
317
+                // first entry
318
+                $decoded .= $dictionary[$index];
319
+                $prev_index = $index;
320
+            } else {
321
+                // check if index exist in the dictionary
322
+                if ($index < $dix) {
323
+                    // index exist on dictionary
324
+                    $decoded .= $dictionary[$index];
325
+                    $dic_val = $dictionary[$prev_index].$dictionary[$index]{0};
326
+                    // store current index
327
+                    $prev_index = $index;
328
+                } else {
329
+                    // index do not exist on dictionary
330
+                    $dic_val = $dictionary[$prev_index].$dictionary[$prev_index]{0};
331
+                    $decoded .= $dic_val;
332
+                }
333
+                // update dictionary
334
+                $dictionary[$dix] = $dic_val;
335
+                ++$dix;
336
+                // change bit length by case
337
+                if ($dix == 2047) {
338
+                    $bitlen = 12;
339
+                } elseif ($dix == 1023) {
340
+                    $bitlen = 11;
341
+                } elseif ($dix == 511) {
342
+                    $bitlen = 10;
343
+                }
344
+            }
345
+        }
346
+        return $decoded;
347
+    }
348 348
 
349
-	/**
350
-	 * FlateDecode
351
-	 * Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data.
352
-	 * @param $data (string) Data to decode.
353
-	 * @return Decoded data string.
354
-	 * @public
355
-	 * @since 1.0.000 (2011-05-23)
356
-	 */
357
-	public function decodeFilterFlateDecode($data) {
358
-		// intialize string to return
359
-		$decoded = gzuncompress($data);
360
-		if ($decoded === false) {
361
-			$this->Error('decodeFlate: invalid code');
362
-		}
363
-		return $decoded;
364
-	}
349
+    /**
350
+     * FlateDecode
351
+     * Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data.
352
+     * @param $data (string) Data to decode.
353
+     * @return Decoded data string.
354
+     * @public
355
+     * @since 1.0.000 (2011-05-23)
356
+     */
357
+    public function decodeFilterFlateDecode($data) {
358
+        // intialize string to return
359
+        $decoded = gzuncompress($data);
360
+        if ($decoded === false) {
361
+            $this->Error('decodeFlate: invalid code');
362
+        }
363
+        return $decoded;
364
+    }
365 365
 
366
-	/**
367
-	 * RunLengthDecode
368
-	 * Decompresses data encoded using a byte-oriented run-length encoding algorithm.
369
-	 * @param $data (string) Data to decode.
370
-	 * @public
371
-	 * @since 1.0.000 (2011-05-23)
372
-	 */
373
-	public function decodeFilterRunLengthDecode($data) {
374
-		// intialize string to return
375
-		$decoded = '';
376
-		// data length
377
-		$data_length = strlen($data);
378
-		$i = 0;
379
-		while($i < $data_length) {
380
-			// get current byte value
381
-			$byte = ord($data{$i});
382
-			if ($byte == 128) {
383
-				// a length value of 128 denote EOD
384
-				break;
385
-			} elseif ($byte < 128) {
386
-				// if the length byte is in the range 0 to 127
387
-				// the following length + 1 (1 to 128) bytes shall be copied literally during decompression
388
-				$decoded .= substr($data, ($i + 1), ($byte + 1));
389
-				// move to next block
390
-				$i += ($byte + 2);
391
-			} else {
392
-				// if length is in the range 129 to 255,
393
-				// the following single byte shall be copied 257 - length (2 to 128) times during decompression
394
-				$decoded .= str_repeat($data{($i + 1)}, (257 - $byte));
395
-				// move to next block
396
-				$i += 2;
397
-			}
398
-		}
399
-		return $decoded;
400
-	}
366
+    /**
367
+     * RunLengthDecode
368
+     * Decompresses data encoded using a byte-oriented run-length encoding algorithm.
369
+     * @param $data (string) Data to decode.
370
+     * @public
371
+     * @since 1.0.000 (2011-05-23)
372
+     */
373
+    public function decodeFilterRunLengthDecode($data) {
374
+        // intialize string to return
375
+        $decoded = '';
376
+        // data length
377
+        $data_length = strlen($data);
378
+        $i = 0;
379
+        while($i < $data_length) {
380
+            // get current byte value
381
+            $byte = ord($data{$i});
382
+            if ($byte == 128) {
383
+                // a length value of 128 denote EOD
384
+                break;
385
+            } elseif ($byte < 128) {
386
+                // if the length byte is in the range 0 to 127
387
+                // the following length + 1 (1 to 128) bytes shall be copied literally during decompression
388
+                $decoded .= substr($data, ($i + 1), ($byte + 1));
389
+                // move to next block
390
+                $i += ($byte + 2);
391
+            } else {
392
+                // if length is in the range 129 to 255,
393
+                // the following single byte shall be copied 257 - length (2 to 128) times during decompression
394
+                $decoded .= str_repeat($data{($i + 1)}, (257 - $byte));
395
+                // move to next block
396
+                $i += 2;
397
+            }
398
+        }
399
+        return $decoded;
400
+    }
401 401
 
402
-	/**
403
-	 * CCITTFaxDecode (NOT IMPLEMETED)
404
-	 * Decompresses data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel).
405
-	 * @param $data (string) Data to decode.
406
-	 * @return Decoded data string.
407
-	 * @public
408
-	 * @since 1.0.000 (2011-05-23)
409
-	 */
410
-	public function decodeFilterCCITTFaxDecode($data) {
411
-		return $data;
412
-	}
402
+    /**
403
+     * CCITTFaxDecode (NOT IMPLEMETED)
404
+     * Decompresses data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel).
405
+     * @param $data (string) Data to decode.
406
+     * @return Decoded data string.
407
+     * @public
408
+     * @since 1.0.000 (2011-05-23)
409
+     */
410
+    public function decodeFilterCCITTFaxDecode($data) {
411
+        return $data;
412
+    }
413 413
 
414
-	/**
415
-	 * JBIG2Decode (NOT IMPLEMETED)
416
-	 * Decompresses data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data).
417
-	 * @param $data (string) Data to decode.
418
-	 * @return Decoded data string.
419
-	 * @public
420
-	 * @since 1.0.000 (2011-05-23)
421
-	 */
422
-	public function decodeFilterJBIG2Decode($data) {
423
-		return $data;
424
-	}
414
+    /**
415
+     * JBIG2Decode (NOT IMPLEMETED)
416
+     * Decompresses data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data).
417
+     * @param $data (string) Data to decode.
418
+     * @return Decoded data string.
419
+     * @public
420
+     * @since 1.0.000 (2011-05-23)
421
+     */
422
+    public function decodeFilterJBIG2Decode($data) {
423
+        return $data;
424
+    }
425 425
 
426
-	/**
427
-	 * DCTDecode (NOT IMPLEMETED)
428
-	 * Decompresses data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data.
429
-	 * @param $data (string) Data to decode.
430
-	 * @return Decoded data string.
431
-	 * @public
432
-	 * @since 1.0.000 (2011-05-23)
433
-	 */
434
-	public function decodeFilterDCTDecode($data) {
435
-		return $data;
436
-	}
426
+    /**
427
+     * DCTDecode (NOT IMPLEMETED)
428
+     * Decompresses data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data.
429
+     * @param $data (string) Data to decode.
430
+     * @return Decoded data string.
431
+     * @public
432
+     * @since 1.0.000 (2011-05-23)
433
+     */
434
+    public function decodeFilterDCTDecode($data) {
435
+        return $data;
436
+    }
437 437
 
438
-	/**
439
-	 * JPXDecode (NOT IMPLEMETED)
440
-	 * Decompresses data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data.
441
-	 * @param $data (string) Data to decode.
442
-	 * @return Decoded data string.
443
-	 * @public
444
-	 * @since 1.0.000 (2011-05-23)
445
-	 */
446
-	public function decodeFilterJPXDecode($data) {
447
-		return $data;
448
-	}
438
+    /**
439
+     * JPXDecode (NOT IMPLEMETED)
440
+     * Decompresses data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data.
441
+     * @param $data (string) Data to decode.
442
+     * @return Decoded data string.
443
+     * @public
444
+     * @since 1.0.000 (2011-05-23)
445
+     */
446
+    public function decodeFilterJPXDecode($data) {
447
+        return $data;
448
+    }
449 449
 
450
-	/**
451
-	 * Crypt (NOT IMPLEMETED)
452
-	 * Decrypts data encrypted by a security handler, reproducing the data as it was before encryption.
453
-	 * @param $data (string) Data to decode.
454
-	 * @return Decoded data string.
455
-	 * @public
456
-	 * @since 1.0.000 (2011-05-23)
457
-	 */
458
-	public function decodeFilterCrypt($data) {
459
-		return $data;
460
-	}
450
+    /**
451
+     * Crypt (NOT IMPLEMETED)
452
+     * Decrypts data encrypted by a security handler, reproducing the data as it was before encryption.
453
+     * @param $data (string) Data to decode.
454
+     * @return Decoded data string.
455
+     * @public
456
+     * @since 1.0.000 (2011-05-23)
457
+     */
458
+    public function decodeFilterCrypt($data) {
459
+        return $data;
460
+    }
461 461
 
462
-	// --- END FILTERS SECTION -------------------------------------------------
462
+    // --- END FILTERS SECTION -------------------------------------------------
463 463
 
464
-	/**
465
-	 * This method is automatically called in case of fatal error; it simply outputs the message and halts the execution.
466
-	 * @param $msg (string) The error message
467
-	 * @public
468
-	 * @since 1.0.000 (2011-05-23)
469
-	 */
470
-	public function Error($msg) {
471
-		// exit program and print error
472
-		die('<strong>TCPDF_FILTERS ERROR: </strong>'.$msg);
473
-	}
464
+    /**
465
+     * This method is automatically called in case of fatal error; it simply outputs the message and halts the execution.
466
+     * @param $msg (string) The error message
467
+     * @public
468
+     * @since 1.0.000 (2011-05-23)
469
+     */
470
+    public function Error($msg) {
471
+        // exit program and print error
472
+        die('<strong>TCPDF_FILTERS ERROR: </strong>'.$msg);
473
+    }
474 474
 
475 475
 } // END OF TCPDF_FILTERS CLASS
476 476
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		}
162 162
 		// get data length
163 163
 		$data_length = strlen($data);
164
-		if (($data_length % 2) != 0) {
164
+		if (($data_length%2) != 0) {
165 165
 			// odd number of hexadecimal digits
166 166
 			if ($eod) {
167 167
 				// EOD shall behave as if a 0 (zero) followed the last digit
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				}
229 229
 			} else {
230 230
 				// the value represented by a group of 5 characters should never be greater than 2^32 - 1
231
-				$tuple += (($char - 33) * $pow85[$group_pos]);
231
+				$tuple += (($char - 33)*$pow85[$group_pos]);
232 232
 				if ($group_pos == 4) {
233 233
 					$decoded .= chr($tuple >> 24).chr($tuple >> 16).chr($tuple >> 8).chr($tuple);
234 234
 					$tuple = 0;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 		// data length
375 375
 		$data_length = strlen($data);
376 376
 		$i = 0;
377
-		while($i < $data_length) {
377
+		while ($i < $data_length) {
378 378
 			// get current byte value
379 379
 			$byte = ord($data{$i});
380 380
 			if ($byte == 128) {
Please login to merge, or discard this patch.