Completed
Push — develop ( 0132ab...e45b08 )
by Dmytro
13:40 queued 05:11
created
manager/includes/controls/phpmailer/PHPMailer.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3968,7 +3968,7 @@
 block discarded – undo
3968 3968
      * @param int|string $options Either a PATHINFO_* constant,
3969 3969
      *                            or a string name to return only the specified piece
3970 3970
      *
3971
-     * @return string|array
3971
+     * @return string
3972 3972
      */
3973 3973
     public static function mb_pathinfo($path, $options = null)
3974 3974
     {
Please login to merge, or discard this patch.
Spacing   +135 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1076,10 +1076,10 @@  discard block
 block discarded – undo
1076 1076
             $list = imap_rfc822_parse_adrlist($addrstr, '');
1077 1077
             foreach ($list as $address) {
1078 1078
                 if ('.SYNTAX-ERROR.' != $address->host) {
1079
-                    if (static::validateAddress($address->mailbox . '@' . $address->host)) {
1079
+                    if (static::validateAddress($address->mailbox.'@'.$address->host)) {
1080 1080
                         $addresses[] = [
1081 1081
                             'name' => (property_exists($address, 'personal') ? $address->personal : ''),
1082
-                            'address' => $address->mailbox . '@' . $address->host,
1082
+                            'address' => $address->mailbox.'@'.$address->host,
1083 1083
                         ];
1084 1084
                     }
1085 1085
                 }
@@ -1225,14 +1225,14 @@  discard block
 block discarded – undo
1225 1225
                  * Feel free to use and redistribute this code. But please keep this copyright notice.
1226 1226
                  */
1227 1227
                 return (bool) preg_match(
1228
-                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
1229
-                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
1230
-                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
1231
-                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
1232
-                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
1233
-                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
1234
-                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
1235
-                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
1228
+                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)'.
1229
+                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)'.
1230
+                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)'.
1231
+                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*'.
1232
+                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)'.
1233
+                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}'.
1234
+                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:'.
1235
+                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}'.
1236 1236
                     '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
1237 1237
                     $address
1238 1238
                 );
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
                  * @see http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
1244 1244
                  */
1245 1245
                 return (bool) preg_match(
1246
-                    '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
1246
+                    '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}'.
1247 1247
                     '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
1248 1248
                     $address
1249 1249
                 );
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
                 $errorcode = 0;
1295 1295
                 $punycode = idn_to_ascii($domain, $errorcode, INTL_IDNA_VARIANT_UTS46);
1296 1296
                 if (false !== $punycode) {
1297
-                    return substr($address, 0, $pos) . $punycode;
1297
+                    return substr($address, 0, $pos).$punycode;
1298 1298
                 }
1299 1299
             }
1300 1300
         }
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
                     and version_compare(PHP_VERSION, '7.1.3', '<')))
1359 1359
         ) {
1360 1360
             trigger_error(
1361
-                'Your version of PHP is affected by a bug that may result in corrupted messages.' .
1362
-                ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
1361
+                'Your version of PHP is affected by a bug that may result in corrupted messages.'.
1362
+                ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in'.
1363 1363
                 ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
1364 1364
                 E_USER_WARNING
1365 1365
             );
@@ -1443,12 +1443,12 @@  discard block
 block discarded – undo
1443 1443
                 )
1444 1444
             ) {
1445 1445
                 $header_dkim = $this->DKIM_Add(
1446
-                    $this->MIMEHeader . $this->mailHeader,
1446
+                    $this->MIMEHeader.$this->mailHeader,
1447 1447
                     $this->encodeHeader($this->secureHeader($this->Subject)),
1448 1448
                     $this->MIMEBody
1449 1449
                 );
1450
-                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . static::$LE .
1451
-                    static::normalizeBreaks($header_dkim) . static::$LE;
1450
+                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ").static::$LE.
1451
+                    static::normalizeBreaks($header_dkim).static::$LE;
1452 1452
             }
1453 1453
 
1454 1454
             return true;
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
                 case 'mail':
1483 1483
                     return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
1484 1484
                 default:
1485
-                    $sendMethod = $this->Mailer . 'Send';
1485
+                    $sendMethod = $this->Mailer.'Send';
1486 1486
                     if (method_exists($this, $sendMethod)) {
1487 1487
                         return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
1488 1488
                     }
@@ -1535,9 +1535,9 @@  discard block
 block discarded – undo
1535 1535
             foreach ($this->SingleToArray as $toAddr) {
1536 1536
                 $mail = @popen($sendmail, 'w');
1537 1537
                 if (!$mail) {
1538
-                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1538
+                    throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1539 1539
                 }
1540
-                fwrite($mail, 'To: ' . $toAddr . "\n");
1540
+                fwrite($mail, 'To: '.$toAddr."\n");
1541 1541
                 fwrite($mail, $header);
1542 1542
                 fwrite($mail, $body);
1543 1543
                 $result = pclose($mail);
@@ -1552,13 +1552,13 @@  discard block
 block discarded – undo
1552 1552
                     []
1553 1553
                 );
1554 1554
                 if (0 !== $result) {
1555
-                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1555
+                    throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1556 1556
                 }
1557 1557
             }
1558 1558
         } else {
1559 1559
             $mail = @popen($sendmail, 'w');
1560 1560
             if (!$mail) {
1561
-                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1561
+                throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1562 1562
             }
1563 1563
             fwrite($mail, $header);
1564 1564
             fwrite($mail, $body);
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
                 []
1575 1575
             );
1576 1576
             if (0 !== $result) {
1577
-                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
1577
+                throw new Exception($this->lang('execute').$this->Sendmail, self::STOP_CRITICAL);
1578 1578
             }
1579 1579
         }
1580 1580
 
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
             $smtp_from = $this->Sender;
1733 1733
         }
1734 1734
         if (!$this->smtp->mail($smtp_from)) {
1735
-            $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
1735
+            $this->setError($this->lang('from_failed').$smtp_from.' : '.implode(',', $this->smtp->getError()));
1736 1736
             throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);
1737 1737
         }
1738 1738
 
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
         }
1754 1754
 
1755 1755
         // Only send the DATA command if we have viable recipients
1756
-        if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
1756
+        if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header.$body)) {
1757 1757
             throw new Exception($this->lang('data_not_accepted'), self::STOP_CRITICAL);
1758 1758
         }
1759 1759
 
@@ -1783,10 +1783,10 @@  discard block
 block discarded – undo
1783 1783
         if (count($bad_rcpt) > 0) {
1784 1784
             $errstr = '';
1785 1785
             foreach ($bad_rcpt as $bad) {
1786
-                $errstr .= $bad['to'] . ': ' . $bad['error'];
1786
+                $errstr .= $bad['to'].': '.$bad['error'];
1787 1787
             }
1788 1788
             throw new Exception(
1789
-                $this->lang('recipients_failed') . $errstr,
1789
+                $this->lang('recipients_failed').$errstr,
1790 1790
                 self::STOP_CONTINUE
1791 1791
             );
1792 1792
         }
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
                 trim($hostentry),
1837 1837
                 $hostinfo
1838 1838
             )) {
1839
-                static::edebug($this->lang('connect_host') . ' ' . $hostentry);
1839
+                static::edebug($this->lang('connect_host').' '.$hostentry);
1840 1840
                 // Not a valid host entry
1841 1841
                 continue;
1842 1842
             }
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
 
1849 1849
             //Check the host name is a valid name or IP address before trying to use it
1850 1850
             if (!static::isValidHost($hostinfo[3])) {
1851
-                static::edebug($this->lang('connect_host') . ' ' . $hostentry);
1851
+                static::edebug($this->lang('connect_host').' '.$hostentry);
1852 1852
                 continue;
1853 1853
             }
1854 1854
             $prefix = '';
@@ -1868,7 +1868,7 @@  discard block
 block discarded – undo
