@@ -156,7 +156,7 @@ |
||
156 | 156 | return; |
157 | 157 | } |
158 | 158 | $this->logger->info('Found the registered event listener for the ' |
159 | - . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list)); |
|
159 | + . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list)); |
|
160 | 160 | foreach ($list as $listener) { |
161 | 161 | $result = call_user_func_array($listener, array($event)); |
162 | 162 | if ($eBackup->returnBack === true) { |
@@ -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]; |
@@ -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'; |
@@ -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 | } |
@@ -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'); |
@@ -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', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | //record the class instance |
93 | 93 | $classes[$class] = isset($params) ? new $class($params) : new $class(); |
94 | - return $classes[$class]; |
|
94 | + return $classes[$class]; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | die(); |
180 | 180 | } |
181 | 181 | |
182 | - /** |
|
183 | - * Function defined for PHP error message handling |
|
184 | - * |
|
185 | - * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
186 | - * @param string $errstr the error message |
|
187 | - * @param string $errfile the file where the error occurred |
|
188 | - * @param int $errline the line number where the error occurred |
|
189 | - * @codeCoverageIgnore |
|
190 | - * |
|
191 | - * @return boolean |
|
192 | - */ |
|
182 | + /** |
|
183 | + * Function defined for PHP error message handling |
|
184 | + * |
|
185 | + * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
186 | + * @param string $errstr the error message |
|
187 | + * @param string $errfile the file where the error occurred |
|
188 | + * @param int $errline the line number where the error occurred |
|
189 | + * @codeCoverageIgnore |
|
190 | + * |
|
191 | + * @return boolean |
|
192 | + */ |
|
193 | 193 | function fw_error_handler($errno, $errstr, $errfile, $errline) { |
194 | 194 | $isError = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $errno) === $errno); |
195 | 195 | if ($isError) { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | E_RECOVERABLE_ERROR => 'Catchable Fatal Error' |
213 | 213 | ); |
214 | 214 | if (isset($errorsType[$errno])) { |
215 | - $errorType = $errorsType[$errno]; |
|
215 | + $errorType = $errorsType[$errno]; |
|
216 | 216 | } |
217 | 217 | $errorText = 'An error is occurred in the file ' . $errfile . ' at line ' . $errline . ' raison : ' . $errstr; |
218 | 218 | if ((error_reporting() & $errno) !== $errno) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Construct new ApcCache instance |
35 | 35 | */ |
36 | - public function __construct() { |
|
36 | + public function __construct() { |
|
37 | 37 | parent::__construct(); |
38 | 38 | if (!$this->isSupported()) { |
39 | 39 | show_error('The cache for APC[u] driver is not available. Check if APC[u] extension is loaded and enabled.'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function set($key, $data, $ttl = 0) { |
80 | 80 | $expire = time() + $ttl; |
81 | 81 | $this->logger->debug('Setting cache data for key [' . $key . '], time to live [' . $ttl . '], ' |
82 | - . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
82 | + . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
83 | 83 | $result = apc_store($key, $data, $ttl); |
84 | 84 | if ($result === false) { |
85 | 85 | $this->logger->error('Can not save cache data for the key [' . $key . '], return false'); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | 'mtime' => $cacheInfos['creation_time'], |
128 | 128 | 'expire' => $cacheInfos['creation_time'] + $cacheInfos['ttl'], |
129 | 129 | 'ttl' => $cacheInfos['ttl'] |
130 | - ); |
|
130 | + ); |
|
131 | 131 | } |
132 | 132 | $this->logger->info('This cache does not exists skipping'); |
133 | 133 | return false; |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | public function set($key, $data, $ttl = 0) { |
109 | 109 | $expire = time() + $ttl; |
110 | 110 | $this->logger->debug('Setting cache data for key [' . $key . '], ' |
111 | - . 'time to live [' . $ttl . '], ' |
|
112 | - . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
111 | + . 'time to live [' . $ttl . '], ' |
|
112 | + . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
113 | 113 | $filePath = $this->getFilePath($key); |
114 | 114 | $handle = fopen($filePath, 'w'); |
115 | 115 | if (!is_resource($handle)) { |
116 | 116 | $this->logger->error('Can not open the file cache ' |
117 | - . '[' . $filePath . '] for the key [' . $key . '], return false'); |
|
117 | + . '[' . $filePath . '] for the key [' . $key . '], return false'); |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | flock($handle, LOCK_EX); // exclusive lock, will get released when the file is closed |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | if ($data['expire'] > time()) { |
192 | 192 | $this->logger->info('This cache not yet expired return cache informations'); |
193 | 193 | return array( |
194 | - 'mtime' => $data['mtime'], |
|
195 | - 'expire' => $data['expire'], |
|
196 | - 'ttl' => $data['ttl'] |
|
197 | - ); |
|
194 | + 'mtime' => $data['mtime'], |
|
195 | + 'expire' => $data['expire'], |
|
196 | + 'ttl' => $data['ttl'] |
|
197 | + ); |
|
198 | 198 | } |
199 | 199 | $this->logger->info('This cache already expired return false'); |
200 | 200 | return false; |
@@ -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 | */ |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $message = $this->getWrapMessage(); |
846 | 846 | if ($this->hasAttachments()) { |
847 | 847 | $this->setAttachmentHeaders(); |
848 | - $message = $this->assembleAttachmentBody(); |
|
848 | + $message = $this->assembleAttachmentBody(); |
|
849 | 849 | } |
850 | 850 | return $message; |
851 | 851 | } |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | $this->getSmtpConfig('connection_timeout', 30) |
926 | 926 | ); |
927 | 927 | |
928 | - if (! is_resource($this->smtpSocket)) { |
|
928 | + if (!is_resource($this->smtpSocket)) { |
|
929 | 929 | $this->error = $errorNumber . ': ' . $errorMessage; |
930 | 930 | return false; |
931 | 931 | } |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | */ |
975 | 975 | if (is_resource($this->smtpSocket)) { |
976 | 976 | $method = STREAM_CRYPTO_METHOD_TLS_CLIENT; |
977 | - if(version_compare(PHP_VERSION, '5.6', '>=')) { |
|
977 | + if (version_compare(PHP_VERSION, '5.6', '>=')) { |
|
978 | 978 | $method = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; |
979 | 979 | } |
980 | 980 | stream_socket_enable_crypto($this->smtpSocket, true, $method); |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | 'To' => $to |
1042 | 1042 | ); |
1043 | 1043 | foreach ($additionalHeaders as $key => $value) { |
1044 | - if (! isset($this->headers[$key])) { |
|
1044 | + if (!isset($this->headers[$key])) { |
|
1045 | 1045 | $this->headers[$key] = $value; |
1046 | 1046 | } |
1047 | 1047 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $addresses = array(); |
396 | 396 | foreach ($pairs as $name => $email) { |
397 | 397 | if (is_numeric($name)) { |
398 | - $name = null; |
|
398 | + $name = null; |
|
399 | 399 | } |
400 | 400 | $addresses[] = $this->formatHeader($email, $name); |
401 | 401 | } |
@@ -837,10 +837,10 @@ discard block |
||
837 | 837 | return $headers; |
838 | 838 | } |
839 | 839 | |
840 | - /** |
|
841 | - * Get the attachment message for send or the simple message |
|
842 | - * @return string |
|
843 | - */ |
|
840 | + /** |
|
841 | + * Get the attachment message for send or the simple message |
|
842 | + * @return string |
|
843 | + */ |
|
844 | 844 | protected function getMessageWithAttachmentForSend() { |
845 | 845 | $message = $this->getWrapMessage(); |
846 | 846 | if ($this->hasAttachments()) { |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | */ |
871 | 871 | protected function sendHelloCommand() { |
872 | 872 | $responseCode = $this->sendCommand('EHLO ' . $this->getSmtpClientHostname()) |
873 | - ->getSmtpResponseCode(); |
|
873 | + ->getSmtpResponseCode(); |
|
874 | 874 | if ($responseCode !== 250) { |
875 | 875 | $this->error = $this->smtpResponse; |
876 | 876 | return false; |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | $message = $this->getMessageWithAttachmentForSend(); |
1018 | 1018 | $headers = $this->getHeadersForSend(); |
1019 | 1019 | $this->logger->info('Sending new mail using mail protocol, the information are listed below: ' |
1020 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1020 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1021 | 1021 | $result = mail($to, $this->subject, $message, $headers, $this->params); |
1022 | 1022 | if (!$result) { |
1023 | 1023 | $this->error = 'Error when sending mail using mail protocol'; |
@@ -1025,10 +1025,10 @@ discard block |
||
1025 | 1025 | return $result; |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - /** |
|
1029 | - * Send mail using "smtp" protocol |
|
1030 | - * @return boolean |
|
1031 | - */ |
|
1028 | + /** |
|
1029 | + * Send mail using "smtp" protocol |
|
1030 | + * @return boolean |
|
1031 | + */ |
|
1032 | 1032 | protected function sendSmtp() { |
1033 | 1033 | if (!$this->smtpConnection()) { |
1034 | 1034 | return false; |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | $message = $this->getMessageWithAttachmentForSend(); |
1039 | 1039 | $headers = $this->getHeadersForSend(); |
1040 | 1040 | $this->logger->info('Sending new mail using SMTP protocol, the information are listed below: ' |
1041 | - . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1041 | + . 'destination: ' . $to . ', headers: ' . $headers . ', message: ' . $message); |
|
1042 | 1042 | $recipients = array_merge($this->to, $this->cc, $this->bcc); |
1043 | 1043 | $commands = array( |
1044 | 1044 | 'mail_from' => array('MAIL FROM: <' . $this->from . '>', 'MAIL_FROM', 250), |
@@ -1089,17 +1089,17 @@ discard block |
||
1089 | 1089 | } |
1090 | 1090 | |
1091 | 1091 | |
1092 | - /** |
|
1093 | - * Return the client hostname for SMTP |
|
1094 | - * |
|
1095 | - * There are only two legal types of hostname - either a fully |
|
1096 | - * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1097 | - * (eg: "[1.2.3.4]"). |
|
1098 | - * |
|
1099 | - * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1100 | - * @link http://cbl.abuseat.org/namingproblems.html |
|
1101 | - * @return string |
|
1102 | - */ |
|
1092 | + /** |
|
1093 | + * Return the client hostname for SMTP |
|
1094 | + * |
|
1095 | + * There are only two legal types of hostname - either a fully |
|
1096 | + * qualified domain name (eg: "mail.example.com") or an IP literal |
|
1097 | + * (eg: "[1.2.3.4]"). |
|
1098 | + * |
|
1099 | + * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 |
|
1100 | + * @link http://cbl.abuseat.org/namingproblems.html |
|
1101 | + * @return string |
|
1102 | + */ |
|
1103 | 1103 | protected function getSmtpClientHostname() { |
1104 | 1104 | $globals = &class_loader('GlobalVar', 'classes'); |
1105 | 1105 | if ($globals->server('SERVER_NAME')) { |