Completed
Branch develop (8f3b65)
by
unknown
27:06
created
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Exception.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_Pop_Pop3Exception extends Swift_IoException
17 17
 {
18
-    /**
19
-     * Create a new Pop3Exception with $message.
20
-     *
21
-     * @param string $message
22
-     */
23
-    public function __construct($message)
24
-    {
25
-        parent::__construct($message);
26
-    }
18
+	/**
19
+	 * Create a new Pop3Exception with $message.
20
+	 *
21
+	 * @param string $message
22
+	 */
23
+	public function __construct($message)
24
+	{
25
+		parent::__construct($message);
26
+	}
27 27
 }
Please login to merge, or discard this patch.
includes/swiftmailer/lib/classes/Swift/Plugins/Pop/Pop3Connection.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@
 block discarded – undo
15 15
  */
16 16
 interface Swift_Plugins_Pop_Pop3Connection
17 17
 {
18
-    /**
19
-     * Connect to the POP3 host and throw an Exception if it fails.
20
-     *
21
-     * @throws Swift_Plugins_Pop_Pop3Exception
22
-     */
23
-    public function connect();
18
+	/**
19
+	 * Connect to the POP3 host and throw an Exception if it fails.
20
+	 *
21
+	 * @throws Swift_Plugins_Pop_Pop3Exception
22
+	 */
23
+	public function connect();
24 24
 
25
-    /**
26
-     * Disconnect from the POP3 host and throw an Exception if it fails.
27
-     *
28
-     * @throws Swift_Plugins_Pop_Pop3Exception
29
-     */
30
-    public function disconnect();
25
+	/**
26
+	 * Disconnect from the POP3 host and throw an Exception if it fails.
27
+	 *
28
+	 * @throws Swift_Plugins_Pop_Pop3Exception
29
+	 */
30
+	public function disconnect();
31 31
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -15,112 +15,112 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_Events_ResponseListener, Swift_Events_TransportChangeListener, Swift_Events_TransportExceptionListener, Swift_Plugins_Logger
17 17
 {
18
-    /** The logger which is delegated to */
19
-    private $logger;
18
+	/** The logger which is delegated to */
19
+	private $logger;
20 20
 
21
-    /**
22
-     * Create a new LoggerPlugin using $logger.
23
-     */
24
-    public function __construct(Swift_Plugins_Logger $logger)
25
-    {
26
-        $this->logger = $logger;
27
-    }
21
+	/**
22
+	 * Create a new LoggerPlugin using $logger.
23
+	 */
24
+	public function __construct(Swift_Plugins_Logger $logger)
25
+	{
26
+		$this->logger = $logger;
27
+	}
28 28
 
29
-    /**
30
-     * Add a log entry.
31
-     *
32
-     * @param string $entry
33
-     */
34
-    public function add($entry)
35
-    {
36
-        $this->logger->add($entry);
37
-    }
29
+	/**
30
+	 * Add a log entry.
31
+	 *
32
+	 * @param string $entry
33
+	 */
34
+	public function add($entry)
35
+	{
36
+		$this->logger->add($entry);
37
+	}
38 38
 
39
-    /**
40
-     * Clear the log contents.
41
-     */
42
-    public function clear()
43
-    {
44
-        $this->logger->clear();
45
-    }
39
+	/**
40
+	 * Clear the log contents.
41
+	 */
42
+	public function clear()
43
+	{
44
+		$this->logger->clear();
45
+	}
46 46
 
47
-    /**
48
-     * Get this log as a string.
49
-     *
50
-     * @return string
51
-     */
52
-    public function dump()
53
-    {
54
-        return $this->logger->dump();
55
-    }
47
+	/**
48
+	 * Get this log as a string.
49
+	 *
50
+	 * @return string
51
+	 */
52
+	public function dump()
53
+	{
54
+		return $this->logger->dump();
55
+	}
56 56
 
57
-    /**
58
-     * Invoked immediately following a command being sent.
59
-     */
60
-    public function commandSent(Swift_Events_CommandEvent $evt)
61
-    {
62
-        $command = $evt->getCommand();
63
-        $this->logger->add(sprintf('>> %s', $command));
64
-    }
57
+	/**
58
+	 * Invoked immediately following a command being sent.
59
+	 */
60
+	public function commandSent(Swift_Events_CommandEvent $evt)
61
+	{
62
+		$command = $evt->getCommand();
63
+		$this->logger->add(sprintf('>> %s', $command));
64
+	}
65 65
 
66
-    /**
67
-     * Invoked immediately following a response coming back.
68
-     */
69
-    public function responseReceived(Swift_Events_ResponseEvent $evt)
70
-    {
71
-        $response = $evt->getResponse();
72
-        $this->logger->add(sprintf('<< %s', $response));
73
-    }
66
+	/**
67
+	 * Invoked immediately following a response coming back.
68
+	 */
69
+	public function responseReceived(Swift_Events_ResponseEvent $evt)
70
+	{
71
+		$response = $evt->getResponse();
72
+		$this->logger->add(sprintf('<< %s', $response));
73
+	}
74 74
 
75
-    /**
76
-     * Invoked just before a Transport is started.
77
-     */
78
-    public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
79
-    {
80
-        $transportName = \get_class($evt->getSource());
81
-        $this->logger->add(sprintf('++ Starting %s', $transportName));
82
-    }
75
+	/**
76
+	 * Invoked just before a Transport is started.
77
+	 */
78
+	public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
79
+	{
80
+		$transportName = \get_class($evt->getSource());
81
+		$this->logger->add(sprintf('++ Starting %s', $transportName));
82
+	}
83 83
 
84
-    /**
85
-     * Invoked immediately after the Transport is started.
86
-     */
87
-    public function transportStarted(Swift_Events_TransportChangeEvent $evt)
88
-    {
89
-        $transportName = \get_class($evt->getSource());
90
-        $this->logger->add(sprintf('++ %s started', $transportName));
91
-    }
84
+	/**
85
+	 * Invoked immediately after the Transport is started.
86
+	 */
87
+	public function transportStarted(Swift_Events_TransportChangeEvent $evt)
88
+	{
89
+		$transportName = \get_class($evt->getSource());
90
+		$this->logger->add(sprintf('++ %s started', $transportName));
91
+	}
92 92
 
93
-    /**
94
-     * Invoked just before a Transport is stopped.
95
-     */
96
-    public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt)
97
-    {
98
-        $transportName = \get_class($evt->getSource());
99
-        $this->logger->add(sprintf('++ Stopping %s', $transportName));
100
-    }
93
+	/**
94
+	 * Invoked just before a Transport is stopped.
95
+	 */
96
+	public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt)
97
+	{
98
+		$transportName = \get_class($evt->getSource());
99
+		$this->logger->add(sprintf('++ Stopping %s', $transportName));
100
+	}
101 101
 
