@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | $filename = $this->encodeUtf8($this->filterOther((string) $filename)); |
387 | 387 | if (empty($data)) { |
388 | - $data = $this->getAttachmentData($path); |
|
388 | + $data = $this->getAttachmentData($path); |
|
389 | 389 | } |
390 | 390 | $this->attachments[] = array( |
391 | 391 | 'path' => $path, |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $addresses = array(); |
427 | 427 | foreach ($pairs as $name => $email) { |
428 | 428 | if (is_numeric($name)) { |
429 | - $name = null; |
|
429 | + $name = null; |
|
430 | 430 | } |
431 | 431 | $addresses[] = $this->formatHeader($email, $name); |
432 | 432 | } |
@@ -970,10 +970,10 @@ discard block |
||
970 | 970 | return $headers; |
971 | 971 | } |
972 | 972 | |
973 | - /** |
|
974 | - * Get the attachment message for send or the simple message |
|
975 | - * @return string |
|
976 | - */ |
|
973 | + /** |
|
974 | + * Get the attachment message for send or the simple message |
|
975 | + * @return string |
|
976 | + */ |
|
977 | 977 | protected function getMessageWithAttachmentForSend() { |
978 | 978 | $message = $this->getWrapMessage(); |
979 | 979 | if ($this->hasAttachments()) { |
@@ -1010,11 +1010,11 @@ discard block |
||
1010 | 1010 | */ |
1011 | 1011 | protected function sendHelloCommand() { |
1012 | 1012 | $responseCode = $this->sendCommand('EHLO ' . $this->getSmtpClientHostname()) |
1013 | - ->getSmtpResponseCode(); |
|
1013 | + ->getSmtpResponseCode(); |
|
1014 | 1014 | if ($responseCode !== 250) { |
1015 | 1015 | //May be try with "HELO" |
1016 | 1016 | $responseCode = $this->sendCommand('HELO ' . $this->getSmtpClientHostname()) |
1017 | - ->getSmtpResponseCode(); |
|
1017 | + ->getSmtpResponseCode(); |
|
1018 | 1018 | if ($responseCode !== 250) { |
1019 | 1019 | $this->error = $this->smtpResponse; |
1020 | 1020 | return false; |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | $message = $this->getMessageWithAttachmentForSend(); |
1159 | 1159 | $headers = $this->getHeadersForSend(); |
1160 | 1160 | $this->logger->info('Sending new mail using mail protocol, the information are listed below: ' |
1161 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1161 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1162 | 1162 | $result = mail($to, $this->subject, $message, $headers, $this->params); |
1163 | 1163 | if (!$result) { |
1164 | 1164 | $this->error = 'Error when sending mail using mail protocol'; |
@@ -1166,10 +1166,10 @@ discard block |
||
1166 | 1166 | return $result; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | - /** |
|
1170 | - * Send mail using "smtp" protocol |
|
1171 | - * @return boolean |
|
1172 | - */ |
|
1169 | + /** |
|
1170 | + * Send mail using "smtp" protocol |
|
1171 | + * @return boolean |
|
1172 | + */ |
|
1173 | 1173 | protected function sendSmtp() { |
1174 | 1174 | if (!$this->smtpConnection()) { |
1175 | 1175 | return false; |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | $message = $this->getMessageWithAttachmentForSend(); |
1190 | 1190 | $headers = $this->getHeadersForSend(); |
1191 | 1191 | $this->logger->info('Sending new mail using SMTP protocol, the information are listed below: ' |
1192 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1192 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1193 | 1193 | |
1194 | 1194 | $recipients = array_merge($this->to, $this->cc, $this->bcc); |
1195 | 1195 | $commands = array( |
@@ -1223,17 +1223,17 @@ discard block |
||
1223 | 1223 | return empty($this->error); |
1224 | 1224 | } |
1225 | 1225 | |
1226 | - /** |
|
1227 | - * Return the client hostname for SMTP |
|
1228 | - * |
|
1229 | - * There are only two legal types of hostname - either a fully |
|
1230 | - * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1231 | - * (eg: "[1.2.3.4]"). |
|
1232 | - * |
|
1233 | - * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1234 | - * @link http://cbl.abuseat.org/namingproblems.html |
|
1235 | - * @return string |
|
1236 | - */ |
|
1226 | + /** |
|
1227 | + * Return the client hostname for SMTP |
|
1228 | + * |
|
1229 | + * There are only two legal types of hostname - either a fully |
|
1230 | + * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1231 | + * (eg: "[1.2.3.4]"). |
|
1232 | + * |
|
1233 | + * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1234 | + * @link http://cbl.abuseat.org/namingproblems.html |
|
1235 | + * @return string |
|
1236 | + */ |
|
1237 | 1237 | protected function getSmtpClientHostname() { |
1238 | 1238 | $globals = &class_loader('GlobalVar', 'classes'); |
1239 | 1239 | if ($globals->server('SERVER_NAME')) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * SOFTWARE. |
29 | 29 | */ |
30 | 30 | |
31 | - class Email extends BaseClass{ |
|
31 | + class Email extends BaseClass { |
|
32 | 32 | /** |
33 | 33 | * @var int $wrap |
34 | 34 | */ |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | $message = $this->getWrapMessage(); |
979 | 979 | if ($this->hasAttachments()) { |
980 | 980 | $this->setAttachmentHeaders(); |
981 | - $message = $this->assembleAttachmentBody(); |
|
981 | + $message = $this->assembleAttachmentBody(); |
|
982 | 982 | } |
983 | 983 | return $message; |
984 | 984 | } |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | $this->smtpConnectionTimeout |
1073 | 1073 | ); |
1074 | 1074 | |
1075 | - if (! is_resource($this->smtpSocket)) { |
|
1075 | + if (!is_resource($this->smtpSocket)) { |
|
1076 | 1076 | $this->error = $errorNumber . ':' . $errorMessage; |
1077 | 1077 | return false; |
1078 | 1078 | } |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | */ |
1122 | 1122 | if (is_resource($this->smtpSocket)) { |
1123 | 1123 | $method = STREAM_CRYPTO_METHOD_TLS_CLIENT; |
1124 | - if(version_compare(PHP_VERSION, '5.6', '>=')) { |
|
1124 | + if (version_compare(PHP_VERSION, '5.6', '>=')) { |
|
1125 | 1125 | $method = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
1126 | 1126 | } |
1127 | 1127 | stream_socket_enable_crypto($this->smtpSocket, true, $method); |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | 'To' => $to |
1189 | 1189 | ); |
1190 | 1190 | foreach ($additionalHeaders as $key => $value) { |
1191 | - if (! isset($this->headers[$key])) { |
|
1191 | + if (!isset($this->headers[$key])) { |
|
1192 | 1192 | $this->headers[$key] = $value; |
1193 | 1193 | } |
1194 | 1194 | } |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | */ |
135 | 135 | |
136 | 136 | /** |
137 | - * The log level |
|
138 | - * |
|
139 | - * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY |
|
140 | - * |
|
141 | - * 'OFF' or 'NONE' = do not save log |
|
142 | - * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY) |
|
143 | - * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY) |
|
144 | - * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY) |
|
145 | - * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY) |
|
146 | - * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
147 | - * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
148 | - * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
149 | - * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
150 | - * |
|
151 | - * The default value is NONE if the config value is: null, '', 0, false |
|
152 | - * |
|
153 | - * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small |
|
154 | - * time the log file size will increase very fast and will cost the application performance |
|
155 | - * and also the filesystem usage of your server. |
|
156 | - */ |
|
137 | + * The log level |
|
138 | + * |
|
139 | + * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY |
|
140 | + * |
|
141 | + * 'OFF' or 'NONE' = do not save log |
|
142 | + * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY) |
|
143 | + * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY) |
|
144 | + * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY) |
|
145 | + * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY) |
|
146 | + * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
147 | + * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
148 | + * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
149 | + * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
150 | + * |
|
151 | + * The default value is NONE if the config value is: null, '', 0, false |
|
152 | + * |
|
153 | + * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small |
|
154 | + * time the log file size will increase very fast and will cost the application performance |
|
155 | + * and also the filesystem usage of your server. |
|
156 | + */ |
|
157 | 157 | $config['log_level'] = 'NONE'; |
158 | 158 | |
159 | 159 | |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | $config['log_logger_name'] = array(); |
181 | 181 | |
182 | 182 | /** |
183 | - * The logger name custom level to use for the log |
|
184 | - * |
|
185 | - * If this config is set so means the logger level will be used to overwrite |
|
186 | - * the default log level configuration above. |
|
187 | - * |
|
188 | - * Example: |
|
189 | - * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
190 | - * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
191 | - * will be saved for WARNING message and above |
|
192 | - * Note: You can also use an regular expression for the logger name. |
|
193 | - * Example: |
|
194 | - * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
195 | - * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
196 | - */ |
|
183 | + * The logger name custom level to use for the log |
|
184 | + * |
|
185 | + * If this config is set so means the logger level will be used to overwrite |
|
186 | + * the default log level configuration above. |
|
187 | + * |
|
188 | + * Example: |
|
189 | + * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
190 | + * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
191 | + * will be saved for WARNING message and above |
|
192 | + * Note: You can also use an regular expression for the logger name. |
|
193 | + * Example: |
|
194 | + * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
195 | + * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
196 | + */ |
|
197 | 197 | $config['log_logger_name_level'] = array(); |
198 | 198 | |
199 | 199 |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | if ($init) { |
47 | 47 | $this->init(); |
48 | 48 | //@codeCoverageIgnoreStart |
49 | - if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
49 | + if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
50 | 50 | $this->logger->warning('You are in production environment, please set ' |
51 | - . 'log level to WARNING, ERROR, CRITICAL, ALERT, EMERGENCY to increase the application performance'); |
|
51 | + . 'log level to WARNING, ERROR, CRITICAL, ALERT, EMERGENCY to increase the application performance'); |
|
52 | 52 | } |
53 | 53 | //@codeCoverageIgnoreEnd |
54 | 54 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | if (empty($this->config['base_url'])) { |
147 | 147 | if (ENVIRONMENT == 'production') { |
148 | 148 | $this->logger->warning('Application base URL is not set or invalid, please' |
149 | - . ' set application base URL to increase the application loading time'); |
|
149 | + . ' set application base URL to increase the application loading time'); |
|
150 | 150 | } |
151 | 151 | $baseUrl = null; |
152 | 152 | $protocol = 'http'; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | ); |
174 | 174 | } else { |
175 | 175 | $this->logger->warning('Can not determine the application ' |
176 | - . 'base URL automatically, use http://localhost as default'); |
|
176 | + . 'base URL automatically, use http://localhost as default'); |
|
177 | 177 | $baseUrl = 'http://localhost/'; |
178 | 178 | } |
179 | 179 | $this->config['base_url'] = $baseUrl; |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | - * Return the server port using variable |
|
186 | - * |
|
187 | - * @codeCoverageIgnore |
|
188 | - * @return string |
|
189 | - */ |
|
185 | + * Return the server port using variable |
|
186 | + * |
|
187 | + * @codeCoverageIgnore |
|
188 | + * @return string |
|
189 | + */ |
|
190 | 190 | protected function getServerPort() { |
191 | 191 | $globals = & class_loader('GlobalVar', 'classes'); |
192 | 192 | $serverPort = $globals->server('SERVER_PORT'); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | die(); |
181 | 181 | } |
182 | 182 | |
183 | - /** |
|
184 | - * Function defined for PHP error message handling |
|
185 | - * |
|
186 | - * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
187 | - * @param string $errstr the error message |
|
188 | - * @param string $errfile the file where the error occurred |
|
189 | - * @param int $errline the line number where the error occurred |
|
190 | - * @codeCoverageIgnore |
|
191 | - * |
|
192 | - * @return boolean |
|
193 | - */ |
|
183 | + /** |
|
184 | + * Function defined for PHP error message handling |
|
185 | + * |
|
186 | + * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
187 | + * @param string $errstr the error message |
|
188 | + * @param string $errfile the file where the error occurred |
|
189 | + * @param int $errline the line number where the error occurred |
|
190 | + * @codeCoverageIgnore |
|
191 | + * |
|
192 | + * @return boolean |
|
193 | + */ |
|
194 | 194 | function fw_error_handler($errno, $errstr, $errfile, $errline) { |
195 | 195 | $isError = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $errno) === $errno); |
196 | 196 | if ($isError) { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | E_RECOVERABLE_ERROR => 'Catchable Fatal Error' |
214 | 214 | ); |
215 | 215 | if (isset($errorsType[$errno])) { |
216 | - $errorType = $errorsType[$errno]; |
|
216 | + $errorType = $errorsType[$errno]; |
|
217 | 217 | } |
218 | 218 | $errorText = 'An error is occurred in the file ' . $errfile . ' at line ' . $errline . ' raison : ' . $errstr; |
219 | 219 | if ((error_reporting() & $errno) !== $errno) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | static $cfg; |
148 | 148 | if (empty($cfg)) { |
149 | 149 | $cfg[0] = & load_configurations(); |
150 | - if(! is_array($cfg[0])){ |
|
150 | + if (!is_array($cfg[0])) { |
|
151 | 151 | $cfg[0] = array(); |
152 | 152 | } |
153 | 153 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | set_http_status_header(500); |
198 | 198 | } |
199 | 199 | $errorType = 'Error'; |
200 | - $errorsType = array ( |
|
200 | + $errorsType = array( |
|
201 | 201 | E_ERROR => 'Error', |
202 | 202 | E_WARNING => 'Warning', |
203 | 203 | E_PARSE => 'Parsing Error', |