@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null) |
97 | 97 | { |
98 | - $this->signCertificate = 'file://' . str_replace('\\', '/', realpath($certificate)); |
|
98 | + $this->signCertificate = 'file://'.str_replace('\\', '/', realpath($certificate)); |
|
99 | 99 | |
100 | 100 | if (null !== $privateKey) { |
101 | 101 | if (is_array($privateKey)) { |
102 | 102 | $this->signPrivateKey = $privateKey; |
103 | - $this->signPrivateKey[0] = 'file://' . str_replace('\\', '/', realpath($privateKey[0])); |
|
103 | + $this->signPrivateKey[0] = 'file://'.str_replace('\\', '/', realpath($privateKey[0])); |
|
104 | 104 | } else { |
105 | - $this->signPrivateKey = 'file://' . str_replace('\\', '/', realpath($privateKey)); |
|
105 | + $this->signPrivateKey = 'file://'.str_replace('\\', '/', realpath($privateKey)); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | $this->encryptCert = array(); |
132 | 132 | |
133 | 133 | foreach ($recipientCerts as $cert) { |
134 | - $this->encryptCert[] = 'file://' . str_replace('\\', '/', realpath($cert)); |
|
134 | + $this->encryptCert[] = 'file://'.str_replace('\\', '/', realpath($cert)); |
|
135 | 135 | } |
136 | 136 | } else { |
137 | - $this->encryptCert = 'file://' . str_replace('\\', '/', realpath($recipientCerts)); |
|
137 | + $this->encryptCert = 'file://'.str_replace('\\', '/', realpath($recipientCerts)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if (null !== $cipher) { |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | foreach ($headerLines as $headerLine) { |
381 | 381 | // Line separated |
382 | 382 | if (ctype_space($headerLines[0]) || false === strpos($headerLine, ':')) { |
383 | - $headers[$currentHeaderName] .= ' ' . trim($headerLine); |
|
383 | + $headers[$currentHeaderName] .= ' '.trim($headerLine); |
|
384 | 384 | continue; |
385 | 385 | } |
386 | 386 |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | $this->_privateKey = $privateKey; |
203 | 203 | $this->_domainName = $domainName; |
204 | - $this->_signerIdentity = '@' . $domainName; |
|
204 | + $this->_signerIdentity = '@'.$domainName; |
|
205 | 205 | $this->_selector = $selector; |
206 | 206 | } |
207 | 207 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | // Prepare the DKIM-Signature |
550 | 550 | $params = array('v' => '1', 'a' => $this->_hashAlgorithm, 'bh' => base64_encode($this->_bodyHash), 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'i' => $this->_signerIdentity, 's' => $this->_selector); |
551 | 551 | if ($this->_bodyCanon != 'simple') { |
552 | - $params['c'] = $this->_headerCanon . '/' . $this->_bodyCanon; |
|
552 | + $params['c'] = $this->_headerCanon.'/'.$this->_bodyCanon; |
|
553 | 553 | } elseif ($this->_headerCanon != 'simple') { |
554 | 554 | $params['c'] = $this->_headerCanon; |
555 | 555 | } |
@@ -574,19 +574,19 @@ discard block |
||
574 | 574 | } |
575 | 575 | $string = ''; |
576 | 576 | foreach ($params as $k => $v) { |
577 | - $string .= $k . '=' . $v . '; '; |
|
577 | + $string .= $k.'='.$v.'; '; |
|
578 | 578 | } |
579 | 579 | $string = trim($string); |
580 | 580 | $headers->addTextHeader('DKIM-Signature', $string); |
581 | 581 | // Add the last DKIM-Signature |
582 | 582 | $tmp = $headers->getAll('DKIM-Signature'); |
583 | 583 | $this->_dkimHeader = end($tmp); |
584 | - $this->_addHeader(trim($this->_dkimHeader->toString()) . "\r\n b=", true); |
|
584 | + $this->_addHeader(trim($this->_dkimHeader->toString())."\r\n b=", true); |
|
585 | 585 | $this->_endOfHeaders(); |
586 | 586 | if ($this->_debugHeaders) { |
587 | 587 | $headers->addTextHeader('X-DebugHash', base64_encode($this->_headerHash)); |
588 | 588 | } |
589 | - $this->_dkimHeader->setValue($string . ' b=' . trim(chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '))); |
|
589 | + $this->_dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '))); |
|
590 | 590 | |
591 | 591 | return $this; |
592 | 592 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $name = Swift::strtolowerWithStaticCache(trim($exploded[0])); |
603 | 603 | $value = str_replace("\r\n", '', $exploded[1]); |
604 | 604 | $value = preg_replace("/[ \t][ \t]+/", ' ', $value); |
605 | - $header = $name . ':' . trim($value) . ($is_sig ? '' : "\r\n"); |
|
605 | + $header = $name.':'.trim($value).($is_sig ? '' : "\r\n"); |
|
606 | 606 | case 'simple': |
607 | 607 | // Nothing to do |
608 | 608 | } |
@@ -723,11 +723,11 @@ discard block |
||
723 | 723 | } |
724 | 724 | $pkeyId = openssl_get_privatekey($this->_privateKey); |
725 | 725 | if (!$pkeyId) { |
726 | - throw new Swift_SwiftException('Unable to load DKIM Private Key [' . openssl_error_string() . ']'); |
|
726 | + throw new Swift_SwiftException('Unable to load DKIM Private Key ['.openssl_error_string().']'); |
|
727 | 727 | } |
728 | 728 | if (openssl_sign($this->_headerCanonData, $signature, $pkeyId, $algorithm)) { |
729 | 729 | return $signature; |
730 | 730 | } |
731 | - throw new Swift_SwiftException('Unable to sign DKIM Hash [' . openssl_error_string() . ']'); |
|
731 | + throw new Swift_SwiftException('Unable to sign DKIM Hash ['.openssl_error_string().']'); |
|
732 | 732 | } |
733 | 733 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | $this->_privateKey = $privateKey; |
147 | 147 | $this->_domainName = $domainName; |
148 | - $this->_signerIdentity = '@' . $domainName; |
|
148 | + $this->_signerIdentity = '@'.$domainName; |
|
149 | 149 | $this->_selector = $selector; |
150 | 150 | } |
151 | 151 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $params = array('a' => $this->_hashAlgorithm, 'b' => chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '), 'c' => $this->_canon, 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'q' => 'dns', 's' => $this->_selector); |
426 | 426 | $string = ''; |
427 | 427 | foreach ($params as $k => $v) { |
428 | - $string .= $k . '=' . $v . '; '; |
|
428 | + $string .= $k.'='.$v.'; '; |
|
429 | 429 | } |
430 | 430 | $string = trim($string); |
431 | 431 | $headers->addTextHeader('DomainKey-Signature', $string); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $name = Swift::strtolowerWithStaticCache(trim($exploded[0])); |
445 | 445 | $value = str_replace("\r\n", '', $exploded[1]); |
446 | 446 | $value = preg_replace("/[ \t][ \t]+/", ' ', $value); |
447 | - $header = $name . ':' . trim($value) . "\r\n"; |
|
447 | + $header = $name.':'.trim($value)."\r\n"; |
|
448 | 448 | case 'simple': |
449 | 449 | // Nothing to do |
450 | 450 | } |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | $signature = ''; |
545 | 545 | $pkeyId = openssl_get_privatekey($this->_privateKey); |
546 | 546 | if (!$pkeyId) { |
547 | - throw new Swift_SwiftException('Unable to load DomainKey Private Key [' . openssl_error_string() . ']'); |
|
547 | + throw new Swift_SwiftException('Unable to load DomainKey Private Key ['.openssl_error_string().']'); |
|
548 | 548 | } |
549 | 549 | if (openssl_sign($this->_canonData, $signature, $pkeyId, OPENSSL_ALGO_SHA1)) { |
550 | 550 | return $signature; |
551 | 551 | } |
552 | - throw new Swift_SwiftException('Unable to sign DomainKey Hash [' . openssl_error_string() . ']'); |
|
552 | + throw new Swift_SwiftException('Unable to sign DomainKey Hash ['.openssl_error_string().']'); |
|
553 | 553 | } |
554 | 554 | } |
@@ -520,6 +520,9 @@ |
||
520 | 520 | $this->_hash = hash_final($this->_hashHandler, true); |
521 | 521 | } |
522 | 522 | |
523 | + /** |
|
524 | + * @param string $string |
|
525 | + */ |
|
523 | 526 | private function _addToHash($string) |
524 | 527 | { |
525 | 528 | $this->_canonData .= $string; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $header = new Swift_Mime_Headers_OpenDKIMHeader('DKIM-Signature'); |
80 | 80 | $headerVal = $this->_dkimHandler->getSignatureHeader(); |
81 | 81 | if (!$headerVal) { |
82 | - throw new Swift_SwiftException('OpenDKIM Error: ' . $this->_dkimHandler->getError()); |
|
82 | + throw new Swift_SwiftException('OpenDKIM Error: '.$this->_dkimHandler->getError()); |
|
83 | 83 | } |
84 | 84 | $header->setValue($headerVal); |
85 | 85 | $headers->set($header); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, time()); |
113 | 113 | } else { |
114 | 114 | if (!OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, $this->_signatureTimestamp)) { |
115 | - throw new Swift_SwiftException('Unable to force signature timestamp [' . openssl_error_string() . ']'); |
|
115 | + throw new Swift_SwiftException('Unable to force signature timestamp ['.openssl_error_string().']'); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 |
@@ -134,7 +134,7 @@ |
||
134 | 134 | $code = $e->getCode(); |
135 | 135 | $this->_logger->add(sprintf('!! %s (code: %s)', $message, $code)); |
136 | 136 | $message .= PHP_EOL; |
137 | - $message .= 'Log data:' . PHP_EOL; |
|
137 | + $message .= 'Log data:'.PHP_EOL; |
|
138 | 138 | $message .= $this->_logger->dump(); |
139 | 139 | $evt->cancelBubble(); |
140 | 140 | throw new Swift_TransportException($message, $code, $e->getPrevious()); |
@@ -25,14 +25,14 @@ |
||
25 | 25 | public function notify(Swift_Mime_Message $message, $address, $result) |
26 | 26 | { |
27 | 27 | if (self::RESULT_PASS === $result) { |
28 | - echo '<div style="color: #fff; background: #006600; padding: 2px; margin: 2px;">' . PHP_EOL; |
|
29 | - echo 'PASS ' . $address . PHP_EOL; |
|
30 | - echo '</div>' . PHP_EOL; |
|
28 | + echo '<div style="color: #fff; background: #006600; padding: 2px; margin: 2px;">'.PHP_EOL; |
|
29 | + echo 'PASS '.$address.PHP_EOL; |
|
30 | + echo '</div>'.PHP_EOL; |
|
31 | 31 | flush(); |
32 | 32 | } else { |
33 | - echo '<div style="color: #fff; background: #880000; padding: 2px; margin: 2px;">' . PHP_EOL; |
|
34 | - echo 'FAIL ' . $address . PHP_EOL; |
|
35 | - echo '</div>' . PHP_EOL; |
|
33 | + echo '<div style="color: #fff; background: #880000; padding: 2px; margin: 2px;">'.PHP_EOL; |
|
34 | + echo 'FAIL '.$address.PHP_EOL; |
|
35 | + echo '</div>'.PHP_EOL; |
|
36 | 36 | flush(); |
37 | 37 | } |
38 | 38 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | if ( |
64 | 64 | $currentLine !== '' |
65 | 65 | && |
66 | - strlen($currentLine . $encodedChar) > $thisLineLength |
|
66 | + strlen($currentLine.$encodedChar) > $thisLineLength |
|
67 | 67 | ) { |
68 | 68 | $lines[] = ''; |
69 | 69 | $currentLine = &$lines[$lineCount++]; |
@@ -39,11 +39,11 @@ |
||
39 | 39 | $firstLine = ''; |
40 | 40 | |
41 | 41 | if (0 != $firstLineOffset) { |
42 | - $firstLine = substr($encodedString, 0, $maxLineLength - $firstLineOffset) . "\r\n"; |
|
42 | + $firstLine = substr($encodedString, 0, $maxLineLength - $firstLineOffset)."\r\n"; |
|
43 | 43 | $encodedString = substr($encodedString, $maxLineLength - $firstLineOffset); |
44 | 44 | } |
45 | 45 | |
46 | - return $firstLine . trim(chunk_split($encodedString, $maxLineLength, "\r\n")); |
|
46 | + return $firstLine.trim(chunk_split($encodedString, $maxLineLength, "\r\n")); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -198,7 +198,7 @@ |
||
198 | 198 | $to = $start; |
199 | 199 | for (; $this->_currentPos < $end; ++$this->_currentPos) { |
200 | 200 | if (isset($this->_map['i'][$this->_currentPos])) { |
201 | - $ret .= substr($this->_datas, $start, $to - $start) . '?'; |
|
201 | + $ret .= substr($this->_datas, $start, $to - $start).'?'; |
|
202 | 202 | $start = $this->_map['p'][$this->_currentPos]; |
203 | 203 | } else { |
204 | 204 | $to = $this->_map['p'][$this->_currentPos]; |