@@ -214,7 +214,7 @@ |
||
214 | 214 | protected function getLogDebugBacktraceInfo() { |
215 | 215 | $dtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
216 | 216 | $i = 0; |
217 | - while ($dtrace[$i]['file'] == __FILE__ ) { |
|
217 | + while ($dtrace[$i]['file'] == __FILE__) { |
|
218 | 218 | $i++; |
219 | 219 | } |
220 | 220 | $fileInfo = $dtrace[$i]; |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | //NOTE: here need put the show_error() "logging" to false |
141 | 141 | //to prevent self function loop call |
142 | 142 | show_error('Invalid config log level [' . $configLogLevel . '], ' |
143 | - . 'the value must be one of the following: ' |
|
144 | - . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
145 | - , 'Log Config Error', |
|
146 | - $logging = false |
|
147 | - ); |
|
143 | + . 'the value must be one of the following: ' |
|
144 | + . implode(', ', array_map('strtoupper', self::$validConfigLevel)) |
|
145 | + , 'Log Config Error', |
|
146 | + $logging = false |
|
147 | + ); |
|
148 | 148 | return; |
149 | 149 | } |
150 | 150 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | protected function levelCanSaveLog($level) { |
215 | 215 | $result = true; |
216 | 216 | $configLogLevel = get_config('log_level'); |
217 | - //check if can save log regarding the log level configuration |
|
217 | + //check if can save log regarding the log level configuration |
|
218 | 218 | $configLevel = self::getLevelValue($configLogLevel); |
219 | 219 | if ($configLevel > $level) { |
220 | 220 | //can't log |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | //NOTE: here need put the show_error() "logging" to false |
295 | 295 | //to prevent self function loop call |
296 | 296 | show_error('Error : the log dir does not exist or is not writable', |
297 | - 'Log directory error', $logging = false); |
|
297 | + 'Log directory error', $logging = false); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | $path = $logSavePath . 'logs-' . date('Y-m-d') . '.log'; |
@@ -178,20 +178,20 @@ |
||
178 | 178 | $config['log_logger_name'] = array(); |
179 | 179 | |
180 | 180 | /** |
181 | - * The logger name custom level to use for the log |
|
182 | - * |
|
183 | - * If this config is set so means the logger level will be used to overwrite |
|
184 | - * the default log level configuration above. |
|
185 | - * |
|
186 | - * Example: |
|
187 | - * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
188 | - * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
189 | - * will be saved for WARNING message and above |
|
190 | - * Note: You can also use an regular expression for the logger name. |
|
191 | - * Example: |
|
192 | - * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
193 | - * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
194 | - */ |
|
181 | + * The logger name custom level to use for the log |
|
182 | + * |
|
183 | + * If this config is set so means the logger level will be used to overwrite |
|
184 | + * the default log level configuration above. |
|
185 | + * |
|
186 | + * Example: |
|
187 | + * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
188 | + * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
189 | + * will be saved for WARNING message and above |
|
190 | + * Note: You can also use an regular expression for the logger name. |
|
191 | + * Example: |
|
192 | + * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
193 | + * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
194 | + */ |
|
195 | 195 | $config['log_logger_name_level'] = array(); |
196 | 196 | |
197 | 197 |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | - * Setting the route configuration using the configuration file |
|
281 | - * and additional configuration from param |
|
282 | - * @param array $overwriteConfig the additional configuration |
|
283 | - * to overwrite with the existing one |
|
284 | - * @param boolean $useConfigFile whether to use route configuration file |
|
285 | - * |
|
286 | - * @return object |
|
287 | - */ |
|
280 | + * Setting the route configuration using the configuration file |
|
281 | + * and additional configuration from param |
|
282 | + * @param array $overwriteConfig the additional configuration |
|
283 | + * to overwrite with the existing one |
|
284 | + * @param boolean $useConfigFile whether to use route configuration file |
|
285 | + * |
|
286 | + * @return object |
|
287 | + */ |
|
288 | 288 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
289 | 289 | $route = array(); |
290 | 290 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | //the URL like http://domain.com/module/controller/method/arg1/arg2 |
366 | 366 | if (!$this->controller) { |
367 | 367 | $this->logger->info('Cannot determine the routing information ' |
368 | - . 'using the predefined routes configuration, will use the request URI parameters'); |
|
368 | + . 'using the predefined routes configuration, will use the request URI parameters'); |
|
369 | 369 | //determine route parameters using the route URI param |
370 | 370 | $this->determineRouteParamsFromRequestUri(); |
371 | 371 | } |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | - /** |
|
482 | - * Remove the URL suffix and query string values if exists |
|
483 | - * @param string $uri the route URI to process |
|
484 | - * @return string the final route uri after processed |
|
485 | - */ |
|
481 | + /** |
|
482 | + * Remove the URL suffix and query string values if exists |
|
483 | + * @param string $uri the route URI to process |
|
484 | + * @return string the final route uri after processed |
|
485 | + */ |
|
486 | 486 | protected function removeSuffixAndQueryStringFromUri($uri) { |
487 | 487 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
488 | 488 | //remove url suffix from the request URI |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $this->logger->info( |
597 | 597 | 'After loop in predefined routes configuration,' |
598 | 598 | . 'the module name is set but the controller is not set,' |
599 | - . 'so we will use module as the controller' |
|
599 | + . 'so we will use module as the controller' |
|
600 | 600 | ); |
601 | 601 | $this->controller = $this->module; |
602 | 602 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * Remove the DOCUMENT_ROOT and front controller from segments if exists |
451 | 451 | * @return void |
452 | 452 | */ |
453 | - protected function removeDocumentRootFrontControllerFromSegments(){ |
|
453 | + protected function removeDocumentRootFrontControllerFromSegments() { |
|
454 | 454 | $segment = $this->segments; |
455 | 455 | $globals = & class_loader('GlobalVar', 'classes'); |
456 | 456 | $rootFolder = substr($globals->server('SCRIPT_NAME'), 0, strpos( |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | break; |
582 | 582 | } |
583 | 583 | } |
584 | - if($findIndex !== -1){ |
|
584 | + if ($findIndex !== -1) { |
|
585 | 585 | //$args[0] => full string captured by preg_match |
586 | 586 | //$args[1], $args[2], $args[n] => contains the value of |
587 | 587 | //(:num), (:alpha), (:alnum), (:any) |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * Find file path of the current controller using the current module |
607 | 607 | * @return boolean true if the file path is found otherwise false. |
608 | 608 | */ |
609 | - protected function findControllerFullPathUsingCurrentModule(){ |
|
609 | + protected function findControllerFullPathUsingCurrentModule() { |
|
610 | 610 | $path = $this->moduleInstance->findControllerFullPath(ucfirst($this->controller), $this->module); |
611 | 611 | if (!$path) { |
612 | 612 | $this->logger->info('The controller [' . $this->controller . '] not ' |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * or the current request does not use module |
624 | 624 | * @return void |
625 | 625 | */ |
626 | - protected function setRouteParamsIfNoModuleOrNotFound(){ |
|
626 | + protected function setRouteParamsIfNoModuleOrNotFound() { |
|
627 | 627 | $segment = $this->segments; |
628 | 628 | //controller |
629 | 629 | if (isset($segment[0])) { |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | * or the current request use module |
645 | 645 | * @return void |
646 | 646 | */ |
647 | - protected function setRouteParamsIfAppHasModuleOrFound(){ |
|
647 | + protected function setRouteParamsIfAppHasModuleOrFound() { |
|
648 | 648 | //get the module list |
649 | 649 | $modules = $this->moduleInstance->getModuleList(); |
650 | 650 | $segment = $this->segments; |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | $this->controller = $segment[0]; |
658 | 658 | |
659 | 659 | //check if the request use the same module name and controller |
660 | - if($this->findControllerFullPathUsingCurrentModule()){ |
|
660 | + if ($this->findControllerFullPathUsingCurrentModule()) { |
|
661 | 661 | array_shift($segment); |
662 | 662 | } |
663 | 663 | } |
@@ -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 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | $this->smtpConnectionTimeout |
1069 | 1069 | ); |
1070 | 1070 | |
1071 | - if (! is_resource($this->smtpSocket)) { |
|
1071 | + if (!is_resource($this->smtpSocket)) { |
|
1072 | 1072 | $this->error = $errorNumber . ':' . $errorMessage; |
1073 | 1073 | return false; |
1074 | 1074 | } |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | * We want the negotiation, so we'll force it below ... |
1117 | 1117 | */ |
1118 | 1118 | $method = STREAM_CRYPTO_METHOD_TLS_CLIENT; |
1119 | - if(version_compare(PHP_VERSION, '5.6', '>=')) { |
|
1119 | + if (version_compare(PHP_VERSION, '5.6', '>=')) { |
|
1120 | 1120 | $method = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
1121 | 1121 | } |
1122 | 1122 | stream_socket_enable_crypto($this->smtpSocket, true, $method); |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | 'To' => $to |
1183 | 1183 | ); |
1184 | 1184 | foreach ($additionalHeaders as $key => $value) { |
1185 | - if (! isset($this->headers[$key])) { |
|
1185 | + if (!isset($this->headers[$key])) { |
|
1186 | 1186 | $this->headers[$key] = $value; |
1187 | 1187 | } |
1188 | 1188 | } |