1868 1868
             if ('tls' === $secure or 'ssl' === $secure) {
1869 1869
                 //Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
1870 1870
                 if (!$sslext) {
1871
-                    throw new Exception($this->lang('extension_missing') . 'openssl', self::STOP_CRITICAL);
1871
+                    throw new Exception($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
1872 1872
                 }
1873 1873
             }
1874 1874
             $host = $hostinfo[3];
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
             if ($tport > 0 and $tport < 65536) {
1878 1878
                 $port = $tport;
1879 1879
             }
1880
-            if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
1880
+            if ($this->smtp->connect($prefix.$host, $port, $this->Timeout, $options)) {
1881 1881
                 try {
1882 1882
                     if ($this->Helo) {
1883 1883
                         $hello = $this->Helo;
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
         ];
1995 1995
         if (empty($lang_path)) {
1996 1996
             // Calculate an absolute path so it can work if CWD is not here
1997
-            $lang_path = __DIR__ . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
1997
+            $lang_path = __DIR__.DIRECTORY_SEPARATOR.'language'.DIRECTORY_SEPARATOR;
1998 1998
         }
1999 1999
         //Validate $langcode
2000 2000
         if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
2001 2001
             $langcode = 'en';
2002 2002
         }
2003 2003
         $foundlang = true;
2004
-        $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
2004
+        $lang_file = $lang_path.'phpmailer.lang-'.$langcode.'.php';
2005 2005
         // There is no English translation file
2006 2006
         if ('en' != $langcode) {
2007 2007
             // Make sure language file path is readable
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
             $addresses[] = $this->addrFormat($address);
2047 2047
         }
2048 2048
 
2049
-        return $type . ': ' . implode(', ', $addresses) . static::$LE;
2049
+        return $type.': '.implode(', ', $addresses).static::$LE;
2050 2050
     }
2051 2051
 
2052 2052
     /**
@@ -2063,9 +2063,9 @@  discard block
 block discarded – undo
2063 2063
             return $this->secureHeader($addr[0]);
2064 2064
         }
2065 2065
 
2066
-        return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
2066
+        return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase').' <'.$this->secureHeader(
2067 2067
                 $addr[0]
2068
-            ) . '>';
2068
+            ).'>';
2069 2069
     }
2070 2070
 
2071 2071
     /**
@@ -2122,10 +2122,10 @@  discard block
 block discarded – undo
2122 2122
                             }
2123 2123
                             $part = substr($word, 0, $len);
2124 2124
                             $word = substr($word, $len);
2125
-                            $buf .= ' ' . $part;
2126
-                            $message .= $buf . sprintf('=%s', static::$LE);
2125
+                            $buf .= ' '.$part;
2126
+                            $message .= $buf.sprintf('=%s', static::$LE);
2127 2127
                         } else {
2128
-                            $message .= $buf . $soft_break;
2128
+                            $message .= $buf.$soft_break;
2129 2129
                         }
2130 2130
                         $buf = '';
2131 2131
                     }
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
                         $word = substr($word, $len);
2146 2146
 
2147 2147
                         if (strlen($word) > 0) {
2148
-                            $message .= $part . sprintf('=%s', static::$LE);
2148
+                            $message .= $part.sprintf('=%s', static::$LE);
2149 2149
                         } else {
2150 2150
                             $buf = $part;
2151 2151
                         }
@@ -2158,13 +2158,13 @@  discard block
 block discarded – undo
2158 2158
                     $buf .= $word;
2159 2159
 
2160 2160
                     if (strlen($buf) > $length and '' != $buf_o) {
2161
-                        $message .= $buf_o . $soft_break;
2161
+                        $message .= $buf_o.$soft_break;
2162 2162
                         $buf = $word;
2163 2163
                     }
2164 2164
                 }
2165 2165
                 $firstword = false;
2166 2166
             }
2167
-            $message .= $buf . static::$LE;
2167
+            $message .= $buf.static::$LE;
2168 2168
         }
2169 2169
 
2170 2170
         return $message;
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
         if ('' == $this->XMailer) {
2311 2311
             $result .= $this->headerLine(
2312 2312
                 'X-Mailer',
2313
-                'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)'
2313
+                'PHPMailer '.self::VERSION.' (https://github.com/PHPMailer/PHPMailer)'
2314 2314
             );
2315 2315
         } else {
2316 2316
             $myXmailer = trim($this->XMailer);
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
         }
2321 2321
 
2322 2322
         if ('' != $this->ConfirmReadingTo) {
2323
-            $result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
2323
+            $result .= $this->headerLine('Disposition-Notification-To', '<'.$this->ConfirmReadingTo.'>');
2324 2324
         }
2325 2325
 
2326 2326
         // Add custom headers
@@ -2350,23 +2350,23 @@  discard block
 block discarded – undo
2350 2350
         switch ($this->message_type) {
2351 2351
             case 'inline':
2352 2352
                 $result .= $this->headerLine('Content-Type', 'multipart/related;');
2353
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2353
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2354 2354
                 break;
2355 2355
             case 'attach':
2356 2356
             case 'inline_attach':
2357 2357
             case 'alt_attach':
2358 2358
             case 'alt_inline_attach':
2359 2359
                 $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
2360
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2360
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2361 2361
                 break;
2362 2362
             case 'alt':
2363 2363
             case 'alt_inline':
2364 2364
                 $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
2365
-                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
2365
+                $result .= $this->textLine("\tboundary=\"".$this->boundary[1].'"');
2366 2366
                 break;
2367 2367
             default:
2368 2368
                 // Catches case 'plain': and case '':
2369
-                $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
2369
+                $result .= $this->textLine('Content-Type: '.$this->ContentType.'; charset='.$this->CharSet);
2370 2370
                 $ismultipart = false;
2371 2371
                 break;
2372 2372
         }
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
      */
2402 2402
     public function getSentMIMEMessage()
2403 2403
     {
2404
-        return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . static::$LE . static::$LE . $this->MIMEBody;
2404
+        return rtrim($this->MIMEHeader.$this->mailHeader, "\n\r").static::$LE.static::$LE.$this->MIMEBody;
2405 2405
     }
2406 2406
 
2407 2407
     /**
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
         $body = '';
2439 2439
         //Create unique IDs and preset boundaries
2440 2440
         $this->uniqueid = $this->generateId();
2441
-        $this->boundary[1] = 'b1_' . $this->uniqueid;
2442
-        $this->boundary[2] = 'b2_' . $this->uniqueid;
2443
-        $this->boundary[3] = 'b3_' . $this->uniqueid;
2441
+        $this->boundary[1] = 'b1_'.$this->uniqueid;
2442
+        $this->boundary[2] = 'b2_'.$this->uniqueid;
2443
+        $this->boundary[3] = 'b3_'.$this->uniqueid;
2444 2444
 
2445 2445
         if ($this->sign_key_file) {
2446
-            $body .= $this->getMailMIME() . static::$LE;
2446
+            $body .= $this->getMailMIME().static::$LE;
2447 2447
         }
2448 2448
 
2449 2449
         $this->setWordWrap();
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
             $altBodyEncoding = 'quoted-printable';
2477 2477
         }
2478 2478
         //Use this as a preamble in all multipart message types
2479
-        $mimepre = 'This is a multi-part message in MIME format.' . static::$LE;
2479
+        $mimepre = 'This is a multi-part message in MIME format.'.static::$LE;
2480 2480
         switch ($this->message_type) {
2481 2481
             case 'inline':
2482 2482
                 $body .= $mimepre;
@@ -2494,9 +2494,9 @@  discard block
 block discarded – undo
2494 2494
                 break;
2495 2495
             case 'inline_attach':
2496 2496
                 $body .= $mimepre;
2497
-                $body .= $this->textLine('--' . $this->boundary[1]);
2497
+                $body .= $this->textLine('--'.$this->boundary[1]);
2498 2498
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2499
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2499
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2500 2500
                 $body .= static::$LE;
2501 2501
                 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
2502 2502
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2525,9 +2525,9 @@  discard block
 block discarded – undo
2525 2525
                 $body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2526 2526
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2527 2527
                 $body .= static::$LE;
2528
-                $body .= $this->textLine('--' . $this->boundary[1]);
2528
+                $body .= $this->textLine('--'.$this->boundary[1]);
2529 2529
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2530
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2530
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2531 2531
                 $body .= static::$LE;
2532 2532
                 $body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
2533 2533
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2538,9 +2538,9 @@  discard block
 block discarded – undo
2538 2538
                 break;
2539 2539
             case 'alt_attach':
2540 2540
                 $body .= $mimepre;
2541
-                $body .= $this->textLine('--' . $this->boundary[1]);
2541
+                $body .= $this->textLine('--'.$this->boundary[1]);
2542 2542
                 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2543
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2543
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2544 2544
                 $body .= static::$LE;
2545 2545
                 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2546 2546
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
@@ -2558,16 +2558,16 @@  discard block
 block discarded – undo
2558 2558
                 break;
2559 2559
             case 'alt_inline_attach':
2560 2560
                 $body .= $mimepre;
2561
-                $body .= $this->textLine('--' . $this->boundary[1]);
2561
+                $body .= $this->textLine('--'.$this->boundary[1]);
2562 2562
                 $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
2563
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
2563
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[2].'"');
2564 2564
                 $body .= static::$LE;
2565 2565
                 $body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
2566 2566
                 $body .= $this->encodeString($this->AltBody, $altBodyEncoding);
2567 2567
                 $body .= static::$LE;
2568
-                $body .= $this->textLine('--' . $this->boundary[2]);
2568
+                $body .= $this->textLine('--'.$this->boundary[2]);
2569 2569
                 $body .= $this->headerLine('Content-Type', 'multipart/related;');
2570
-                $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
2570
+                $body .= $this->textLine("\tboundary=\"".$this->boundary[3].'"');
2571 2571
                 $body .= static::$LE;
2572 2572
                 $body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
2573 2573
                 $body .= $this->encodeString($this->Body, $bodyEncoding);
@@ -2594,12 +2594,12 @@  discard block
 block discarded – undo
2594 2594
         } elseif ($this->sign_key_file) {
2595 2595
             try {
2596 2596
                 if (!defined('PKCS7_TEXT')) {
2597
-                    throw new Exception($this->lang('extension_missing') . 'openssl');
2597
+                    throw new Exception($this->lang('extension_missing').'openssl');
2598 2598
                 }
2599 2599
                 // @TODO would be nice to use php://temp streams here
2600 2600
                 $file = tempnam(sys_get_temp_dir(), 'mail');
2601 2601
                 if (false === file_put_contents($file, $body)) {
2602
-                    throw new Exception($this->lang('signing') . ' Could not write temp file');
2602
+                    throw new Exception($this->lang('signing').' Could not write temp file');
2603 2603
                 }
2604 2604
                 $signed = tempnam(sys_get_temp_dir(), 'signed');
2605 2605
                 //Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
@@ -2607,16 +2607,16 @@  discard block
 block discarded – undo
2607 2607
                     $sign = @openssl_pkcs7_sign(
2608 2608
                         $file,
2609 2609
                         $signed,
2610
-                        'file://' . realpath($this->sign_cert_file),
2611
-                        ['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
2610
+                        'file://'.realpath($this->sign_cert_file),
2611
+                        ['file://'.realpath($this->sign_key_file), $this->sign_key_pass],
2612 2612
                         []
2613 2613
                     );
2614 2614
                 } else {
2615 2615
                     $sign = @openssl_pkcs7_sign(
2616 2616
                         $file,
2617 2617
                         $signed,
2618
-                        'file://' . realpath($this->sign_cert_file),
2619
-                        ['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
2618
+                        'file://'.realpath($this->sign_cert_file),
2619
+                        ['file://'.realpath($this->sign_key_file), $this->sign_key_pass],
2620 2620
                         [],
2621 2621
                         PKCS7_DETACHED,
2622 2622
                         $this->sign_extracerts_file
@@ -2628,11 +2628,11 @@  discard block
 block discarded – undo
2628 2628
                     @unlink($signed);
2629 2629
                     //The message returned by openssl contains both headers and body, so need to split them up
2630 2630
                     $parts = explode("\n\n", $body, 2);
2631
-                    $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE;
2631
+                    $this->MIMEHeader .= $parts[0].static::$LE.static::$LE;
2632 2632
                     $body = $parts[1];
2633 2633
                 } else {
2634 2634
                     @unlink($signed);
2635
-                    throw new Exception($this->lang('signing') . openssl_error_string());
2635
+                    throw new Exception($this->lang('signing').openssl_error_string());
2636 2636
                 }
2637 2637
             } catch (Exception $exc) {
2638 2638
                 $body = '';
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
         if ('' == $encoding) {
2668 2668
             $encoding = $this->Encoding;
2669 2669
         }
2670
-        $result .= $this->textLine('--' . $boundary);
2670
+        $result .= $this->textLine('--'.$boundary);
2671 2671
         $result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
2672 2672
         $result .= static::$LE;
2673 2673
         // RFC1341 part 5 says 7bit is assumed if not specified
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
      */
2689 2689
     protected function endBoundary($boundary)
2690 2690
     {
2691
-        return static::$LE . '--' . $boundary . '--' . static::$LE;
2691
+        return static::$LE.'--'.$boundary.'--'.static::$LE;
2692 2692
     }
2693 2693
 
2694 2694
     /**
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
      */
2725 2725
     public function headerLine($name, $value)
2726 2726
     {
2727
-        return $name . ': ' . $value . static::$LE;
2727
+        return $name.': '.$value.static::$LE;
2728 2728
     }
2729 2729
 
2730 2730
     /**
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
      */
2737 2737
     public function textLine($value)
2738 2738
     {
2739
-        return $value . static::$LE;
2739
+        return $value.static::$LE;
2740 2740
     }
2741 2741
 
2742 2742
     /**
@@ -2758,7 +2758,7 @@  discard block
 block discarded – undo
2758 2758
     {
2759 2759
         try {
2760 2760
             if (!@is_file($path)) {
2761
-                throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
2761
+                throw new Exception($this->lang('file_access').$path, self::STOP_CONTINUE);
2762 2762
             }
2763 2763
 
2764 2764
             // If a MIME type is not specified, try to work it out from the file name
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
                             'Content-Disposition: %s; filename="%s"%s',
2886 2886
                             $disposition,
2887 2887
                             $encoded_name,
2888
-                            static::$LE . static::$LE
2888
+                            static::$LE.static::$LE
2889 2889
                         );
2890 2890
                     } else {
2891 2891
                         if (!empty($encoded_name)) {
@@ -2893,13 +2893,13 @@  discard block
 block discarded – undo
2893 2893
                                 'Content-Disposition: %s; filename=%s%s',
2894 2894
                                 $disposition,
2895 2895
                                 $encoded_name,
2896
-                                static::$LE . static::$LE
2896
+                                static::$LE.static::$LE
2897 2897
                             );
2898 2898
                         } else {
2899 2899
                             $mime[] = sprintf(
2900 2900
                                 'Content-Disposition: %s%s',
2901 2901
                                 $disposition,
2902
-                                static::$LE . static::$LE
2902
+                                static::$LE.static::$LE
2903 2903
                             );
2904 2904
                         }
2905 2905
                     }
@@ -2940,11 +2940,11 @@  discard block
 block discarded – undo
2940 2940
     {
2941 2941
         try {
2942 2942
             if (!file_exists($path)) {
2943
-                throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
2943
+                throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE);
2944 2944
             }
2945 2945
             $file_buffer = file_get_contents($path);
2946 2946
             if (false === $file_buffer) {
2947
-                throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
2947
+                throw new Exception($this->lang('file_open').$path, self::STOP_CONTINUE);
2948 2948
             }
2949 2949
             $file_buffer = $this->encodeString($file_buffer, $encoding);
2950 2950
 
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
                 $encoded = $this->encodeQP($str);
2992 2992
                 break;
2993 2993
             default:
2994
-                $this->setError($this->lang('encoding') . $encoding);
2994
+                $this->setError($this->lang('encoding').$encoding);
2995 2995
                 break;
2996 2996
         }
2997 2997
 
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
                 $maxlen -= $maxlen % 4;
3058 3058
                 $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
3059 3059
             }
3060
-            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
3060
+            $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded);
3061 3061
         } elseif ($matchcount > 0) {
3062 3062
             //1 or more chars need encoding, use Q-encode
3063 3063
             $encoding = 'Q';
@@ -3065,8 +3065,8 @@  discard block
 block discarded – undo
3065 3065
             $maxlen = static::STD_LINE_LENGTH - $lengthsub - 8 - strlen($this->CharSet);
3066 3066
             $encoded = $this->encodeQ($str, $position);
3067 3067
             $encoded = $this->wrapText($encoded, $maxlen, true);
3068
-            $encoded = str_replace('=' . static::$LE, "\n", trim($encoded));
3069
-            $encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
3068
+            $encoded = str_replace('='.static::$LE, "\n", trim($encoded));
3069
+            $encoded = preg_replace('/^(.*)$/m', ' =?'.$this->CharSet."?$encoding?\\1?=", $encoded);
3070 3070
         } elseif (strlen($str) > $maxlen) {
3071 3071
             //No chars need encoding, but line is too long, so fold it
3072 3072
             $encoded = trim($this->wrapText($str, $maxlen, false));
@@ -3127,7 +3127,7 @@  discard block
 block discarded – undo
3127 3127
      */
3128 3128
     public function base64EncodeWrapMB($str, $linebreak = null)
3129 3129
     {
3130
-        $start = '=?' . $this->CharSet . '?B?';
3130
+        $start = '=?'.$this->CharSet.'?B?';
3131 3131
         $end = '?=';
3132 3132
         $encoded = '';
3133 3133
         if (null === $linebreak) {
@@ -3150,7 +3150,7 @@  discard block
 block discarded – undo
3150 3150
                 $chunk = base64_encode($chunk);
3151 3151
                 ++$lookBack;
3152 3152
             } while (strlen($chunk) > $length);
3153
-            $encoded .= $chunk . $linebreak;
3153
+            $encoded .= $chunk.$linebreak;
3154 3154
         }
3155 3155
 
3156 3156
         // Chomp the last linefeed
@@ -3203,7 +3203,7 @@  discard block
 block discarded – undo
3203 3203
                 // RFC 2047 section 5.1
3204 3204
                 // Replace every high ascii, control, =, ? and _ characters
3205 3205
                 /** @noinspection SuspiciousAssignmentsInspection */
3206
-                $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
3206
+                $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377'.$pattern;
3207 3207
                 break;
3208 3208
         }
3209 3209
         $matches = [];
@@ -3216,7 +3216,7 @@  discard block
 block discarded – undo
3216 3216
                 array_unshift($matches[0], '=');
3217 3217
             }
3218 3218
             foreach (array_unique($matches[0]) as $char) {
3219
-                $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
3219
+                $encoded = str_replace($char, '='.sprintf('%02X', ord($char)), $encoded);
3220 3220
             }
3221 3221
         }
3222 3222
         // Replace spaces with _ (more readable than =20)
@@ -3241,7 +3241,7 @@  discard block
 block discarded – undo
3241 3241
         $encoding = 'base64',
3242 3242
         $type = '',
3243 3243
         $disposition = 'attachment'