102
-    /**
103
-     * Invoked immediately after the Transport is stopped.
104
-     */
105
-    public function transportStopped(Swift_Events_TransportChangeEvent $evt)
106
-    {
107
-        $transportName = \get_class($evt->getSource());
108
-        $this->logger->add(sprintf('++ %s stopped', $transportName));
109
-    }
102
+	/**
103
+	 * Invoked immediately after the Transport is stopped.
104
+	 */
105
+	public function transportStopped(Swift_Events_TransportChangeEvent $evt)
106
+	{
107
+		$transportName = \get_class($evt->getSource());
108
+		$this->logger->add(sprintf('++ %s stopped', $transportName));
109
+	}
110 110
 
111
-    /**
112
-     * Invoked as a TransportException is thrown in the Transport system.
113
-     */
114
-    public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt)
115
-    {
116
-        $e = $evt->getException();
117
-        $message = $e->getMessage();
118
-        $code = $e->getCode();
119
-        $this->logger->add(sprintf('!! %s (code: %s)', $message, $code));
120
-        $message .= PHP_EOL;
121
-        $message .= 'Log data:'.PHP_EOL;
122
-        $message .= $this->logger->dump();
123
-        $evt->cancelBubble();
124
-        throw new Swift_TransportException($message, $code, $e->getPrevious());
125
-    }
111
+	/**
112
+	 * Invoked as a TransportException is thrown in the Transport system.
113
+	 */
114
+	public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt)
115
+	{
116
+		$e = $evt->getException();
117
+		$message = $e->getMessage();
118
+		$code = $e->getCode();
119
+		$this->logger->add(sprintf('!! %s (code: %s)', $message, $code));
120
+		$message .= PHP_EOL;
121
+		$message .= 'Log data:'.PHP_EOL;
122
+		$message .= $this->logger->dump();
123
+		$evt->cancelBubble();
124
+		throw new Swift_TransportException($message, $code, $e->getPrevious());
125
+	}
126 126
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/Sleeper.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
  */
16 16
 interface Swift_Plugins_Sleeper
