@@ -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'); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $this->log(self::DEBUG, $message); |
170 | 170 | } |
171 | 171 | |
172 | - /** |
|
172 | + /** |
|
173 | 173 | * Logs with an arbitrary level. |
174 | 174 | * |
175 | 175 | * @param integer|string $level the log level in integer or string format, |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | //NOTE: here need put the show_error() "logging" to false |
188 | 188 | //to prevent self function loop call |
189 | 189 | show_error('Invalid config log level [' . $configLogLevel . '], ' |
190 | - . 'the value must be one of the following: ' |
|
191 | - . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
192 | - , 'Log Config Error', |
|
193 | - $logging = false |
|
194 | - ); |
|
190 | + . 'the value must be one of the following: ' |
|
191 | + . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
192 | + , 'Log Config Error', |
|
193 | + $logging = false |
|
194 | + ); |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | protected function levelCanSaveLog($level) { |
262 | 262 | $result = true; |
263 | 263 | $configLogLevel = get_config('log_level'); |
264 | - //check if can save log regarding the log level configuration |
|
264 | + //check if can save log regarding the log level configuration |
|
265 | 265 | $configLevel = self::getLevelValue($configLogLevel); |
266 | 266 | if ($configLevel > $level) { |
267 | 267 | //can't log |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | //NOTE: here need put the show_error() "logging" to false |
342 | 342 | //to prevent self function loop call |
343 | 343 | show_error('Error : the log dir does not exist or is not writable', |
344 | - 'Log directory error', $logging = false); |
|
344 | + 'Log directory error', $logging = false); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | $path = $logSavePath . 'logs-' . date('Y-m-d') . '.log'; |
@@ -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 | } |
@@ -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', |