3244
-    ) {
3244
+    ){
3245 3245
         // If a MIME type is not specified, try to work it out from the file name
3246 3246
         if ('' == $type) {
3247 3247
             $type = static::filenameToType($filename);
@@ -3281,7 +3281,7 @@  discard block
 block discarded – undo
3281 3281
     public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
3282 3282
     {
3283 3283
         if (!@is_file($path)) {
3284
-            $this->setError($this->lang('file_access') . $path);
3284
+            $this->setError($this->lang('file_access').$path);
3285 3285
 
3286 3286
             return false;
3287 3287
         }
@@ -3335,7 +3335,7 @@  discard block
 block discarded – undo
3335 3335
         $encoding = 'base64',
3336 3336
         $type = '',
3337 3337
         $disposition = 'inline'
3338
-    ) {
3338
+    ){
3339 3339
         // If a MIME type is not specified, try to work it out from the name
3340 3340
         if ('' == $type and !empty($name)) {
3341 3341
             $type = static::filenameToType($name);
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
     {
3426 3426
         $this->RecipientsQueue = array_filter(
3427 3427
             $this->RecipientsQueue,
3428
-            function ($params) use ($kind) {
3428
+            function($params) use ($kind) {
3429 3429
                 return $params[0] != $kind;
3430 3430
             }
3431 3431
         );
@@ -3515,15 +3515,15 @@  discard block
 block discarded – undo
3515 3515
         if ('smtp' == $this->Mailer and null !== $this->smtp) {
3516 3516
             $lasterror = $this->smtp->getError();
3517 3517
             if (!empty($lasterror['error'])) {
3518
-                $msg .= $this->lang('smtp_error') . $lasterror['error'];
3518
+                $msg .= $this->lang('smtp_error').$lasterror['error'];
3519 3519
                 if (!empty($lasterror['detail'])) {
3520
-                    $msg .= ' Detail: ' . $lasterror['detail'];
3520
+                    $msg .= ' Detail: '.$lasterror['detail'];
3521 3521
                 }
3522 3522
                 if (!empty($lasterror['smtp_code'])) {
3523
-                    $msg .= ' SMTP code: ' . $lasterror['smtp_code'];
3523
+                    $msg .= ' SMTP code: '.$lasterror['smtp_code'];
3524 3524
                 }
3525 3525
                 if (!empty($lasterror['smtp_code_ex'])) {
3526
-                    $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
3526
+                    $msg .= ' Additional SMTP info: '.$lasterror['smtp_code_ex'];
3527 3527
                 }
3528 3528
             }
3529 3529
         }
@@ -3596,7 +3596,7 @@  discard block
 block discarded – undo
3596 3596
             //Is it a valid IPv4 address?
3597 3597
             return (bool) filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
3598 3598
         }
3599
-        if (filter_var('http://' . $host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
3599
+        if (filter_var('http://'.$host, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) {
3600 3600
             //Is it a syntactically valid hostname?
3601 3601
             return true;
3602 3602
         }
@@ -3622,7 +3622,7 @@  discard block
 block discarded – undo
3622 3622
                 //Include a link to troubleshooting docs on SMTP connection failure
3623 3623
                 //this is by far the biggest cause of support questions
3624 3624
                 //but it's usually not PHPMailer's fault.
3625
-                return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3625
+                return $this->language[$key].' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3626 3626
             }
3627 3627
 
3628 3628
             return $this->language[$key];
@@ -3710,14 +3710,14 @@  discard block
 block discarded – undo
3710 3710
                     }
3711 3711
                     //Hash the decoded data, not the URL so that the same data-URI image used in multiple places
3712 3712
                     //will only be embedded once, even if it used a different encoding
3713
-                    $cid = hash('sha256', $data) . '@phpmailer.0'; // RFC2392 S 2
3713
+                    $cid = hash('sha256', $data).'@phpmailer.0'; // RFC2392 S 2
3714 3714
 
3715 3715
                     if (!$this->cidExists($cid)) {
3716
-                        $this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1]);
3716
+                        $this->addStringEmbeddedImage($data, $cid, 'embed'.$imgindex, 'base64', $match[1]);
3717 3717
                     }
3718 3718
                     $message = str_replace(
3719 3719
                         $images[0][$imgindex],
3720
-                        $images[1][$imgindex] . '="cid:' . $cid . '"',
3720
+                        $images[1][$imgindex].'="cid:'.$cid.'"',
3721 3721
                         $message
3722 3722
                     );
3723 3723
                     continue;
@@ -3736,7 +3736,7 @@  discard block
 block discarded – undo
3736 3736
                     if ('.' == $directory) {
3737 3737
                         $directory = '';
3738 3738
                     }
3739
-                    $cid = hash('sha256', $url) . '@phpmailer.0'; // RFC2392 S 2
3739
+                    $cid = hash('sha256', $url).'@phpmailer.0'; // RFC2392 S 2
3740 3740
                     if (strlen($basedir) > 1 and '/' != substr($basedir, -1)) {
3741 3741
                         $basedir .= '/';
3742 3742
                     }
@@ -3744,7 +3744,7 @@  discard block
 block discarded – undo
3744 3744
                         $directory .= '/';
3745 3745
                     }
3746 3746
                     if ($this->addEmbeddedImage(
3747
-                        $basedir . $directory . $filename,
3747
+                        $basedir.$directory.$filename,
3748 3748
                         $cid,
3749 3749
                         $filename,
3750 3750
                         'base64',
@@ -3752,8 +3752,8 @@  discard block
 block discarded – undo
3752 3752
                     )
3753 3753
                     ) {
3754 3754
                         $message = preg_replace(
3755
-                            '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
3756
-                            $images[1][$imgindex] . '="cid:' . $cid . '"',
3755
+                            '/'.$images[1][$imgindex].'=["\']'.preg_quote($url, '/').'["\']/Ui',
3756
+                            $images[1][$imgindex].'="cid:'.$cid.'"',
3757 3757
                             $message
3758 3758
                         );
3759 3759
                     }
@@ -4027,7 +4027,7 @@  discard block
 block discarded – undo
4027 4027
 
4028 4028
             return true;
4029 4029
         }
4030
-        $this->setError($this->lang('variable_set') . $name);
4030
+        $this->setError($this->lang('variable_set').$name);
4031 4031
 
4032 4032
         return false;
4033 4033
     }
@@ -4121,7 +4121,7 @@  discard block
 block discarded – undo
4121 4121
             if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
4122 4122
                 $line .= $txt[$i];
4123 4123
             } else {
4124
-                $line .= '=' . sprintf('%02X', $ord);
4124
+                $line .= '='.sprintf('%02X', $ord);
4125 4125
             }
4126 4126
         }
4127 4127
 
@@ -4141,14 +4141,13 @@  discard block
 block discarded – undo
4141 4141
     {
4142 4142
         if (!defined('PKCS7_TEXT')) {
4143 4143
             if ($this->exceptions) {
4144
-                throw new Exception($this->lang('extension_missing') . 'openssl');
4144
+                throw new Exception($this->lang('extension_missing').'openssl');
4145 4145
             }
4146 4146
 
4147 4147
             return '';
4148 4148
         }
4149 4149
         $privKeyStr = !empty($this->DKIM_private_string) ?
4150
-            $this->DKIM_private_string :
4151
-            file_get_contents($this->DKIM_private);
4150
+            $this->DKIM_private_string : file_get_contents($this->DKIM_private);
4152 4151
         if ('' != $this->DKIM_passphrase) {
4153 4152
             $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
4154 4153
         } else {
@@ -4200,7 +4199,7 @@  discard block
 block discarded – undo
4200 4199
             //But then says to delete space before and after the colon.
4201 4200
             //Net result is the same as trimming both ends of the value.
4202 4201
             //by elimination, the same applies to the field name
4203
-            $lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
4202
+            $lines[$key] = trim($heading, " \t").':'.trim($value, " \t");
4204 4203
         }
4205 4204
 
4206 4205
         return implode("\r\n", $lines);
@@ -4226,7 +4225,7 @@  discard block
 block discarded – undo
4226 4225
         $body = static::normalizeBreaks($body, "\r\n");
4227 4226
 
4228 4227
         //Reduce multiple trailing line breaks to a single one
4229
-        return rtrim($body, "\r\n") . "\r\n";
4228
+        return rtrim($body, "\r\n")."\r\n";
4230 4229
     }
4231 4230
 
4232 4231
     /**
@@ -4282,33 +4281,33 @@  discard block
 block discarded – undo
4282 4281
         if ('' == $this->DKIM_identity) {
4283 4282
             $ident = '';
4284 4283
         } else {
4285
-            $ident = ' i=' . $this->DKIM_identity . ';';
4286
-        }
4287
-        $dkimhdrs = 'DKIM-Signature: v=1; a=' .
4288
-            $DKIMsignatureType . '; q=' .
4289
-            $DKIMquery . '; l=' .
4290
-            $DKIMlen . '; s=' .
4291
-            $this->DKIM_selector .
4292
-            ";\r\n" .
4293
-            "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
4294
-            "\th=From:To:Date:Subject;\r\n" .
4295
-            "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
4296
-            "\tz=$from\r\n" .
4297
-            "\t|$to\r\n" .
4298
-            "\t|$date\r\n" .
4299
-            "\t|$subject;\r\n" .
4300
-            "\tbh=" . $DKIMb64 . ";\r\n" .
4284
+            $ident = ' i='.$this->DKIM_identity.';';
4285
+        }
4286
+        $dkimhdrs = 'DKIM-Signature: v=1; a='.
4287
+            $DKIMsignatureType.'; q='.
4288
+            $DKIMquery.'; l='.
4289
+            $DKIMlen.'; s='.
4290
+            $this->DKIM_selector.
4291
+            ";\r\n".
4292
+            "\tt=".$DKIMtime.'; c='.$DKIMcanonicalization.";\r\n".
4293
+            "\th=From:To:Date:Subject;\r\n".
4294
+            "\td=".$this->DKIM_domain.';'.$ident."\r\n".
4295
+            "\tz=$from\r\n".
4296
+            "\t|$to\r\n".
4297
+            "\t|$date\r\n".
4298
+            "\t|$subject;\r\n".
4299
+            "\tbh=".$DKIMb64.";\r\n".
4301 4300
             "\tb=";
4302 4301
         $toSign = $this->DKIM_HeaderC(
4303
-            $from_header . "\r\n" .
4304
-            $to_header . "\r\n" .
4305
-            $date_header . "\r\n" .
4306
-            $subject_header . "\r\n" .
4302
+            $from_header."\r\n".
4303
+            $to_header."\r\n".
4304
+            $date_header."\r\n".
4305
+            $subject_header."\r\n".
4307 4306
             $dkimhdrs
4308 4307
         );
4309 4308
         $signed = $this->DKIM_Sign($toSign);
4310 4309
 
4311
-        return static::normalizeBreaks($dkimhdrs . $signed) . static::$LE;
4310
+        return static::normalizeBreaks($dkimhdrs.$signed).static::$LE;
4312 4311
     }
4313 4312
 
4314 4313
     /**
@@ -4321,7 +4320,7 @@  discard block
 block discarded – undo
4321 4320
      */
4322 4321
     public static function hasLineLongerThanMax($str)
4323 4322
     {
4324
-        return (bool) preg_match('/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) . ',})/m', $str);
4323
+        return (bool) preg_match('/^(.{'.(self::MAX_LINE_LENGTH + strlen(static::$LE)).',})/m', $str);
4325 4324
     }
4326 4325
 
4327 4326
     /**
Please login to merge, or discard this patch.
manager/includes/controls/phpmailer/POP3.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@
 block discarded – undo
209 209
      * Connect to a POP3 server.
210 210
      *
211 211
      * @param string   $host
212
-     * @param int|bool $port
212
+     * @param integer $port
213 213
      * @param int      $tval
214 214
      *
215 215
      * @return bool
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $username = '',
150 150
         $password = '',
151 151
         $debug_level = 0
152
-    ) {
152
+    ){
153 153
         $pop = new self();
154 154
 
155 155
         return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
         }
289 289
 
290 290
         // Send the Username
291
-        $this->sendString("USER $username" . static::LE);
291
+        $this->sendString("USER $username".static::LE);
292 292
         $pop3_response = $this->getResponse();
293 293
         if ($this->checkResponse($pop3_response)) {
294 294
             // Send the Password
295
-            $this->sendString("PASS $password" . static::LE);
295
+            $this->sendString("PASS $password".static::LE);
296 296
             $pop3_response = $this->getResponse();
297 297
             if ($this->checkResponse($pop3_response)) {
298 298
                 return true;
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     protected function catchWarning($errno, $errstr, $errfile, $errline)
413 413
     {
414 414
         $this->setError(
415
-            'Connecting to the POP3 server raised a PHP warning:' .
415
+            'Connecting to the POP3 server raised a PHP warning:'.
416 416
             "errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
417 417
         );
418 418
     }
Please login to merge, or discard this patch.
manager/includes/controls/phpmailer/SMTP.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1314,7 +1314,7 @@
 block discarded – undo
1314 1314
      * If no reply has been received yet, it will return null.
1315 1315
      * If no pattern was matched, it will return false.
1316 1316
      *
1317
-     * @return bool|null|string
1317
+     * @return string
1318 1318
      *
1319 1319
      * @see recordLastTransactionID()
1320 1320
      */
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         }
308 308
         // Connect to the SMTP server
309 309
         $this->edebug(
310
-            "Connection: opening to $host:$port, timeout=$timeout, options=" .
310
+            "Connection: opening to $host:$port, timeout=$timeout, options=".
311 311
             (count($options) > 0 ? var_export($options, true) : 'array()'),
312 312
             self::DEBUG_CONNECTION
313 313
         );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             $socket_context = stream_context_create($options);
318 318
             set_error_handler([$this, 'errorHandler']);
319 319
             $this->smtp_conn = stream_socket_client(
320
-                $host . ':' . $port,
320
+                $host.':'.$port,
321 321
                 $errno,
322 322
                 $errstr,
323 323
                 $timeout,
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                 (string) $errstr
351 351
             );
352 352
             $this->edebug(
353
-                'SMTP ERROR: ' . $this->error['error']
353
+                'SMTP ERROR: '.$this->error['error']
354 354
                 . ": $errstr ($errno)",
355 355
                 self::DEBUG_CLIENT
356 356
             );
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         }
371 371
         // Get any announcement
372 372
         $announce = $this->get_lines();
373
-        $this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
373
+        $this->edebug('SERVER -> CLIENT: '.$announce, self::DEBUG_SERVER);
374 374
 
375 375
         return true;
376 376
     }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         $password,
427 427
         $authtype = null,
428 428
         $OAuth = null