17 17
 {
18
-    /**
19
-     * Sleep for $seconds.
20
-     *
21
-     * @param int $seconds
22
-     */
23
-    public function sleep($seconds);
18
+	/**
19
+	 * Sleep for $seconds.
20
+	 *
21
+	 * @param int $seconds
22
+	 */
23
+	public function sleep($seconds);
24 24
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php 1 patch
Indentation   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -16,185 +16,185 @@
 block discarded – undo
16 16
  */
17 17
 class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_Plugins_Decorator_Replacements
18 18
 {
19
-    /** The replacement map */
20
-    private $replacements;
21
-
22
-    /** The body as it was before replacements */
23
-    private $originalBody;
24
-
25
-    /** The original headers of the message, before replacements */
26
-    private $originalHeaders = [];
27
-
28
-    /** Bodies of children before they are replaced */
29
-    private $originalChildBodies = [];
30
-
31
-    /** The Message that was last replaced */
32
-    private $lastMessage;
33
-
34
-    /**
35
-     * Create a new DecoratorPlugin with $replacements.
36
-     *
37
-     * The $replacements can either be an associative array, or an implementation
38
-     * of {@link Swift_Plugins_Decorator_Replacements}.
39
-     *
40
-     * When using an array, it should be of the form:
41
-     * <code>
42
-     * $replacements = array(
43
-     *  "[email protected]" => array("{a}" => "b", "{c}" => "d"),
44
-     *  "[email protected]" => array("{a}" => "x", "{c}" => "y")
45
-     * )
46
-     * </code>
47
-     *
48
-     * When using an instance of {@link Swift_Plugins_Decorator_Replacements},
49
-     * the object should return just the array of replacements for the address
50
-     * given to {@link Swift_Plugins_Decorator_Replacements::getReplacementsFor()}.
51
-     *
52
-     * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements
53
-     */
54
-    public function __construct($replacements)
55
-    {
56
-        $this->setReplacements($replacements);
57
-    }
58
-
59
-    /**
60
-     * Sets replacements.
61
-     *
62
-     * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements
63
-     *
64
-     * @see __construct()
65
-     */
66
-    public function setReplacements($replacements)
67
-    {
68
-        if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) {
69
-            $this->replacements = (array) $replacements;
70
-        } else {
71
-            $this->replacements = $replacements;
72
-        }
73
-    }
74
-
75
-    /**
76
-     * Invoked immediately before the Message is sent.
77
-     */
78
-    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
79
-    {
80
-        $message = $evt->getMessage();
81
-        $this->restoreMessage($message);
82
-        $to = array_keys($message->getTo());
83
-        $address = array_shift($to);
84
-        if ($replacements = $this->getReplacementsFor($address)) {
85
-            $body = $message->getBody();
86
-            $search = array_keys($replacements);
87
-            $replace = array_values($replacements);
88
-            $bodyReplaced = str_replace(
89
-                $search, $replace, $body
90
-                );
91
-            if ($body != $bodyReplaced) {
92
-                $this->originalBody = $body;
93
-                $message->setBody($bodyReplaced);
94
-            }
95
-
96
-            foreach ($message->getHeaders()->getAll() as $header) {
97
-                $body = $header->getFieldBodyModel();
98
-                $count = 0;
99
-                if (\is_array($body)) {
100
-                    $bodyReplaced = [];
101
-                    foreach ($body as $key => $value) {
102
-                        $count1 = 0;
103
-                        $count2 = 0;
104
-                        $key = \is_string($key) ? str_replace($search, $replace, $key, $count1) : $key;
105
-                        $value = \is_string($value) ? str_replace($search, $replace, $value, $count2) : $value;
106
-                        $bodyReplaced[$key] = $value;
107
-
108
-                        if (!$count && ($count1 || $count2)) {
109
-                            $count = 1;
110
-                        }
111
-                    }
112
-                } elseif (\is_string($body)) {
113
-                    $bodyReplaced = str_replace($search, $replace, $body, $count);
114
-                }
115
-
116
-                if ($count) {
117
-                    $this->originalHeaders[$header->getFieldName()] = $body;
118
-                    $header->setFieldBodyModel($bodyReplaced);
119
-                }
120
-            }
121
-
122
-            $children = (array) $message->getChildren();
123
-            foreach ($children as $child) {
124
-                list($type) = sscanf($child->getContentType(), '%[^/]/%s');
125
-                if ('text' == $type) {
126
-                    $body = $child->getBody();
127
-                    $bodyReplaced = str_replace(
128
-                        $search, $replace, $body
129
-                        );
130
-                    if ($body != $bodyReplaced) {
131
-                        $child->setBody($bodyReplaced);
132
-                        $this->originalChildBodies[$child->getId()] = $body;
133
-                    }
134
-                }
135
-            }
136
-            $this->lastMessage = $message;
137
-        }
138
-    }
139
-
140
-    /**
141
-     * Find a map of replacements for the address.
142
-     *
143
-     * If this plugin was provided with a delegate instance of
144
-     * {@link Swift_Plugins_Decorator_Replacements} then the call will be
145
-     * delegated to it.  Otherwise, it will attempt to find the replacements
146
-     * from the array provided in the constructor.
147
-     *
148
-     * If no replacements can be found, an empty value (NULL) is returned.
149
-     *
150
-     * @param string $address
151
-     *
152
-     * @return array
153
-     */
154
-    public function getReplacementsFor($address)
155
-    {
156
-        if ($this->replacements instanceof Swift_Plugins_Decorator_Replacements) {
157
-            return $this->replacements->getReplacementsFor($address);
158
-        }
159
-
160
-        return $this->replacements[$address] ?? null;
161
-    }
162
-
163
-    /**
164
-     * Invoked immediately after the Message is sent.
165
-     */
166
-    public function sendPerformed(Swift_Events_SendEvent $evt)
167
-    {
168
-        $this->restoreMessage($evt->getMessage());
169
-    }
170
-
171
-    /** Restore a changed message back to its original state */
172
-    private function restoreMessage(Swift_Mime_SimpleMessage $message)
173
-    {
174
-        if ($this->lastMessage === $message) {
175
-            if (isset($this->originalBody)) {
176
-                $message->setBody($this->originalBody);
177
-                $this->originalBody = null;
178
-            }
179
-            if (!empty($this->originalHeaders)) {
180
-                foreach ($message->getHeaders()->getAll() as $header) {
181
-                    if (\array_key_exists($header->getFieldName(), $this->originalHeaders)) {
182
-                        $header->setFieldBodyModel($this->originalHeaders[$header->getFieldName()]);
183
-                    }
184
-                }
185
-                $this->originalHeaders = [];
186
-            }
187
-            if (!empty($this->originalChildBodies)) {
188
-                $children = (array) $message->getChildren();
189
-                foreach ($children as $child) {
190
-                    $id = $child->getId();
191
-                    if (\array_key_exists($id, $this->originalChildBodies)) {
192
-                        $child->setBody($this->originalChildBodies[$id]);
193
-                    }
194
-                }
195
-                $this->originalChildBodies = [];
196
-            }
197
-            $this->lastMessage = null;
198
-        }
199
-    }
19
+	/** The replacement map */
20
+	private $replacements;
21
+
22
+	/** The body as it was before replacements */
23
+	private $originalBody;
24
+
25
+	/** The original headers of the message, before replacements */
26
+	private $originalHeaders = [];
27
+
28
+	/** Bodies of children before they are replaced */
29
+	private $originalChildBodies = [];
30
+
31
+	/** The Message that was last replaced */
32
+	private $lastMessage;
33
+
34
+	/**
35
+	 * Create a new DecoratorPlugin with $replacements.
36
+	 *
37
+	 * The $replacements can either be an associative array, or an implementation
38
+	 * of {@link Swift_Plugins_Decorator_Replacements}.
39
+	 *
40
+	 * When using an array, it should be of the form:
41
+	 * <code>
42
+	 * $replacements = array(
43
+	 *  "[email protected]" => array("{a}" => "b", "{c}" => "d"),
44
+	 *  "[email protected]" => array("{a}" => "x", "{c}" => "y")
45
+	 * )
46
+	 * </code>
47
+	 *
48
+	 * When using an instance of {@link Swift_Plugins_Decorator_Replacements},
49
+	 * the object should return just the array of replacements for the address
50
+	 * given to {@link Swift_Plugins_Decorator_Replacements::getReplacementsFor()}.
51
+	 *
52
+	 * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements
53
+	 */
54
+	public function __construct($replacements)
55
+	{
56
+		$this->setReplacements($replacements);
57
+	}
58
+
59
+	/**
60
+	 * Sets replacements.
61
+	 *
62
+	 * @param mixed $replacements Array or Swift_Plugins_Decorator_Replacements
63
+	 *
64
+	 * @see __construct()
65
+	 */
66
+	public function setReplacements($replacements)
67
+	{
68
+		if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) {
69
+			$this->replacements = (array) $replacements;
70
+		} else {
71
+			$this->replacements = $replacements;
72
+		}
73
+	}
74
+
75
+	/**
76
+	 * Invoked immediately before the Message is sent.
77
+	 */
78
+	public function beforeSendPerformed(Swift_Events_SendEvent $evt)
79
+	{
80
+		$message = $evt->getMessage();
81
+		$this->restoreMessage($message);
82
+		$to = array_keys($message->getTo());
83
+		$address = array_shift($to);
84
+		if ($replacements = $this->getReplacementsFor($address)) {
85
+			$body = $message->getBody();
86
+			$search = array_keys($replacements);
87
+			$replace = array_values($replacements);
88
+			$bodyReplaced = str_replace(
89
+				$search, $replace, $body
90
+				);
91
+			if ($body != $bodyReplaced) {
92
+				$this->originalBody = $body;
93
+				$message->setBody($bodyReplaced);
94
+			}
95
+
96
+			foreach ($message->getHeaders()->getAll() as $header) {
97
+				$body = $header->getFieldBodyModel();
98
+				$count = 0;
99
+				if (\is_array($body)) {
100
+					$bodyReplaced = [];
101
+					foreach ($body as $key => $value) {
102
+						$count1 = 0;
103
+						$count2 = 0;
104
+						$key = \is_string($key) ? str_replace($search, $replace, $key, $count1) : $key;
105
+						$value = \is_string($value) ? str_replace($search, $replace, $value, $count2) : $value;
106
+						$bodyReplaced[$key] = $value;
107
+
108
+						if (!$count && ($count1 || $count2)) {
109
+							$count = 1;
110
+						}
111
+					}
112
+				} elseif (\is_string($body)) {
113
+					$bodyReplaced = str_replace($search, $replace, $body, $count);
114
+				}
115
+
116
+				if ($count) {
117
+					$this->originalHeaders[$header->getFieldName()] = $body;
118
+					$header->setFieldBodyModel($bodyReplaced);
119
+				}
120
+			}
121
+
122
+			$children = (array) $message->getChildren();
123
+			foreach ($children as $child) {
124
+				list($type) = sscanf($child->getContentType(), '%[^/]/%s');
125
+				if ('text' == $type) {
126
+					$body = $child->getBody();
127
+					$bodyReplaced = str_replace(
128
+						$search, $replace, $body
129
+						);
130
+					if ($body != $bodyReplaced) {
131
+						$child->setBody($bodyReplaced);
132
+						$this->originalChildBodies[$child->getId()] = $body;
133
+					}
134
+				}
135
+			}
136
+			$this->lastMessage = $message;
137
+		}
138
+	}
139
+
140
+	/**
141
+	 * Find a map of replacements for the address.
142
+	 *
143
+	 * If this plugin was provided with a delegate instance of
144
+	 * {@link Swift_Plugins_Decorator_Replacements} then the call will be
145
+	 * delegated to it.  Otherwise, it will attempt to find the replacements
146
+	 * from the array provided in the constructor.
147
+	 *
148
+	 * If no replacements can be found, an empty value (NULL) is returned.
149
+	 *
150
+	 * @param string $address
151
+	 *
152
+	 * @return array
153
+	 */
154
+	public function getReplacementsFor($address)
155
+	{
156
+		if ($this->replacements instanceof Swift_Plugins_Decorator_Replacements) {
157
+			return $this->replacements->getReplacementsFor($address);
158
+		}
159
+
160
+		return $this->replacements[$address] ?? null;
161
+	}
162
+
163
+	/**
164
+	 * Invoked immediately after the Message is sent.
165
+	 */
166
+	public function sendPerformed(Swift_Events_SendEvent $evt)
167
+	{
168
+		$this->restoreMessage($evt->getMessage());
169
+	}
170
+
171
+	/** Restore a changed message back to its original state */
172
+	private function restoreMessage(Swift_Mime_SimpleMessage $message)
173
+	{
174
+		if ($this->lastMessage === $message) {
175
+			if (isset($this->originalBody)) {
176
+				$message->setBody($this->originalBody);
177
+				$this->originalBody = null;
178
+			}
179
+			if (!empty($this->originalHeaders)) {
180
+				foreach ($message->getHeaders()->getAll() as $header) {
181
+					if (\array_key_exists($header->getFieldName(), $this->originalHeaders)) {
182
+						$header->setFieldBodyModel($this->originalHeaders[$header->getFieldName()]);
183
+					}
184
+				}
185
+				$this->originalHeaders = [];
186
+			}
187
+			if (!empty($this->originalChildBodies)) {
188
+				$children = (array) $message->getChildren();
189
+				foreach ($children as $child) {
190
+					$id = $child->getId();
191
+					if (\array_key_exists($id, $this->originalChildBodies)) {
192
+						$child->setBody($this->originalChildBodies[$id]);
193
+					}
194
+				}
195
+				$this->originalChildBodies = [];
196
+			}
197
+			$this->lastMessage = null;
198
+		}
199
+	}
200 200
 }
Please login to merge, or discard this patch.
includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,24 +15,24 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter
17 17
 {
18
-    /**
19
-     * Notifies this ReportNotifier that $address failed or succeeded.
20
-     *
21
-     * @param string $address
22
-     * @param int    $result  from {@see RESULT_PASS, RESULT_FAIL}
23
-     */
24
-    public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
25
-    {
26
-        if (self::RESULT_PASS == $result) {
27
-            echo '<div style="color: #fff; background: #006600; padding: 2px; margin: 2px;">'.PHP_EOL;
28
-            echo 'PASS '.$address.PHP_EOL;
29
-            echo '</div>'.PHP_EOL;
30
-            flush();
31
-        } else {
32
-            echo '<div style="color: #fff; background: #880000; padding: 2px; margin: 2px;">'.PHP_EOL;
33
-            echo 'FAIL '.$address.PHP_EOL;
34
-            echo '</div>'.PHP_EOL;
35
-            flush();
36
-        }
37
-    }
18
+	/**
19
+	 * Notifies this ReportNotifier that $address failed or succeeded.
20
+	 *
21
+	 * @param string $address
22
+	 * @param int    $result  from {@see RESULT_PASS, RESULT_FAIL}
23
+	 */
24
+	public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
25
+	{
26
+		if (self::RESULT_PASS == $result) {
27
+			echo '<div style="color: #fff; background: #006600; padding: 2px; margin: 2px;">'.PHP_EOL;
28
+			echo 'PASS '.$address.PHP_EOL;
29
+			echo '</div>'.PHP_EOL;
30
+			flush();
31
+		} else {
32
+			echo '<div style="color: #fff; background: #880000; padding: 2px; margin: 2px;">'.PHP_EOL;
33
+			echo 'FAIL '.$address.PHP_EOL;
34
+			echo '</div>'.PHP_EOL;
35
+			flush();
36
+		}
37
+	}
38 38
 }