429
-    ) {
429
+    ){
430 430
         if (!$this->server_caps) {
431 431
             $this->setError('Authentication is not allowed before HELO/EHLO');
432 432
 
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
                 return false;
444 444
             }
445 445
 
446
-            $this->edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
446
+            $this->edebug('Auth method requested: '.($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
447 447
             $this->edebug(
448
-                'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
448
+                'Auth methods available on the server: '.implode(',', $this->server_caps['AUTH']),
449 449
                 self::DEBUG_LOWLEVEL
450 450
             );
451 451
 
452 452
             //If we have requested a specific auth type, check the server supports it before trying others
453 453
             if (!in_array($authtype, $this->server_caps['AUTH'])) {
454
-                $this->edebug('Requested auth method not available: ' . $authtype, self::DEBUG_LOWLEVEL);
454
+                $this->edebug('Requested auth method not available: '.$authtype, self::DEBUG_LOWLEVEL);
455 455
                 $authtype = null;
456 456
             }
457 457
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
                     return false;
471 471
                 }
472
-                self::edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL);
472
+                self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
473 473
             }
474 474
 
475 475
             if (!in_array($authtype, $this->server_caps['AUTH'])) {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 // Send encoded username and password
490 490
                 if (!$this->sendCommand(
491 491
                     'User & Password',
492
-                    base64_encode("\0" . $username . "\0" . $password),
492
+                    base64_encode("\0".$username."\0".$password),
493 493
                     235
494 494
                 )
495 495
                 ) {
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 $challenge = base64_decode(substr($this->last_reply, 4));
518 518
 
519 519
                 // Build the response
520
-                $response = $username . ' ' . $this->hmac($challenge, $password);
520
+                $response = $username.' '.$this->hmac($challenge, $password);
521 521
 
522 522
                 // send encoded credentials
523 523
                 return $this->sendCommand('Username', base64_encode($response), 235);
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
                 $oauth = $OAuth->getOauth64();
530 530
 
531 531
                 // Start authentication
532
-                if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
532
+                if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 '.$oauth, 235)) {
533 533
                     return false;
534 534
                 }
535 535
                 break;
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
         $k_ipad = $key ^ $ipad;
577 577
         $k_opad = $key ^ $opad;
578 578
 
579
-        return md5($k_opad . pack('H*', md5($k_ipad . $data)));
579
+        return md5($k_opad.pack('H*', md5($k_ipad.$data)));
580 580
     }
581 581
 
582 582
     /**
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 }
692 692
                 //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
693 693
                 if ($in_headers) {
694
-                    $line = "\t" . $line;
694
+                    $line = "\t".$line;
695 695
                 }
696 696
             }
697 697
             $lines_out[] = $line;
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
             foreach ($lines_out as $line_out) {
701 701
                 //RFC2821 section 4.5.2
702 702
                 if (!empty($line_out) and $line_out[0] == '.') {
703
-                    $line_out = '.' . $line_out;
703
+                    $line_out = '.'.$line_out;
704 704
                 }
705
-                $this->client_send($line_out . static::LE, 'DATA');
705
+                $this->client_send($line_out.static::LE, 'DATA');
706 706
             }
707 707
         }
708 708
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
      */
749 749
     protected function sendHello($hello, $host)
750 750
     {
751
-        $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
751
+        $noerror = $this->sendCommand($hello, $hello.' '.$host, 250);
752 752
         $this->helo_rply = $this->last_reply;
753 753
         if ($noerror) {
754 754
             $this->parseHelloFields($hello);
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 
820 820
         return $this->sendCommand(
821 821
             'MAIL FROM',
822
-            'MAIL FROM:<' . $from . '>' . $useVerp,
822
+            'MAIL FROM:<'.$from.'>'.$useVerp,
823 823
             250
824 824
         );
825 825
     }
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
     {
860 860
         return $this->sendCommand(
861 861
             'RCPT TO',
862
-            'RCPT TO:<' . $address . '>',
862
+            'RCPT TO:<'.$address.'>',
863 863
             [250, 251]
864 864
         );
865 865
     }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 
899 899
             return false;
900 900
         }
901
-        $this->client_send($commandstring . static::LE, $command);
901
+        $this->client_send($commandstring.static::LE, $command);
902 902
 
903 903
         $this->last_reply = $this->get_lines();
904 904
         // Fetch SMTP code and possible error code explanation
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
             $code_ex = (count($matches) > 2 ? $matches[2] : null);
909 909
             // Cut off error code from each response line
910 910
             $detail = preg_replace(
911
-                "/{$code}[ -]" .
912
-                ($code_ex ? str_replace('.', '\\.', $code_ex) . ' ' : '') . '/m',
911
+                "/{$code}[ -]".
912
+                ($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '').'/m',
913 913
                 '',
914 914
                 $this->last_reply
915 915
             );
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
             $detail = substr($this->last_reply, 4);
921 921
         }
922 922
 
923
-        $this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
923
+        $this->edebug('SERVER -> CLIENT: '.$this->last_reply, self::DEBUG_SERVER);
924 924
 
925 925
         if (!in_array($code, (array) $expect)) {
926 926
             $this->setError(
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
                 $code_ex
931 931
             );
932 932
             $this->edebug(
933
-                'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
933
+                'SMTP ERROR: '.$this->error['error'].': '.$this->last_reply,
934 934
                 self::DEBUG_CLIENT
935 935
             );
936 936
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
     public function turn()
997 997
     {
998 998
         $this->setError('The SMTP TURN command is not implemented');
999
-        $this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
999
+        $this->edebug('SMTP NOTICE: '.$this->error['error'], self::DEBUG_CLIENT);
1000 1000
 
1001 1001
         return false;
1002 1002
     }
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
             in_array($command, ['User & Password', 'Username', 'Password'], true)) {
1018 1018
             $this->edebug('CLIENT -> SERVER: <credentials hidden>', self::DEBUG_CLIENT);
1019 1019
         } else {
1020
-            $this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT);
1020
+            $this->edebug('CLIENT -> SERVER: '.$data, self::DEBUG_CLIENT);
1021 1021
         }
1022 1022
         set_error_handler([$this, 'errorHandler']);
1023 1023
         $result = fwrite($this->smtp_conn, $data);
@@ -1123,14 +1123,14 @@  discard block
 block discarded – undo
1123 1123
             //Must pass vars in here as params are by reference
1124 1124
             if (!stream_select($selR, $selW, $selW, $this->Timelimit)) {
1125 1125
                 $this->edebug(
1126
-                    'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
1126
+                    'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)',
1127 1127
                     self::DEBUG_LOWLEVEL
1128 1128
                 );
1129 1129
                 break;
1130 1130
             }
1131 1131
             //Deliberate noise suppression - errors are handled afterwards
1132 1132
             $str = @fgets($this->smtp_conn, 515);
1133
-            $this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL);
1133
+            $this->edebug('SMTP INBOUND: "'.trim($str).'"', self::DEBUG_LOWLEVEL);
1134 1134
             $data .= $str;
1135 1135
             // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
1136 1136
             // or 4th character is a space, we are done reading, break the loop,
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
             $info = stream_get_meta_data($this->smtp_conn);