Please login to merge, or discard this patch.
includes/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,44 +15,44 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
17 17
 {
18
-    /**
19
-     * The list of failures.
20
-     *
21
-     * @var array
22
-     */
23
-    private $failures = [];
18
+	/**
19
+	 * The list of failures.
20
+	 *
21
+	 * @var array
22
+	 */
23
+	private $failures = [];
24 24
 
25
-    private $failures_cache = [];
25
+	private $failures_cache = [];
26 26
 
27
-    /**
28
-     * Notifies this ReportNotifier that $address failed or succeeded.
29
-     *
30
-     * @param string $address
31
-     * @param int    $result  from {@link RESULT_PASS, RESULT_FAIL}
32
-     */
33
-    public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
34
-    {
35
-        if (self::RESULT_FAIL == $result && !isset($this->failures_cache[$address])) {
36
-            $this->failures[] = $address;
37
-            $this->failures_cache[$address] = true;
38
-        }
39
-    }
27
+	/**
28
+	 * Notifies this ReportNotifier that $address failed or succeeded.
29
+	 *
30
+	 * @param string $address
31
+	 * @param int    $result  from {@link RESULT_PASS, RESULT_FAIL}
32
+	 */
33
+	public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
34
+	{
35
+		if (self::RESULT_FAIL == $result && !isset($this->failures_cache[$address])) {
36
+			$this->failures[] = $address;
37
+			$this->failures_cache[$address] = true;
38
+		}
39
+	}
40 40
 
41
-    /**
42
-     * Get an array of addresses for which delivery failed.
43
-     *
44
-     * @return array
45
-     */
46
-    public function getFailedRecipients()
47
-    {
48
-        return $this->failures;
49
-    }
41
+	/**
42
+	 * Get an array of addresses for which delivery failed.
43
+	 *
44
+	 * @return array
45
+	 */
46
+	public function getFailedRecipients()
47
+	{
48
+		return $this->failures;
49
+	}
50 50
 
51
-    /**
52
-     * Clear the buffer (empty the list).
53
-     */
54
-    public function clear()
55
-    {
56
-        $this->failures = $this->failures_cache = [];
57
-    }
51
+	/**
52
+	 * Clear the buffer (empty the list).
53
+	 */
54
+	public function clear()
55
+	{
56
+		$this->failures = $this->failures_cache = [];
57
+	}
58 58
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,43 +15,43 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener
17 17
 {
18
-    /**
19
-     * The reporter backend which takes notifications.
20
-     *
21
-     * @var Swift_Plugins_Reporter
22
-     */
23
-    private $reporter;
18
+	/**
19
+	 * The reporter backend which takes notifications.
20
+	 *
21
+	 * @var Swift_Plugins_Reporter
22
+	 */
23
+	private $reporter;
24 24
 
25
-    /**
26
-     * Create a new ReporterPlugin using $reporter.
27
-     */
28
-    public function __construct(Swift_Plugins_Reporter $reporter)
29
-    {
30
-        $this->reporter = $reporter;
31
-    }
25
+	/**
26
+	 * Create a new ReporterPlugin using $reporter.
27
+	 */
28
+	public function __construct(Swift_Plugins_Reporter $reporter)
29
+	{
30
+		$this->reporter = $reporter;
31
+	}
32 32
 
33
-    /**
34
-     * Not used.
35
-     */
36
-    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
37
-    {
38
-    }
33
+	/**
34
+	 * Not used.
35
+	 */
36
+	public function beforeSendPerformed(Swift_Events_SendEvent $evt)
37
+	{
38
+	}
39 39
 
40
-    /**
41
-     * Invoked immediately after the Message is sent.
42
-     */
43
-    public function sendPerformed(Swift_Events_SendEvent $evt)
44
-    {
45
-        $message = $evt->getMessage();
46
-        $failures = array_flip($evt->getFailedRecipients());
47
-        foreach ((array) $message->getTo() as $address => $null) {
48
-            $this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
49
-        }
50
-        foreach ((array) $message->getCc() as $address => $null) {
51
-            $this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
52
-        }
53
-        foreach ((array) $message->getBcc() as $address => $null) {
54
-            $this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
55
-        }
56
-    }
40
+	/**
41
+	 * Invoked immediately after the Message is sent.
42
+	 */
43
+	public function sendPerformed(Swift_Events_SendEvent $evt)
44
+	{
45
+		$message = $evt->getMessage();
46
+		$failures = array_flip($evt->getFailedRecipients());
47
+		foreach ((array) $message->getTo() as $address => $null) {
48
+			$this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
49
+		}
50
+		foreach ((array) $message->getCc() as $address => $null) {
51
+			$this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
52
+		}
53
+		foreach ((array) $message->getBcc() as $address => $null) {
54
+			$this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
55
+		}
56
+	}
57 57
 }
Please login to merge, or discard this patch.
htdocs/includes/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php 1 patch
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -15,187 +15,187 @@
 block discarded – undo
15 15
  */
16 16
 class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
17 17
 {
18
-    /**
19
-     * The recipient who will receive all messages.
20
-     *
21
-     * @var mixed
22
-     */
23
-    private $recipient;
24
-
25
-    /**
26
-     * List of regular expression for recipient whitelisting.
27
-     *
28
-     * @var array
29
-     */
30
-    private $whitelist = [];
31
-
32
-    /**
33
-     * Create a new RedirectingPlugin.
34
-     *
35
-     * @param mixed $recipient
36
-     */
37
-    public function __construct($recipient, array $whitelist = [])
38
-    {
39
-        $this->recipient = $recipient;
40
-        $this->whitelist = $whitelist;
41
-    }
42
-
43
-    /**
44
-     * Set the recipient of all messages.
45
-     *
46
-     * @param mixed $recipient
47
-     */
48
-    public function setRecipient($recipient)
49
-    {
50
-        $this->recipient = $recipient;
51
-    }
52
-
53
-    /**
54
-     * Get the recipient of all messages.
55
-     *
56
-     * @return mixed
57
-     */
58
-    public function getRecipient()
59
-    {
60
-        return $this->recipient;
61
-    }
62
-
63
-    /**
64
-     * Set a list of regular expressions to whitelist certain recipients.
65
-     */
66
-    public function setWhitelist(array $whitelist)
67
-    {
68
-        $this->whitelist = $whitelist;
69
-    }
70
-
71
-    /**
72
-     * Get the whitelist.
73
-     *
74
-     * @return array
75
-     */
76
-    public function getWhitelist()
77
-    {
78
-        return $this->whitelist;
79
-    }
80
-
81
-    /**
82
-     * Invoked immediately before the Message is sent.
83
-     */
84
-    public function beforeSendPerformed(Swift_Events_SendEvent $evt)
85
-    {
86
-        $message = $evt->getMessage();
87
-        $headers = $message->getHeaders();
88
-
89
-        // conditionally save current recipients
90
-
91
-        if ($headers->has('to')) {
92
-            $headers->addMailboxHeader('X-Swift-To', $message->getTo());
93
-        }
94
-
95
-        if ($headers->has('cc')) {
96
-            $headers->addMailboxHeader('X-Swift-Cc', $message->getCc());
97
-        }
98
-
99
-        if ($headers->has('bcc')) {
100
-            $headers->addMailboxHeader('X-Swift-Bcc', $message->getBcc());
101
-        }
102
-
103
-        // Filter remaining headers against whitelist
104
-        $this->filterHeaderSet($headers, 'To');
105
-        $this->filterHeaderSet($headers, 'Cc');
106
-        $this->filterHeaderSet($headers, 'Bcc');
107
-
108
-        // Add each hard coded recipient
109
-        $to = $message->getTo();
110
-        if (null === $to) {
111
-            $to = [];
112
-        }
113
-
114
-        foreach ((array) $this->recipient as $recipient) {
115
-            if (!\array_key_exists($recipient, $to)) {
116
-                $message->addTo($recipient);
117
-            }
118
-        }
119
-    }
120
-
121
-    /**
122
-     * Filter header set against a whitelist of regular expressions.
123
-     *
124
-     * @param string $type
125
-     */
126
-    private function filterHeaderSet(Swift_Mime_SimpleHeaderSet $headerSet, $type)
127
-    {
128
-        foreach ($headerSet->getAll($type) as $headers) {
129
-            $headers->setNameAddresses($this->filterNameAddresses($headers->getNameAddresses()));
130
-        }
131
-    }
132
-
133
-    /**
134
-     * Filtered list of addresses => name pairs.
135
-     *
136
-     * @return array
137
-     */
138
-    private function filterNameAddresses(array $recipients)
139
-    {
140
-        $filtered = [];
141
-
142
-        foreach ($recipients as $address => $name) {
143
-            if ($this->isWhitelisted($address)) {
144
-                $filtered[$address] = $name;
145
-            }
146
-        }
147
-
148
-        return $filtered;
149
-    }
150
-
151
-    /**
152
-     * Matches address against whitelist of regular expressions.
153
-     *
154
-     * @return bool
155
-     */
156
-    protected function isWhitelisted($recipient)
157
-    {
158
-        if (\in_array($recipient, (array) $this->recipient)) {
159
-            return true;
160
-        }
161
-
162
-        foreach ($this->whitelist as $pattern) {
163
-            if (preg_match($pattern, $recipient)) {
164
-                return true;
165
-            }
166
-        }
167
-
168
-        return false;
169
-    }
170
-
171
-    /**
172
-     * Invoked immediately after the Message is sent.
173
-     */
174
-    public function sendPerformed(Swift_Events_SendEvent $evt)
175
-    {
176
-        $this->restoreMessage($evt->getMessage());
177
-    }
178
-
179
-    private function restoreMessage(Swift_Mime_SimpleMessage $message)
180
-    {
181
-        // restore original headers
182
-        $headers = $message->getHeaders();
183
-
184
-        if ($headers->has('X-Swift-To')) {
185
-            $message->setTo($headers->get('X-Swift-To')->getNameAddresses());
186
-            $headers->removeAll('X-Swift-To');
187
-        } else {
188
-            $message->setTo(null);
189
-        }
190
-
191
-        if ($headers->has('X-Swift-Cc')) {
192
-            $message->setCc($headers->get('X-Swift-Cc')->getNameAddresses());
193
-            $headers->removeAll('X-Swift-Cc');
194
-        }
195
-
196
-        if ($headers->has('X-Swift-Bcc')) {
197
-            $message->setBcc($headers->get('X-Swift-Bcc')->getNameAddresses());
198
-            $headers->removeAll('X-Swift-Bcc');
199
-        }
200
-    }
18
+	/**
19
+	 * The recipient who will receive all messages.
20
+	 *
21
+	 * @var mixed
22
+	 */
23
+	private $recipient;
24
+
25
+	/**
26
+	 * List of regular expression for recipient whitelisting.
27
+	 *
28
+	 * @var array
29
+	 */
30
+	private $whitelist = [];
31
+
32
+	/**
33
+	 * Create a new RedirectingPlugin.
34
+	 *
35
+	 * @param mixed $recipient
36
+	 */
37
+	public function __construct($recipient, array $whitelist = [])
38
+	{
39
+		$this->recipient = $recipient;
40
+		$this->whitelist = $whitelist;
41
+	}
42
+
43
+	/**
44
+	 * Set the recipient of all messages.
45
+	 *
46
+	 * @param mixed $recipient
47
+	 */
48
+	public function setRecipient($recipient)
49
+	{
50
+		$this->recipient = $recipient;
51
+	}
52
+
53
+	/**
54
+	 * Get the recipient of all messages.
55
+	 *
56
+	 * @return mixed
57
+	 */
58
+	public function getRecipient()
59
+	{
60
+		return $this->recipient;
61
+	}
62
+
63
+	/**
64
+	 * Set a list of regular expressions to whitelist certain recipients.
65
+	 */
66
+	public function setWhitelist(array $whitelist)
67
+	{
68
+		$this->whitelist = $whitelist;
69
+	}
70
+
71
+	/**
72
+	 * Get the whitelist.
73
+	 *
74
+	 * @return array
75
+	 */
76
+	public function getWhitelist()
77
+	{
78
+		return $this->whitelist;
79
+	}
80
+
81
+	/**
82
+	 * Invoked immediately before the Message is sent.
83
+	 */
84
+	public function beforeSendPerformed(Swift_Events_SendEvent $evt)
85
+	{
86
+		$message = $evt->getMessage();
87
+		$headers = $message->getHeaders();
88
+
89
+		// conditionally save current recipients
90
+
91
+		if ($headers->has('to')) {
92
+			$headers->addMailboxHeader('X-Swift-To', $message->getTo());
93
+		}
94
+
95
+		if ($headers->has('cc')) {
96
+			$headers->addMailboxHeader('X-Swift-Cc', $message->getCc());
97
+		}
98
+
99
+		if ($headers->has('bcc')) {
100
+			$headers->addMailboxHeader('X-Swift-Bcc', $message->getBcc());
101
+		}
102
+
103
+		// Filter remaining headers against whitelist
104
+		$this->filterHeaderSet($headers, 'To');
105
+		$this->filterHeaderSet($headers, 'Cc');
106
+		$this->filterHeaderSet($headers, 'Bcc');
107
+
108
+		// Add each hard coded recipient
109
+		$to = $message->getTo();
110
+		if (null === $to) {
111
+			$to = [];
112
+		}
113
+
114
+		foreach ((array) $this->recipient as $recipient) {
115
+			if (!\array_key_exists($recipient, $to)) {
116
+				$message->addTo($recipient);
117
+			}
118
+		}
119
+	}
120
+
121
+	/**
122
+	 * Filter header set against a whitelist of regular expressions.
123
+	 *
124
+	 * @param string $type
125
+	 */
126
+	private function filterHeaderSet(Swift_Mime_SimpleHeaderSet $headerSet, $type)
127
+	{
128
+		foreach ($headerSet->getAll($type) as $headers) {
129
+			$headers->setNameAddresses($this->filterNameAddresses($headers->getNameAddresses()));
130
+		}
131
+	}
132
+
133
+	/**
134
+	 * Filtered list of addresses => name pairs.
135
+	 *
136
+	 * @return array
137
+	 */
138
+	private function filterNameAddresses(array $recipients)
139
+	{
140
+		$filtered = [];
141
+
142
+		foreach ($recipients as $address => $name) {
143
+			if ($this->isWhitelisted($address)) {
144
+				$filtered[$address] = $name;
145
+			}
146
+		}
147
+
148
+		return $filtered;
149
+	}
150
+
151
+	/**
152
+	 * Matches address against whitelist of regular expressions.
153
+	 *
154
+	 * @return bool
155
+	 */
156
+	protected function isWhitelisted($recipient)
157
+	{
158
+		if (\in_array($recipient, (array) $this->recipient)) {
159
+			return true;
160
+		}
161
+
162
+		foreach ($this->whitelist as $pattern) {
163
+			if (preg_match($pattern, $recipient)) {
164
+				return true;
165
+			}
166
+		}
167
+
168
+		return false;
169
+	}
170
+
171
+	/**
172
+	 * Invoked immediately after the Message is sent.
173
+	 */
174
+	public function sendPerformed(Swift_Events_SendEvent $evt)
175
+	{
176
+		$this->restoreMessage($evt->getMessage());
177
+	}
178
+
179
+	private function restoreMessage(Swift_Mime_SimpleMessage $message)
180
+	{
181
+		// restore original headers
182
+		$headers = $message->getHeaders();
183
+
184
+		if ($headers->has('X-Swift-To')) {
185
+			$message->setTo($headers->get('X-Swift-To')->getNameAddresses());
186
+			$headers->removeAll('X-Swift-To');
187
+		} else {
188
+			$message->setTo(null);
189
+		}
190
+
191
+		if ($headers->has('X-Swift-Cc')) {
192
+			$message->setCc($headers->get('X-Swift-Cc')->getNameAddresses());
193
+			$headers->removeAll('X-Swift-Cc');
194
+		}
195
+
196
+		if ($headers->has('X-Swift-Bcc')) {
197
+			$message->setBcc($headers->get('X-Swift-Bcc')->getNameAddresses());
198
+			$headers->removeAll('X-Swift-Bcc');
199
+		}
200
+	}
201 201
 }
Please login to merge, or discard this patch.