1143 1143
             if ($info['timed_out']) {
1144 1144
                 $this->edebug(
1145
-                    'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
1145
+                    'SMTP -> get_lines(): timed-out ('.$this->Timeout.' sec)',
1146 1146
                     self::DEBUG_LOWLEVEL
1147 1147
                 );
1148 1148
                 break;
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
             // Now check if reads took too long
1151 1151
             if ($endtime and time() > $endtime) {
1152 1152
                 $this->edebug(
1153
-                    'SMTP -> get_lines(): timelimit reached (' .
1154
-                    $this->Timelimit . ' sec)',
1153
+                    'SMTP -> get_lines(): timelimit reached ('.
1154
+                    $this->Timelimit.' sec)',
1155 1155
                     self::DEBUG_LOWLEVEL
1156 1156
                 );
1157 1157
                 break;
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/browser.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -666,6 +666,9 @@  discard block
 block discarded – undo
666 666
             return json_encode(array('version' => false));
667 667
     }
668 668
 
669
+    /**
670
+     * @param string $dir
671
+     */
669 672
     protected function moveUploadFile($file, $dir) {
670 673
         $message = $this->checkUploadedFile($file);
671 674
 
@@ -697,6 +700,9 @@  discard block
 block discarded – undo
697 700
         return "/" . basename($target);
698 701
     }
699 702
 
703
+    /**
704
+     * @param string $file
705
+     */
700 706
     protected function sendDefaultThumb($file=null) {
701 707
         if ($file !== null) {
702 708
             $ext = file::getExtension($file);
@@ -873,6 +879,9 @@  discard block
 block discarded – undo
873 879
         return "";
874 880
     }
875 881
 
882
+    /**
883
+     * @param string $message
884
+     */
876 885
     protected function errorMsg($message, array $data=null) {
877 886
         if (in_array($this->action, array("thumb", "upload", "download", "downloadDir")))
878 887
             die($this->label($message, $data));
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class browser extends uploader {
15
+class browser extends uploader{
16 16
     protected $action;
17 17
     protected $thumbsDir;
18 18
     protected $thumbsTypeDir;
19 19
 
20
-    public function __construct($modx) {
20
+    public function __construct($modx){
21 21
         parent::__construct($modx);
22 22
 
23 23
         if (isset($this->post['dir'])) {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             $this->get['dir'] = $dir;
33 33
         }
34 34
 
35
-        $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
35
+        $thumbsDir = $this->config['uploadDir']."/".$this->config['thumbsDir'];
36 36
         if ((
37 37
                 !is_dir($thumbsDir) &&
38 38
                 !@mkdir($thumbsDir, $this->config['dirPerms'])
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
             $this->config['theme'] = $this->get['theme'];
71 71
     }
72 72
 
73
-    public function action() {
73
+    public function action(){
74 74
         $act = isset($this->get['act']) ? $this->get['act'] : "browser";
75
-        if(!preg_match('@^[0-9a-zA-Z_]+$@', $act)) $this->errorMsg("Unknown error.");
75
+        if (!preg_match('@^[0-9a-zA-Z_]+$@', $act)) $this->errorMsg("Unknown error.");
76 76
         if (!method_exists($this, "act_$act"))
77 77
             $act = "browser";
78 78
         $this->action = $act;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             $this->session['dir'] = $this->type;
95 95
         else {
96 96
             $type = $this->getTypeFromPath($this->session['dir']);
97
-            $dir = $this->config['uploadDir'] . "/" . $this->session['dir'];
97
+            $dir = $this->config['uploadDir']."/".$this->session['dir'];
98 98
             if (($type != $this->type) || !is_dir($dir) || !is_readable($dir))
99 99
                 $this->session['dir'] = $this->type;
100 100
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             : $return;
116 116
     }
117 117
 
118
-    protected function act_browser() {
118
+    protected function act_browser(){
119 119
         if (isset($this->get['dir']) &&
120 120
             is_dir("{$this->typeDir}/{$this->get['dir']}") &&
121 121
             is_readable("{$this->typeDir}/{$this->get['dir']}")
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         return $this->output();
126 126
     }
127 127
 
128
-    protected function act_init() {
128
+    protected function act_init(){
129 129
         $tree = $this->getDirInfo($this->typeDir);
130 130
         $tree['dirs'] = $this->getTree($this->session['dir']);
131 131
         if (!is_array($tree['dirs']) || !count($tree['dirs']))
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         return json_encode($data);
141 141
     }
142 142
 
143
-    protected function act_thumb() {
143
+    protected function act_thumb(){
144 144
         $this->getDir($this->get['dir'], true);
145 145
         if (!isset($this->get['file']) || !isset($this->get['dir']))
146 146
             $this->sendDefaultThumb();
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             $this->sendDefaultThumb();
150 150
         $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/$file";
151 151
         if (!is_file($file) || !is_readable($file)) {
152
-            $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file);
152
+            $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/".basename($file);
153 153
             if (!is_file($file) || !is_readable($file))
154 154
                 $this->sendDefaultThumb($file);
155 155
             $image = image::factory($this->imageDriver, $file);
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
         httpCache::file($file, "image/jpeg");
172 172
     }
173 173
 
174
-    protected function act_expand() {
174
+    protected function act_expand(){
175 175
         return json_encode(array('dirs' => $this->getDirs($this->postDir())));
176 176
     }
177 177
 
178
-    protected function act_chDir() {
178
+    protected function act_chDir(){
179 179
         $this->postDir(); // Just for existing check
180
-        $this->session['dir'] = $this->type . "/" . $this->post['dir'];
180
+        $this->session['dir'] = $this->type."/".$this->post['dir'];
181 181
         $dirWritable = dir::isWritable("{$this->config['uploadDir']}/{$this->session['dir']}");
182 182
         return json_encode(array(
183 183
             'files' => $this->getFiles($this->session['dir']),
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         ));
186 186
     }
187 187
 
188
-    protected function act_newDir() {
188
+    protected function act_newDir(){
189 189
         if (!$this->config['access']['dirs']['create'] ||
190 190
             !isset($this->post['dir']) ||
191 191
             !isset($this->post['newDir'])
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         return true;
208 208
     }
209 209
 
210
-    protected function act_renameDir() {
210
+    protected function act_renameDir(){
211 211
         if (!$this->config['access']['dirs']['rename'] ||
212 212
             !isset($this->post['dir']) ||
213 213
             !isset($this->post['newName'])
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
             $this->errorMsg("Unallowable characters in folder name.");
223 223
         if (substr($newName, 0, 1) == ".")
224 224
             $this->errorMsg("Folder name shouldn't begins with '.'");
225
-        if (!@rename($dir, dirname($dir) . "/$newName"))
225
+        if (!@rename($dir, dirname($dir)."/$newName"))
226 226
             $this->errorMsg("Cannot rename the folder.");
227 227
         $thumbDir = "$this->thumbsTypeDir/{$this->post['dir']}";
228 228
         if (is_dir($thumbDir))
229
-            @rename($thumbDir, dirname($thumbDir) . "/$newName");
229
+            @rename($thumbDir, dirname($thumbDir)."/$newName");
230 230
         return json_encode(array('name' => $newName));
231 231
     }
232 232
 
233
-    protected function act_deleteDir() {
233
+    protected function act_deleteDir(){
234 234
         if (!$this->config['access']['dirs']['delete'] ||
235 235
             !isset($this->post['dir']) ||
236 236
             !strlen(trim($this->post['dir']))
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         return true;
251 251
     }
252 252
 
253
-    protected function act_upload() {
253
+    protected function act_upload(){
254 254
         if (!$this->config['access']['files']['upload'] ||
255 255
             !isset($this->post['dir'])
256 256
         )
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
             return $this->moveUploadFile($this->file, $dir);
276 276
     }
277 277
 
278
-    protected function act_download() {
278
+    protected function act_download(){
279 279
         $dir = $this->postDir();
280 280
         if (!isset($this->post['dir']) ||
281 281
             !isset($this->post['file']) ||
282
-            strpos($this->post['file'],'../')!==false ||
282
+            strpos($this->post['file'], '../') !== false ||
283 283
             (false === ($file = "$dir/{$this->post['file']}")) ||
284 284
             !file_exists($file) || !is_readable($file)
285 285
         )
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
291 291
         header("Cache-Control: private", false);
292 292
         header("Content-Type: application/octet-stream");
293
-        header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $this->post['file']) . '"');
293
+        header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $this->post['file']).'"');
294 294
         header("Content-Transfer-Encoding:­ binary");
295
-        header("Content-Length: " . filesize($file));
295
+        header("Content-Length: ".filesize($file));
296 296
         readfile($file);
297 297
         die;
298 298
     }
299 299
 
300
-    protected function act_rename() {
300
+    protected function act_rename(){
301 301
         $dir = $this->postDir();
302 302
         if (!$this->config['access']['files']['rename'] ||
303 303
             !isset($this->post['dir']) ||
304 304
             !isset($this->post['file']) ||
305
-            strpos($this->post['file'],'../')!==false ||
305
+            strpos($this->post['file'], '../') !== false ||
306 306
             !isset($this->post['newName']) ||
307 307
             (false === ($file = "$dir/{$this->post['file']}")) ||
308 308
             !file_exists($file) || !is_readable($file) || !file::isWritable($file)
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
         $thumbFile = "$thumbDir/{$this->post['file']}";
338 338
 
339 339
         if (file_exists($thumbFile))
340
-            @rename($thumbFile, "$thumbDir/" . basename($newName));
340
+            @rename($thumbFile, "$thumbDir/".basename($newName));
341 341
         return true;
342 342
     }
343 343
 
344
-    protected function act_delete() {
344
+    protected function act_delete(){
345 345
         $dir = $this->postDir();
346 346
         if (!$this->config['access']['files']['delete'] ||
347 347
             !isset($this->post['dir']) ||
348 348
             !isset($this->post['file']) ||
349
-            strpos($this->post['file'],'../')!==false ||
349
+            strpos($this->post['file'], '../') !== false ||
350 350
             (false === ($file = "$dir/{$this->post['file']}")) ||
351 351
             !file_exists($file) || !is_readable($file) || !file::isWritable($file) ||
352 352
             !@unlink($file)
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         return true;
359 359
     }
360 360
 
361
-    protected function act_cp_cbd() {
361
+    protected function act_cp_cbd(){
362 362
         $dir = $this->postDir();
363 363
         if (!$this->config['access']['files']['copy'] ||
364 364
             !isset($this->post['dir']) ||
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             $this->errorMsg("Unknown error.");
370 370
 
371 371
         $error = array();
372
-        foreach($this->post['files'] as $file) {
372
+        foreach ($this->post['files'] as $file) {
373 373
             $file = path::normalize($file);
374 374
             if (substr($file, 0, 1) == ".") continue;
375 375
             $type = explode("/", $file);
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
             if (!file_exists($path))
383 383
                 $error[] = $this->label("The file '{file}' does not exist.", $replace);
384 384
             elseif (substr($base, 0, 1) == ".")
385
-                $error[] = "$base: " . $this->label("File name shouldn't begins with '.'");
385
+                $error[] = "$base: ".$this->label("File name shouldn't begins with '.'");
386 386
             elseif (!$this->validateExtension($ext, $type))
387
-                $error[] = "$base: " . $this->label("Denied file extension.");
387
+                $error[] = "$base: ".$this->label("Denied file extension.");
388 388
             elseif (file_exists("$dir/$base"))
389
-                $error[] = "$base: " . $this->label("A file or folder with that name already exists.");
389
+                $error[] = "$base: ".$this->label("A file or folder with that name already exists.");
390 390
             elseif (!is_readable($path) || !is_file($path))
391 391
                 $error[] = $this->label("Cannot read '{file}'.", $replace);
392 392
             elseif (!@copy($path, "$dir/$base"))
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         return true;
410 410
     }
411 411
 
412
-    protected function act_mv_cbd() {
412
+    protected function act_mv_cbd(){
413 413
         $dir = $this->postDir();
414 414
         if (!$this->config['access']['files']['move'] ||
415 415
             !isset($this->post['dir']) ||
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
             $this->errorMsg("Unknown error.");
421 421
 
422 422
         $error = array();
423
-        foreach($this->post['files'] as $file) {
423
+        foreach ($this->post['files'] as $file) {
424 424
             $file = path::normalize($file);
425 425
             if (substr($file, 0, 1) == ".") continue;
426 426
             $type = explode("/", $file);
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
             if (!file_exists($path))
434 434
                 $error[] = $this->label("The file '{file}' does not exist.", $replace);
435 435
             elseif (substr($base, 0, 1) == ".")
436
-                $error[] = "$base: " . $this->label("File name shouldn't begins with '.'");
436
+                $error[] = "$base: ".$this->label("File name shouldn't begins with '.'");
437 437
             elseif (!$this->validateExtension($ext, $type))
438
-                $error[] = "$base: " . $this->label("Denied file extension.");
438
+                $error[] = "$base: ".$this->label("Denied file extension.");
439 439
             elseif (file_exists("$dir/$base"))
440
-                $error[] = "$base: " . $this->label("A file or folder with that name already exists.");
440
+                $error[] = "$base: ".$this->label("A file or folder with that name already exists.");
441 441
             elseif (!is_readable($path) || !is_file($path))
442 442
                 $error[] = $this->label("Cannot read '{file}'.", $replace);
443 443
             elseif (!file::isWritable($path) || !@rename($path, "$dir/$base"))
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         return true;
461 461
     }
462 462
 
463
-    protected function act_rm_cbd() {
463
+    protected function act_rm_cbd(){
464 464
         if (!$this->config['access']['files']['delete'] ||
465 465
             !isset($this->post['files']) ||
466 466
             !is_array($this->post['files']) ||
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             $this->errorMsg("Unknown error.");
470 470
 
471 471
         $error = array();
472
-        foreach($this->post['files'] as $file) {
472
+        foreach ($this->post['files'] as $file) {
473 473
             $file = path::normalize($file);
474 474
             if (substr($file, 0, 1) == ".") continue;
475 475
             $type = explode("/", $file);
@@ -492,25 +492,25 @@  discard block
 block discarded – undo
492 492
         return true;
493 493
     }
494 494
 
495
-    protected function act_downloadDir() {
495
+    protected function act_downloadDir(){
496 496
         $dir = $this->postDir();
497 497
         if (!isset($this->post['dir']) || $this->config['denyZipDownload'])
498 498
             $this->errorMsg("Unknown error.");
499
-        $filename = basename($dir) . ".zip";
499
+        $filename = basename($dir).".zip";
500 500
         do {
501
-            $file = md5(time() . session_id());
501
+            $file = md5(time().session_id());
502 502
             $file = "{$this->config['uploadDir']}/$file.zip";
503 503
         } while (file_exists($file));
504 504
         new zipFolder($file, $dir);
505 505
         header("Content-Type: application/x-zip");
506
-        header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $filename) . '"');
507
-        header("Content-Length: " . filesize($file));
506
+        header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $filename).'"');
507
+        header("Content-Length: ".filesize($file));
508 508
         readfile($file);
509 509
         unlink($file);
510 510
         die;
511 511
     }
512 512
 
513
-    protected function act_downloadSelected() {
513
+    protected function act_downloadSelected(){
514 514
         $dir = $this->postDir();
515 515
         if (!isset($this->post['dir']) ||
516 516
             !isset($this->post['files']) ||
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
         }
532 532
 
533 533
         do {
534
-            $file = md5(time() . session_id());
534
+            $file = md5(time().session_id());
535 535
             $file = "{$this->config['uploadDir']}/$file.zip";
536 536
         } while (file_exists($file));
537 537
 
@@ -543,14 +543,14 @@  discard block
 block discarded – undo
543 543
             $zip->close();
544 544
         }
545 545
         header("Content-Type: application/x-zip");
546
-        header('Content-Disposition: attachment; filename="selected_files_' . basename($file) . '"');
547
-        header("Content-Length: " . filesize($file));
546
+        header('Content-Disposition: attachment; filename="selected_files_'.basename($file).'"');
547
+        header("Content-Length: ".filesize($file));
548 548
         readfile($file);
549 549
         unlink($file);
550 550
         die;
551 551
     }
552 552
 
553
-    protected function act_downloadClipboard() {
553
+    protected function act_downloadClipboard(){
554 554
         if (!isset($this->post['files']) ||
555 555
             !is_array($this->post['files']) ||
556 556
             $this->config['denyZipDownload']
@@ -566,14 +566,14 @@  discard block
 block discarded – undo
566 566
             $type = $type[0];
567 567
             if ($type != $this->type)
568 568
                 continue;
569
-            $file = $this->config['uploadDir'] . "/$file";
569
+            $file = $this->config['uploadDir']."/$file";
570 570
             if (!is_file($file) || !is_readable($file))
571 571
                 continue;
572 572
             $zipFiles[] = $file;
573 573
         }
574 574
 
575 575
         do {
576
-            $file = md5(time() . session_id());
576
+            $file = md5(time().session_id());
577 577
             $file = "{$this->config['uploadDir']}/$file.zip";
578 578
         } while (file_exists($file));
579 579
 
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
             $zip->close();
586 586
         }
587 587
         header("Content-Type: application/x-zip");
588
-        header('Content-Disposition: attachment; filename="clipboard_' . basename($file) . '"');
589
-        header("Content-Length: " . filesize($file));
588
+        header('Content-Disposition: attachment; filename="clipboard_'.basename($file).'"');
589
+        header("Content-Length: ".filesize($file));
590 590
         readfile($file);
591 591
         unlink($file);
592 592
         die;
593 593
     }
594 594
 
595
-    protected function act_check4Update() {
595
+    protected function act_check4Update(){
596 596
         if ($this->config['denyUpdateCheck'])
597 597
             return json_encode(array('version' => false));
598 598
 
@@ -632,24 +632,24 @@  discard block
 block discarded – undo
632 632
         // Curl extension
633 633
         ) {} elseif (
634 634
             function_exists("curl_init") &&
635
-            (false !== (   $curl = @curl_init($url)                                    )) &&
636
-            (              @ob_start()                 ||  (@curl_close($curl) && false)) &&
637
-            (              @curl_exec($curl)           ||  (@curl_close($curl) && false)) &&
638
-            ((false !== (  $ver = @ob_get_clean()   )) ||  (@curl_close($curl) && false)) &&
639
-            (              @curl_close($curl)          ||  true                         ) &&
635
+            (false !== ($curl = @curl_init($url))) &&
636
+            (@ob_start() || (@curl_close($curl) && false)) &&
637
+            (@curl_exec($curl) || (@curl_close($curl) && false)) &&
638
+            ((false !== ($ver = @ob_get_clean())) || (@curl_close($curl) && false)) &&
639
+            (@curl_close($curl) || true) &&
640 640
             preg_match($pattern, $ver)
641 641
 
642 642
         // Socket extension
643 643
         ) {} elseif (function_exists('socket_create')) {
644 644
             $cmd =
645
-                "GET $path " . strtoupper($protocol) . "/1.1\r\n" .
646
-                "Host: $host\r\n" .
645
+                "GET $path ".strtoupper($protocol)."/1.1\r\n".
646
+                "Host: $host\r\n".
647 647
                 "Connection: Close\r\n\r\n";
648 648
 
649
-            if ((false !== (  $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP)  )) &&
650
-                (false !==    @socket_connect($socket, $host, $port)                    ) &&
651
-                (false !==    @socket_write($socket, $cmd, strlen($cmd))                ) &&
652
-                (false !== (  $ver = @socket_read($socket, 2048)                       )) &&
649
+            if ((false !== ($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) &&
650
+                (false !== @socket_connect($socket, $host, $port)) &&
651
+                (false !== @socket_write($socket, $cmd, strlen($cmd))) &&
652
+                (false !== ($ver = @socket_read($socket, 2048))) &&
653 653
                 preg_match($responsePattern, $ver, $match)
654 654
             )
655 655
                 $ver = $match[2];
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
             return json_encode(array('version' => false));
667 667
     }
668 668
 
669
-    protected function moveUploadFile($file, $dir) {
669
+    protected function moveUploadFile($file, $dir){
670 670
         $message = $this->checkUploadedFile($file);
671 671
 
672 672
         if ($message !== true) {
@@ -676,28 +676,28 @@  discard block
 block discarded – undo
676 676
         }
677 677
 
678 678
         $filename = $this->normalizeFilename($file['name']);
679
-        $target = "$dir/" . file::getInexistantFilename($filename, $dir);
679
+        $target = "$dir/".file::getInexistantFilename($filename, $dir);
680 680
 
681 681
         if (!@move_uploaded_file($file['tmp_name'], $target) &&
682 682
             !@rename($file['tmp_name'], $target) &&
683 683
             !@copy($file['tmp_name'], $target)
684 684
         ) {
685 685
             @unlink($file['tmp_name']);
686
-            return "{$file['name']}: " . $this->label("Cannot move uploaded file to target folder.");
686
+            return "{$file['name']}: ".$this->label("Cannot move uploaded file to target folder.");
687 687
         } elseif (function_exists('chmod'))
688 688
             chmod($target, $this->config['filePerms']);
689 689
         
690
-        $this->modx->invokeEvent('OnFileBrowserUpload',array(
690
+        $this->modx->invokeEvent('OnFileBrowserUpload', array(
691 691
             'filepath'=>realpath($dir),
692
-            'filename'=>str_replace("/","",str_replace($dir,"",realpath($target)))
692
+            'filename'=>str_replace("/", "", str_replace($dir, "", realpath($target)))
693 693
         ));
694 694
         
695 695
         $this->makeThumb($target);
696 696
         
697
-        return "/" . basename($target);
697
+        return "/".basename($target);
698 698
     }
699 699
 
700
-    protected function sendDefaultThumb($file=null) {
700
+    protected function sendDefaultThumb($file = null){
701 701
         if ($file !== null) {
702 702
             $ext = file::getExtension($file);
703 703
             $thumb = "themes/{$this->config['theme']}/img/files/big/$ext.png";
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
         die;
710 710
     }
711 711
 
712
-	protected function getFiles($dir) {
712
+	protected function getFiles($dir){
713 713
 		$thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/$dir";
714 714
 		$dir = "{$this->config['uploadDir']}/$dir";
715 715
 		$return = array();
@@ -720,10 +720,10 @@  discard block
 block discarded – undo
720 720
 		foreach ($files as $file) {
721 721
 			$ext = file::getExtension($file);
722 722
 			$smallThumb = false;
723
-			if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg' )) ) {
723
+			if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg'))) {
724 724
 				$size = @getimagesize($file);
725 725
 				if (is_array($size) && count($size)) {
726
-					$thumb_file = "$thumbDir/" . basename($file);
726
+					$thumb_file = "$thumbDir/".basename($file);
727 727
 					if (!is_file($thumb_file) || filemtime($file) > filemtime($thumb_file))
728 728
 						$this->makeThumb($file);
729 729
 					$smallThumb =
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
 			if ($stat === false) continue;
737 737
 			$name = basename($file);
738 738
 			$types = $this->config['types'];
739
-			$types = explode(' ',$types['images'].' '.$types['image']);
740
-			if (substr($name,0,1) == '.' && !$this->config['showHiddenFiles']) continue;
741
-			if ($this->type == 'images' && !in_array(strtolower($ext),$types)) continue;
739
+			$types = explode(' ', $types['images'].' '.$types['image']);
740
+			if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) continue;
741
+			if ($this->type == 'images' && !in_array(strtolower($ext), $types)) continue;
742 742
 			$bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/$ext.png");
743 743
 			$smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/$ext.png");
744 744
 			$thumb = file_exists("$thumbDir/$name");
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		return $return;
759 759
 	}
760 760
 
761
-    protected function getTree($dir, $index=0) {
761
+    protected function getTree($dir, $index = 0){
762 762
         $path = explode("/", $dir);
763 763
 
764 764
         $pdir = "";
@@ -793,25 +793,25 @@  discard block
 block discarded – undo
793 793
         return $dirs;
794 794
     }
795 795
 
796
-    protected function postDir($existent=true) {
796
+    protected function postDir($existent = true){
797 797
         $dir = $this->typeDir;
798 798
         if (isset($this->post['dir']))
799
-            $dir .= "/" . $this->post['dir'];
799
+            $dir .= "/".$this->post['dir'];
800 800
         if ($existent && (!is_dir($dir) || !is_readable($dir)))
801 801
             $this->errorMsg("Inexistant or inaccessible folder.");
802 802
         return $dir;
803 803
     }
804 804
 
805
-    protected function getDir($existent=true) {
805
+    protected function getDir($existent = true){
806 806
         $dir = $this->typeDir;
807 807
         if (isset($this->get['dir']))
808
-            $dir .= "/" . $this->get['dir'];
808
+            $dir .= "/".$this->get['dir'];
809 809
         if ($existent && (!is_dir($dir) || !is_readable($dir)))
810 810
             $this->errorMsg("Inexistant or inaccessible folder.");
811 811
         return $dir;
812 812
     }
813 813
 
814
-    protected function getDirs($dir) {
814
+    protected function getDirs($dir){
815 815
         $dirs = dir::content($dir, array('types' => "dir"));
816 816
         $return = array();
817 817
         if (is_array($dirs)) {
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
         return $return;
827 827
     }
828 828
 
829
-    protected function getDirInfo($dir, $removable=false) {
829
+    protected function getDirInfo($dir, $removable = false){
830 830
         if ((substr(basename($dir), 0, 1) == ".") || !is_dir($dir) || !is_readable($dir))
831 831
             return false;
832 832
         $dirs = dir::content($dir, array('types' => "dir"));
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
         return $info;
854 854
     }
855 855
 
856
-    protected function output($data=null, $template=null) {
856
+    protected function output($data = null, $template = null){
857 857
         if (!is_array($data)) $data = array();
858 858
         if ($template === null)
859 859
             $template = $this->action;
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
         return "";
874 874
     }
875 875
 
876
-    protected function errorMsg($message, array $data=null) {
876
+    protected function errorMsg($message, array $data = null){
877 877
         if (in_array($this->action, array("thumb", "upload", "download", "downloadDir")))
878 878
             die($this->label($message, $data));
879 879
         if (($this->action === null) || ($this->action == "browser"))
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/uploader.php 2 patches
Doc Comments   +18 added lines patch added patch discarded remove patch
@@ -385,6 +385,9 @@  discard block
 block discarded – undo
385 385
 	}
386 386
 
387 387
 
388
+	/**
389
+	 * @return string
390
+	 */
388 391
 	protected function normalizeFilename($filename) {
389 392
 		if ($this->getTransaliasSettings()) {
390 393
         		$format = strrchr($filename, ".");
@@ -394,6 +397,9 @@  discard block
 block discarded – undo
394 397
         	return $filename;
395 398
 	}
396 399
 
400
+	/**
401
+	 * @param string $dirname
402
+	 */
397 403
 	protected function normalizeDirname($dirname) {
398 404
         return $this->modx->stripAlias($dirname);
399 405
     }
@@ -506,6 +512,9 @@  discard block
 block discarded – undo
506 512
         return (is_dir($path) && is_readable($path)) ? $return : false;
507 513
     }
508 514
 
515
+    /**
516
+     * @param string $ext
517
+     */
509 518
     protected function validateExtension($ext, $type) {
510 519
         $ext = trim(strtolower($ext));
511 520
         if (!isset($this->types[$type]))
@@ -531,11 +540,17 @@  discard block
 block discarded – undo
531 540
         return in_array($ext, $exts);
532 541
     }
533 542
 
543
+    /**
544
+     * @return string
545
+     */
534 546
     protected function getTypeFromPath($path) {
535 547
         return preg_match('/^([^\/]*)\/.*$/', $path, $patt)
536 548
             ? $patt[1] : $path;
537 549
     }
538 550
 
551
+    /**
552
+     * @param string $path
553
+     */
539 554
     protected function removeTypeFromPath($path) {
540 555
         return preg_match('/^[^\/]*\/(.*)$/', $path, $patt)
541 556
             ? $patt[1] : "";
@@ -728,6 +743,9 @@  discard block
 block discarded – undo
728 743
         die;
729 744
     }
730 745
 
746
+    /**
747
+     * @param string $url
748
+     */
731 749
     protected function callBack($url, $message="") {
732 750
         $message = text::jsValue($message);
733 751
         $CKfuncNum = isset($this->opener['CKEditor']['funcNum'])
Please login to merge, or discard this patch.
Spacing   +46 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class uploader {
15
+class uploader{
16 16
 
17 17
 /** Release version */
18 18
     const VERSION = "2.54";
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
 /** Next three properties are got from the current language file
74 74
   * @var string */
75
-    protected $dateTimeFull;   // Currently not used
76
-    protected $dateTimeMid;    // Currently not used
75
+    protected $dateTimeFull; // Currently not used
76
+    protected $dateTimeMid; // Currently not used
77 77
     protected $dateTimeSmall;
78 78
 
79 79
 /** Contain Specified language labels
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 /** Magic method which allows read-only access to protected or private class properties
105 105
   * @param string $property
106 106
   * @return mixed */
107
-    public function __get($property) {
107
+    public function __get($property){
108 108
         return property_exists($this, $property) ? $this->$property : null;
109 109
     }
110 110
 
111
-    public function __construct($modx) {
111
+    public function __construct($modx){
112 112
 
113 113
         //MODX
114 114
         try {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
         // COOKIES INIT
208 208
         $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
209
-        $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/';
209
+        $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/';
210 210
         if (preg_match($ip, $_SERVER['HTTP_HOST']) ||
211 211
             preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST'])
212 212
         )
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         ) {
225 225
             list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
226 226
             $path = path::normalize($path);
227
-            $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path";
227
+            $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path";
228 228
             $this->config['uploadDir'] = strlen($this->config['uploadDir'])
229 229
                 ? path::normalize($this->config['uploadDir'])
230 230
                 : path::url2fullPath("/$path");
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         foreach ($this->langInputNames as $key)
268 268
             if (isset($this->get[$key]) &&
269 269
                 preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) &&
270
-                file_exists("lang/" . strtolower($this->get[$key]) . ".php")
270
+                file_exists("lang/".strtolower($this->get[$key]).".php")
271 271
             ) {
272 272
                 $this->lang = $this->get[$key];
273 273
                 break;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             $this->backMsg("Cannot read upload folder.");
299 299
     }
300 300
 
301
-    public function upload() {
301
+    public function upload(){
302 302
         $config = &$this->config;
303 303
         $file = &$this->file;
304 304
         $url = $message = "";
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                     @mkdir(path::normalize($dir), $this->config['dirPerms'], true);
330 330
 
331 331
                 $filename = $this->normalizeFilename($file['name']);
332
-                $target = file::getInexistantFilename($dir . $filename);
332
+                $target = file::getInexistantFilename($dir.$filename);
333 333
 
334 334
                 if (!@move_uploaded_file($file['tmp_name'], $target) &&
335 335
                     !@rename($file['tmp_name'], $target) &&
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
                     $this->makeThumb($target);
343 343
                     $url = $this->typeURL;
344 344
                     if (isset($udir)) $url .= "/$udir";
345
-                    $url .= "/" . basename($target);
345
+                    $url .= "/".basename($target);
346 346
                     if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) {
347 347
                         list($unused, $protocol, $domain, $unused, $port, $path) = $patt;
348
-                        $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/";
349
-                        $url = $base . path::urlPathEncode($path);
348
+                        $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/";
349
+                        $url = $base.path::urlPathEncode($path);
350 350
                     } else
351 351
                         $url = path::urlPathEncode($url);
352 352
                 }
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
     }
366 366
 
367 367
 
368
-	protected function getTransaliasSettings() {
368
+	protected function getTransaliasSettings(){
369 369
 		$modx = evolutionCMS();
370 370
 
371 371
 		// Cleaning uploaded filename?
372 372
 		$setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1');
373
-		if ($modx->db->getValue($setting)>0) {
373
+		if ($modx->db->getValue($setting) > 0) {
374 374
 			// Transalias plugin active?
375 375
 			$res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0');
376 376
 			if ($properties = $modx->db->getValue($res)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	}
386 386
 
387 387
 
388
-	protected function normalizeFilename($filename) {
388
+	protected function normalizeFilename($filename){
389 389
 		if ($this->getTransaliasSettings()) {
390 390
         		$format = strrchr($filename, ".");
391 391
         		$filename = str_replace($format, "", $filename);
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
         	return $filename;
395 395
 	}
396 396
 
397
-	protected function normalizeDirname($dirname) {
397
+	protected function normalizeDirname($dirname){
398 398
         return $this->modx->stripAlias($dirname);
399 399
     }
400 400
 
401
-    protected function checkUploadedFile(array $aFile=null) {
401
+    protected function checkUploadedFile(array $aFile = null){
402 402
         $config = &$this->config;
403 403
         $file = ($aFile === null) ? $this->file : $aFile;
404 404
 
@@ -437,8 +437,7 @@  discard block
 block discarded – undo
437 437
                 ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ?
438 438
                     $this->label("Missing a temporary folder.") : (
439 439
                 ($file['error'] == UPLOAD_ERR_CANT_WRITE) ?
440
-                    $this->label("Failed to write file.") :
441
-                    $this->label("Unknown error.")
440
+                    $this->label("Failed to write file.") : $this->label("Unknown error.")
442 441
             )))));
443 442
 
444 443
         // HIDDEN FILENAMES CHECK
@@ -473,14 +472,14 @@  discard block
 block discarded – undo
473 472
 
474 473
 
475 474
 	// CHECK FOR MODX MAX FILE SIZE
476
-	$actualfilesize=filesize($file['tmp_name']);
475
+	$actualfilesize = filesize($file['tmp_name']);
477 476
 	if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
478 477
 	    return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
479 478
 
480 479
         return true;
481 480
     }
482 481
 
483
-    protected function checkInputDir($dir, $inclType=true, $existing=true) {
482
+    protected function checkInputDir($dir, $inclType = true, $existing = true){
484 483
         $dir = path::normalize($dir);
485 484
         if (substr($dir, 0, 1) == "/")
486 485
             $dir = substr($dir, 1);
@@ -506,7 +505,7 @@  discard block
 block discarded – undo
506 505
         return (is_dir($path) && is_readable($path)) ? $return : false;
507 506
     }
508 507
 
509
-    protected function validateExtension($ext, $type) {
508
+    protected function validateExtension($ext, $type){
510 509
         $ext = trim(strtolower($ext));
511 510
         if (!isset($this->types[$type]))
512 511
             return false;
@@ -531,17 +530,17 @@  discard block
 block discarded – undo
531 530
         return in_array($ext, $exts);
532 531
     }
533 532
 
534
-    protected function getTypeFromPath($path) {
533
+    protected function getTypeFromPath($path){
535 534
         return preg_match('/^([^\/]*)\/.*$/', $path, $patt)
536 535
             ? $patt[1] : $path;
537 536
     }
538 537
 
539
-    protected function removeTypeFromPath($path) {
538
+    protected function removeTypeFromPath($path){
540 539
         return preg_match('/^[^\/]*\/(.*)$/', $path, $patt)
541 540
             ? $patt[1] : "";
542 541
     }
543 542
 
544
-    protected function imageResize($image, $file=null) {
543
+    protected function imageResize($image, $file = null){
545 544
 
546 545
         if (!($image instanceof image)) {
547 546
             $img = image::factory($this->imageDriver, $image);
@@ -629,24 +628,24 @@  discard block
 block discarded – undo
629 628
             $img->watermark($this->config['watermark']['file'], $left, $top);
630 629
 		}
631 630
 
632
-        $options = array( 'file' => $file );
631
+        $options = array('file' => $file);
633 632
 
634
-        $type = exif_imagetype( $file );
633
+        $type = exif_imagetype($file);
635 634
 
636
-        switch ( $type ) {
635
+        switch ($type) {
637 636
             case IMAGETYPE_GIF:
638
-                return $img->output( 'gif', $options );
637
+                return $img->output('gif', $options);
639 638
 
640 639
             case IMAGETYPE_PNG:
641
-                return $img->output( 'png', $options );
640
+                return $img->output('png', $options);
642 641
 
643 642
             default:
644
-                return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) );
643
+                return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality'])));
645 644
         }
646 645
 
647 646
     }
648 647
 
649
-    protected function makeThumb($file, $overwrite=true) {
648
+    protected function makeThumb($file, $overwrite = true){
650 649
         $img = image::factory($this->imageDriver, $file);
651 650
 
652 651
         // Drop files which are not images
@@ -654,7 +653,7 @@  discard block
 block discarded – undo
654 653
             return true;
655 654
 
656 655
         $thumb = substr($file, strlen($this->config['uploadDir']));
657
-        $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb;
656
+        $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb;
658 657
         $thumb = path::normalize($thumb);
659 658
         $thumbDir = dirname($thumb);
660 659
         if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true))
@@ -677,15 +676,15 @@  discard block
 block discarded – undo
677 676
         if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight']))
678 677
             return false;
679 678
 
680
-        if ( $this->imageDriver == 'gd' ) {
681
-            $width  = imagesx( $img->image );
682
-            $height = imagesy( $img->image );
683
-            $back   = image::factory( $this->imageDriver, array( $width, $height ) );
684
-            $tile   = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' );
679
+        if ($this->imageDriver == 'gd') {
680
+            $width  = imagesx($img->image);
681
+            $height = imagesy($img->image);
682
+            $back   = image::factory($this->imageDriver, array($width, $height));
683
+            $tile   = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png');
685 684
 
686
-            imagesettile( $back->image, $tile->image );
687
-            imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED );
688
-            imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height );
685
+            imagesettile($back->image, $tile->image);
686
+            imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED);
687
+            imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height);
689 688
 
690 689
             $img = $back;
691 690
         }
@@ -697,7 +696,7 @@  discard block
 block discarded – undo
697 696
         ));
698 697
     }
699 698
 
700
-    protected function localize($langCode) {
699
+    protected function localize($langCode){
701 700
         require "lang/{$langCode}.php";
702 701
         setlocale(LC_ALL, $lang['_locale']);
703 702
         $this->charset = $lang['_charset'];
@@ -712,7 +711,7 @@  discard block
 block discarded – undo
712 711
         $this->labels = $lang;
713 712
     }
714 713
 
715
-    protected function label($string, array $data=null) {
714
+    protected function label($string, array $data = null){
716 715
         $return = isset($this->labels[$string]) ? $this->labels[$string] : $string;
717 716
         if (is_array($data))
718 717
             foreach ($data as $key => $val)
@@ -720,7 +719,7 @@  discard block
 block discarded – undo
720 719
         return $return;
721 720
     }
722 721
 
723
-    protected function backMsg($message, array $data=null) {
722
+    protected function backMsg($message, array $data = null){
724 723
         $message = $this->label($message, $data);
725 724
         if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name']))
726 725
             @unlink($this->file['tmp_name']);
@@ -728,7 +727,7 @@  discard block
 block discarded – undo
728 727
         die;
729 728
     }
730 729
 
731
-    protected function callBack($url, $message="") {
730
+    protected function callBack($url, $message = ""){
732 731
         $message = text::jsValue($message);
733 732
         $CKfuncNum = isset($this->opener['CKEditor']['funcNum'])
734 733
             ? $this->opener['CKEditor']['funcNum'] : 0;
@@ -769,7 +768,7 @@  discard block
 block discarded – undo
769 768
 
770 769
     }
771 770
 
772
-    protected function get_htaccess() {
771
+    protected function get_htaccess(){
773 772
         return "<IfModule mod_php4.c>
774 773
   php_value engine off
775 774
 </IfModule>
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_fastImage.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -183,6 +183,9 @@  discard block
 block discarded – undo
183 183
 	}
184 184
 
185 185
 
186
+	/**
187
+	 * @param integer $n
188
+	 */
186 189
 	private function getChars($n)
187 190
 	{
188 191
 		$response = null;
@@ -225,6 +228,9 @@  discard block
 block discarded – undo
225 228
 	}
226 229
 
227 230
 
231
+	/**
232
+	 * @param false|string $str
233
+	 */
228 234
 	private function readInt($str)
229 235
 	{
230 236
 		$size = unpack("C*", $str);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 					{
151 151
 						$state = 'skipframe';
152 152
 					}
153
-					elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF))))
153
+					elseif (in_array($b, array_merge(range(0xC0, 0xC3), range(0xC5, 0xC7), range(0xC9, 0xCB), range(0xCD, 0xCF))))
154 154
 					{
155 155
 						$state = 'readsize';
156 156
 					}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$response = null;
189 189
 
190 190
 		// do we need more data?
191
-		if ($this->strpos + $n -1 >= strlen($this->str))
191
+		if ($this->strpos + $n - 1 >= strlen($this->str))
192 192
 		{
193 193
 			$end = ($this->strpos + $n);
194 194
 
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_gd.php 2 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes.
169 169
     * The other dimension (height or width) will be calculated autamaticaly
170 170
     * @param integer $bigger_size
171
-    * @return array */
171
+    * @return integer[] */
172 172
 
173 173
     public function get_prop_size($bigger_size) {
174 174
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     * no samo po edno (x ili y) izmerenie
256 256
     * @param integer $width
257 257
     * @param integer $height
258
-    * @return bool */
258
+    * @return gd */
259 259
 
260 260
     public function resize_overflow($width, $height) {
261 261
 
@@ -397,6 +397,12 @@  discard block
 block discarded – undo
397 397
             return false;
398 398
     }
399 399
 
400
+    /**
401
+     * @param integer $x1
402
+     * @param integer $y1
403
+     * @param integer $x2
404
+     * @param integer $y2
405
+     */
400 406
     public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) {
401 407
         $color = $this->gd_color($color);
402 408
         if ($color === false) return false;
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class gd {
15
+class gd{
16 16
 
17 17
   /** GD resource
18 18
     * @var resource */
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     * @param mixed $image
41 41
     * @return array */
42 42
 
43
-    protected function build_image($image) {
43
+    protected function build_image($image){
44 44
 
45 45
         if ($image instanceof gd) {
46 46
             $width = $image->get_width();
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
         } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
60 60
             $image =
61
-                ($type == IMAGETYPE_GIF)      ? @imagecreatefromgif($image)  : (
62
-                ($type == IMAGETYPE_WBMP)     ? @imagecreatefromwbmp($image) : (
63
-                ($type == IMAGETYPE_JPEG)     ? @imagecreatefromjpeg($image) : (
61
+                ($type == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : (
62
+                ($type == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : (
63
+                ($type == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : (
64 64
                 ($type == IMAGETYPE_JPEG2000) ? @imagecreatefromjpeg($image) : (
65
-                ($type == IMAGETYPE_PNG)      ? @imagecreatefrompng($image)  : (
66
-                ($type == IMAGETYPE_XBM)      ? @imagecreatefromxbm($image)  : false
65
+                ($type == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : (
66
+                ($type == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false
67 67
             )))));
68 68
 
69 69
             if ($type == IMAGETYPE_PNG)
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     * @param integer $bigger_size
99 99
     * @return gd */
100 100
 
101
-    public function __construct($image, $bigger_size=null) {
101
+    public function __construct($image, $bigger_size = null){
102 102
         $this->image = $this->width = $this->height = null;
103 103
 
104 104
         $image_details = $this->build_image($image);
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
   /** Returns the GD resource
127 127
     * @return resource */
128 128
 
129
-    public function get_image() {
129
+    public function get_image(){
130 130
         return $this->image;
131 131
     }
132 132
 
133 133
   /** Returns the image width
134 134
     * @return integer */
135 135
 
136
-    public function get_width() {
136
+    public function get_width(){
137 137
         return $this->width;
138 138
     }
139 139
 
140 140
   /** Returns the image height
141 141
     * @return integer */
142 142
 
143
-    public function get_height() {
143
+    public function get_height(){
144 144
         return $this->height;
145 145
     }
146 146
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     * @param integer $resized_height
149 149
     * @return integer */
150 150
 
151
-    public function get_prop_width($resized_height) {
151
+    public function get_prop_width($resized_height){
152 152
         $width = intval(($this->width * $resized_height) / $this->height);
153 153
         if (!$width) $width = 1;
154 154
         return $width;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     * @param integer $resized_width
159 159
     * @return integer */
160 160
 
161
-    public function get_prop_height($resized_width) {
161
+    public function get_prop_height($resized_width){
162 162
         $height = intval(($this->height * $resized_width) / $this->width);
163 163
         if (!$height) $height = 1;
164 164
         return $height;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     * @param integer $bigger_size
171 171
     * @return array */
172 172
 
173
-    public function get_prop_size($bigger_size) {
173
+    public function get_prop_size($bigger_size){
174 174
 
175 175
         if ($this->width > $this->height) {
176 176
             $width = $bigger_size;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     * @param integer $height
192 192
     * @return bool */
193 193
 
194
-    public function resize($width, $height) {
194
+    public function resize($width, $height){
195 195
         if (!$width) $width = 1;
196 196
         if (!$height) $height = 1;
197 197
         return (
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     * @param mixed $src
209 209
     * @return bool */
210 210
 
211
-    public function resize_crop($src) {
211
+    public function resize_crop($src){
212 212
         $image_details = $this->build_image($src);
213 213
 
214 214
         if ($image_details !== false) {
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     * @param integer $height
239 239
     * @return bool */
240 240
 
241
-    public function resize_fit($width, $height) {
241
+    public function resize_fit($width, $height){
242 242
         if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height)))
243 243
             return true;
244 244
         if (!$width || (($height / $width) < ($this->height / $this->width)))
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     * @param integer $height
258 258
     * @return bool */
259 259
 
260
-    public function resize_overflow($width, $height) {
260
+    public function resize_overflow($width, $height){
261 261
 
262 262
         $big = (($this->width / $this->height) > ($width / $height))
263 263
             ? ($this->width * $height) / $this->height
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         return $return;
276 276
     }
277 277
 
278
-    public function gd_color() {
278
+    public function gd_color(){
279 279
         $args = func_get_args();
280 280
 
281 281
         $expr_rgb = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i';
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         return imagecolorallocate($this->image, $r, $g, $b);
318 318
     }
319 319
 
320
-    public function fill_color($color) {
320
+    public function fill_color($color){
321 321
         return $this->imagefilledrectangle(0, 0, $this->width - 1, $this->height - 1, $color);
322 322
     }
323 323
 
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 
327 327
     public function imagecopy(
328 328
         $src,
329
-        $dst_x=0, $dst_y=0,
330
-        $src_x=0, $src_y=0,
331
-        $dst_w=null, $dst_h=null,
332
-        $src_w=null, $src_h=null
333
-    ) {
329
+        $dst_x = 0, $dst_y = 0,
330
+        $src_x = 0, $src_y = 0,
331
+        $dst_w = null, $dst_h = null,
332
+        $src_w = null, $src_h = null
333
+    ){
334 334
         $image_details = $this->build_image($src);
335 335
 
336 336
         if ($image_details !== false) {
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
 
349 349
     public function imagecopyresampled(
350 350
         $src,
351
-        $dst_x=0, $dst_y=0,
352
-        $src_x=0, $src_y=0,
353
-        $dst_w=null, $dst_h=null,
354
-        $src_w=null, $src_h=null
355
-    ) {
351
+        $dst_x = 0, $dst_y = 0,
352
+        $src_x = 0, $src_y = 0,
353
+        $dst_w = null, $dst_h = null,
354
+        $src_w = null, $src_h = null
355
+    ){
356 356
         $image_details = $this->build_image($src);
357 357
 
358 358
         if ($image_details !== false) {
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
             if (is_null($src_w)) $src_w = $src_width - $src_x;
364 364
             if (is_null($src_h)) $src_h = $src_height - $src_y;
365 365
             imagealphablending($this->image, false);
366
-            imagesavealpha($this->image,true);
366
+            imagesavealpha($this->image, true);
367 367
 
368 368
 
369 369
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
 			$transindex = imagecolortransparent($src);
374 374
 			$palletsize = imagecolorstotal($src);
375
-			if($transindex >= 0 && $transindex < $palletsize) {
375
+			if ($transindex >= 0 && $transindex < $palletsize) {
376 376
 				$transcol = imagecolorsforindex($src, $transindex);
377 377
 
378 378
 			/*** end gif transparent fix ***/
@@ -381,9 +381,9 @@  discard block
 block discarded – undo
381 381
 				imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex);
382 382
 				imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
383 383
 				imagecolortransparent($this->image, $transindex);
384
-				for($y=0; $y<$dst_h; ++$y)
385
-					for($x=0; $x<$dst_w; ++$x)
386
-						if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex);
384
+				for ($y = 0; $y < $dst_h; ++$y)
385
+					for ($x = 0; $x < $dst_w; ++$x)
386
+						if (((imagecolorat($this->image, $x, $y) >> 24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex);
387 387
 				imagetruecolortopalette($this->image, true, 255);
388 388
 			}
389 389
 			else {
@@ -397,26 +397,26 @@  discard block
 block discarded – undo
397 397
             return false;
398 398
     }
399 399
 
400
-    public function imagefilledrectangle($x1, $y1, $x2, $y2, $color) {
400
+    public function imagefilledrectangle($x1, $y1, $x2, $y2, $color){
401 401
         $color = $this->gd_color($color);
402 402
         if ($color === false) return false;
403 403
         return imagefilledrectangle($this->image, $x1, $y1, $x2, $y2, $color);
404 404
     }
405 405
 
406
-    public function imagepng($filename=null, $quality=null, $filters=null) {
406
+    public function imagepng($filename = null, $quality = null, $filters = null){
407 407
         if (is_null($filename) && !headers_sent())
408 408
             header("Content-Type: image/png");
409 409
         @imagesavealpha($this->image, true);
410 410
         return imagepng($this->image, $filename, $quality, $filters);
411 411
     }
412 412
 
413
-    public function imagejpeg($filename=null, $quality=75) {
413
+    public function imagejpeg($filename = null, $quality = 75){
414 414
         if (is_null($filename) && !headers_sent())
415 415
             header("Content-Type: image/jpeg");
416 416
         return imagejpeg($this->image, $filename, $quality);
417 417
     }
418 418
 
419
-    public function imagegif($filename=null) {
419
+    public function imagegif($filename = null){
420 420
         if (is_null($filename) && !headers_sent())
421 421
             header("Content-Type: image/gif");
422 422
 			@imagesavealpha($this->image, true);
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,6 @@
 block discarded – undo
179 179
 
180 180
 /** Resize and crop the image to fit in given resolution. Returns TRUE on
181 181
   * success or FALSE on failure
182
-  * @param mixed $src
183 182
   * @param integer $offset
184 183
   * @return bool */
185 184
     abstract public function resizeCrop($width, $height, $offset=false);
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-abstract class image {
15
+abstract class image{
16 16
     const DEFAULT_JPEG_QUALITY = 75;
17 17
 
18 18
 /** Image resource or object
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
   * @param string $property
42 42
   * @return mixed */
43 43
 
44
-    final public function __get($property) {
44
+    final public function __get($property){
45 45
         return property_exists($this, $property) ? $this->$property : null;
46 46
     }
47 47
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
   * @param mixed $image
58 58
   * @param array $options */
59 59
 
60
-    public function __construct($image, array $options=array()) {
60
+    public function __construct($image, array $options = array()){
61 61
         $this->image = $this->width = $this->height = null;
62 62
         $imageDetails = $this->buildImage($image);
63 63
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
   * @param mixed $image
76 76
   * @return object */
77 77
 
78
-    final static function factory($driver, $image, array $options=array()) {
78
+    final static function factory($driver, $image, array $options = array()){
79 79
         $class = "image_$driver";
80 80
         return new $class($image, $options);
81 81
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
   * @param array $drivers
87 87
   * @return string */
88 88
 
89
-    final static function getDriver(array $drivers=array('gd')) {
89
+    final static function getDriver(array $drivers = array('gd')){
90 90
         foreach ($drivers as $driver) {
91 91
             if (!preg_match('/^[a-z0-9\_]+$/i', $driver))
92 92
                 continue;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
   * @param mixed $image
106 106
   * @return array */
107 107
 
108
-    final protected function buildImage($image) {
108
+    final protected function buildImage($image){
109 109
         $class = get_class($this);
110 110
 
111 111
         if ($image instanceof $class) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
   * @param integer $resizedHeight
132 132
   * @return integer */
133 133
 
134
-    final public function getPropWidth($resizedHeight) {
134
+    final public function getPropWidth($resizedHeight){
135 135
         $width = round(($this->width * $resizedHeight) / $this->height);
136 136
         if (!$width) $width = 1;
137 137
         return $width;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
   * @param integer $resizedWidth
143 143
   * @return integer */
144 144
 
145
-    final public function getPropHeight($resizedWidth) {
145
+    final public function getPropHeight($resizedWidth){
146 146
         $height = round(($this->height * $resizedWidth) / $this->width);
147 147
         if (!$height) $height = 1;
148 148
         return $height;
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
   * static method should be implemented into driver classes like abstract
154 154
   * methods
155 155
   * @return bool */
156
-    static function available() { return false; }
156
+    static function available(){ return false; }
157 157
 
158 158
 /** Checks if file is an image. This static method should be implemented into
159 159
   * driver classes like abstract methods
160 160
   * @param string $file
161 161
   * @return bool */
162
-    static function checkImage($file) { return false; }
162
+    static function checkImage($file){ return false; }
163 163
 
164 164
 /** Resize image. Should return TRUE on success or FALSE on failure
165 165
   * @param integer $width
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
   * @param integer $height
176 176
   * @param mixed $background
177 177
   * @return bool */
178
-    abstract public function resizeFit($width, $height, $background=false);
178
+    abstract public function resizeFit($width, $height, $background = false);
179 179
 
180 180
 /** Resize and crop the image to fit in given resolution. Returns TRUE on
181 181
   * success or FALSE on failure
182 182
   * @param mixed $src
183 183
   * @param integer $offset
184 184
   * @return bool */
185
-    abstract public function resizeCrop($width, $height, $offset=false);
185
+    abstract public function resizeCrop($width, $height, $offset = false);
186 186
 
187 187
 
188 188
 /** Rotate image
189 189
   * @param integer $angle
190 190
   * @param string $background
191 191
   * @return bool */
192
-    abstract public function rotate($angle, $background="#000000");
192
+    abstract public function rotate($angle, $background = "#000000");
193 193
 
194 194
     abstract public function flipHorizontal();
195 195
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
   * @param mixed $top
206 206
   * @param mixed $left
207 207
   * @return bool */
208
-    abstract public function watermark($file, $left=false, $top=false);
208
+    abstract public function watermark($file, $left = false, $top = false);
209 209
 
210 210
 /** Should output the image. Second parameter is used to pass some options like
211 211
   *   'file' - if is set, the output will be written to a file
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
   * @param string $type
215 215
   * @param array $options
216 216
   * @return bool */
217
-    abstract public function output($type='jpeg', array $options=array());
217
+    abstract public function output($type = 'jpeg', array $options = array());
218 218
 
219 219
 /** This method should create a blank image with selected size. Should returns
220 220
   * resource or object related to the created image, which will be passed to
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image_gd.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -327,6 +327,11 @@
 block discarded – undo
327 327
         return imagecolorallocate($this->image, $r, $g, $b);
328 328
     }
329 329
 
330
+    /**
331
+     * @param integer $x1
332
+     * @param integer $y1
333
+     * @param boolean $color
334
+     */
330 335
     protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) {
331 336
         $color = $this->gdColor($color);
332 337
         if ($color === false) return false;
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class image_gd extends image {
15
+class image_gd extends image{
16 16
 
17 17
 
18 18
     // ABSTRACT PUBLIC METHODS
19 19
 
20
-    public function resize($width, $height) {
20
+    public function resize($width, $height){
21 21
         if (!$width) $width = 1;
22 22
         if (!$height) $height = 1;
23 23
         return (
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         );
30 30
     }
31 31
 
32
-    public function resizeFit($width, $height, $background=false) {
32
+    public function resizeFit($width, $height, $background = false){
33 33
         if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height)))
34 34
             return true;
35 35
         if (!$width || (($height / $width) < ($this->height / $this->width))) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         }
68 68
     }
69 69
 
70
-    public function resizeCrop($width, $height, $offset=false) {
70
+    public function resizeCrop($width, $height, $offset = false){
71 71
 
72 72
         if (($this->width / $this->height) > ($width / $height)) {
73 73
             $h = $height;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         return $return;
118 118
     }
119 119
 
120
-    public function rotate($angle, $background="#000000") {
120
+    public function rotate($angle, $background = "#000000"){
121 121
         $angle = -$angle;
122 122
         $img = @imagerotate($this->image, $angle, $this->gdColor($background));
123 123
         if ($img === false)
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         return true;
129 129
     }
130 130
 
131
-    public function flipHorizontal() {
131
+    public function flipHorizontal(){
132 132
         $img = imagecreatetruecolor($this->width, $this->height);
133 133
             imagealphablending($img, false);
134 134
             imagesavealpha($img, true);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         return true;
140 140
     }
141 141
 
142
-    public function flipVertical() {
142
+    public function flipVertical(){
143 143
         $img = imagecreatetruecolor($this->width, $this->height);
144 144
             imagealphablending($img, false);
145 145
             imagesavealpha($img, true);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         return true;
151 151
     }
152 152
 
153
-    public function watermark($file, $left=false, $top=false) {
153
+    public function watermark($file, $left = false, $top = false){
154 154
         $info = getimagesize($file);
155 155
         list($w, $h, $t) = $info;
156 156
         if (!in_array($t, array(IMAGETYPE_PNG, IMAGETYPE_GIF)))
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         return true;
188 188
     }
189 189
 
190
-    public function output($type='jpeg', array $options=array()) {
190
+    public function output($type = 'jpeg', array $options = array()){
191 191
         $method = "output_$type";
192 192
         if (!method_exists($this, $method))
193 193
             return false;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
     // ABSTRACT PROTECTED METHODS
199 199
 
200
-    protected function getBlankImage($width, $height) {
200
+    protected function getBlankImage($width, $height){
201 201
         $img = @imagecreatetruecolor($width, $height);
202 202
 //        imagealphablending($img, false);
203 203
 //        imagesavealpha($img, true);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         return $img;
208 208
     }
209 209
 
210
-    protected function getImage($image, &$width, &$height) {
210
+    protected function getImage($image, &$width, &$height){
211 211
 
212 212
         if (is_resource($image) && (get_resource_type($image) == "gd")) {
213 213
             $width = @imagesx($image);
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
             (false !== (list($width, $height, $t) = @getimagesize($image)))
219 219
         ) {
220 220
             $image =
221
-                ($t == IMAGETYPE_GIF)  ? @imagecreatefromgif($image)  : (
221
+                ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : (
222 222
                 ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : (
223 223
                 ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : (
224
-                ($t == IMAGETYPE_PNG)  ? @imagecreatefrompng($image)  : (
225
-                ($t == IMAGETYPE_XBM)  ? @imagecreatefromxbm($image)  : false
224
+                ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : (
225
+                ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false
226 226
             ))));
227 227
 
228 228
             return $image;
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 
235 235
     // PSEUDO-ABSTRACT STATIC METHODS
236 236
 
237
-    static function available() {
237
+    static function available(){
238 238
         return function_exists("imagecreatefromjpeg");
239 239
     }
240 240
 
241
-    static function checkImage($file) {
241
+    static function checkImage($file){
242 242
         if (!is_string($file) ||
243 243
             ((false === (list($width, $height, $t) = @getimagesize($file))))
244 244
         )
245 245
             return false;
246 246
 
247 247
         $img =
248
-            ($t == IMAGETYPE_GIF)  ? @imagecreatefromgif($file)  : (
248
+            ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : (
249 249
             ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($file) : (
250 250
             ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($file) : (
251
-            ($t == IMAGETYPE_PNG)  ? @imagecreatefrompng($file)  : (
252
-            ($t == IMAGETYPE_XBM)  ? @imagecreatefromxbm($file)  : false
251
+            ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : (
252
+            ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false
253 253
         ))));
254 254
 
255 255
         return ($img !== false);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
     // OWN METHODS
260 260
 
261
-    protected function output_png(array $options=array()) {
261
+    protected function output_png(array $options = array()){
262 262
         $file = isset($options['file']) ? $options['file'] : null;
263 263
         $quality = isset($options['quality']) ? $options['quality'] : null;
264 264
         $filters = isset($options['filters']) ? $options['filters'] : null;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         return imagepng($this->image, $file, $quality, $filters);
269 269
     }
270 270
 
271
-    protected function output_jpeg(array $options=array()) {
271
+    protected function output_jpeg(array $options = array()){
272 272
         $file = isset($options['file']) ? $options['file'] : null;
273 273
         $quality = isset($options['quality'])
274 274
             ? $options['quality']
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
         return imagejpeg($this->image, $file, $quality);
279 279
     }
280 280
 
281
-    protected function output_gif(array $options=array()) {
281
+    protected function output_gif(array $options = array()){
282 282
         $file = isset($options['file']) ? $options['file'] : null;
283 283
         if (isset($options['file']) && !headers_sent())
284 284
             header("Content-Type: image/gif");
285 285
         return imagegif($this->image, $file);
286 286
     }
287 287
 
288
-    protected function gdColor() {
288
+    protected function gdColor(){
289 289
         $args = func_get_args();
290 290
 
291 291
         $exprRGB = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i';
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
         return imagecolorallocate($this->image, $r, $g, $b);
328 328
     }
329 329
 
330
-    protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) {
330
+    protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color){
331 331
         $color = $this->gdColor($color);
332 332
         if ($color === false) return false;
333 333
         return imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color);
334 334
     }
335 335
 
336 336
     protected function imageCopyResampled(
337
-        $src, $dstX=0, $dstY=0, $srcX=0, $srcY=0, $dstW=null, $dstH=null, $srcW=null, $srcH=null
338
-    ) {
337
+        $src, $dstX = 0, $dstY = 0, $srcX = 0, $srcY = 0, $dstW = null, $dstH = null, $srcW = null, $srcH = null
338
+    ){
339 339
         $imageDetails = $this->buildImage($src);
340 340
 
341 341
         if ($imageDetails === false)
Please login to merge, or discard this patch.