@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | $filename = $this->encodeUtf8($this->filterOther((string) $filename)); |
288 | 288 | if (empty($data)) { |
289 | - $data = $this->getAttachmentData($path); |
|
289 | + $data = $this->getAttachmentData($path); |
|
290 | 290 | } |
291 | 291 | $this->attachments[] = array( |
292 | 292 | 'path' => $path, |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $addresses = array(); |
350 | 350 | foreach ($pairs as $name => $email) { |
351 | 351 | if (is_numeric($name)) { |
352 | - $name = null; |
|
352 | + $name = null; |
|
353 | 353 | } |
354 | 354 | $addresses[] = $this->formatHeader($email, $name); |
355 | 355 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | * @link http://github.com/eoghanobrien/php-simple-mail |
49 | 49 | */ |
50 | 50 | |
51 | - class Email extends BaseClass{ |
|
51 | + class Email extends BaseClass { |
|
52 | 52 | /** |
53 | 53 | * @var int $wrap |
54 | 54 | */ |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
3 | 3 | /** |
4 | 4 | * TNH Framework |
5 | 5 | * |
@@ -28,68 +28,68 @@ discard block |
||
28 | 28 | * SOFTWARE. |
29 | 29 | */ |
30 | 30 | |
31 | - class Browser { |
|
32 | - |
|
33 | - /** |
|
34 | - * List of know platforms |
|
35 | - * @var array |
|
36 | - */ |
|
37 | - private $platforms = array( |
|
38 | - '/windows nt 10/i' => 'Windows 10', |
|
39 | - '/windows phone 10/i' => 'Windows Phone 10', |
|
40 | - '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
41 | - '/windows phone 8/i' => 'Windows Phone 8', |
|
42 | - '/windows nt 6.3/i' => 'Windows 8.1', |
|
43 | - '/windows nt 6.2/i' => 'Windows 8', |
|
44 | - '/windows nt 6.1/i' => 'Windows 7', |
|
45 | - '/windows nt 6.0/i' => 'Windows Vista', |
|
46 | - '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
47 | - '/windows nt 5.1/i' => 'Windows XP', |
|
48 | - '/windows xp/i' => 'Windows XP', |
|
49 | - '/windows nt 5.0/i' => 'Windows 2000', |
|
50 | - '/windows me/i' => 'Windows ME', |
|
51 | - '/win98/i' => 'Windows 98', |
|
52 | - '/win95/i' => 'Windows 95', |
|
53 | - '/win16/i' => 'Windows 3.11', |
|
54 | - '/ipad/i' => 'iPad', |
|
31 | + class Browser { |
|
32 | + |
|
33 | + /** |
|
34 | + * List of know platforms |
|
35 | + * @var array |
|
36 | + */ |
|
37 | + private $platforms = array( |
|
38 | + '/windows nt 10/i' => 'Windows 10', |
|
39 | + '/windows phone 10/i' => 'Windows Phone 10', |
|
40 | + '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
41 | + '/windows phone 8/i' => 'Windows Phone 8', |
|
42 | + '/windows nt 6.3/i' => 'Windows 8.1', |
|
43 | + '/windows nt 6.2/i' => 'Windows 8', |
|
44 | + '/windows nt 6.1/i' => 'Windows 7', |
|
45 | + '/windows nt 6.0/i' => 'Windows Vista', |
|
46 | + '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
47 | + '/windows nt 5.1/i' => 'Windows XP', |
|
48 | + '/windows xp/i' => 'Windows XP', |
|
49 | + '/windows nt 5.0/i' => 'Windows 2000', |
|
50 | + '/windows me/i' => 'Windows ME', |
|
51 | + '/win98/i' => 'Windows 98', |
|
52 | + '/win95/i' => 'Windows 95', |
|
53 | + '/win16/i' => 'Windows 3.11', |
|
54 | + '/ipad/i' => 'iPad', |
|
55 | 55 | '/ipod/i' => 'iPod', |
56 | 56 | '/iphone/i' => 'iPhone', |
57 | 57 | '/macintosh|mac os x/i' => 'Mac OS X', |
58 | - '/mac_powerpc/i' => 'Mac OS 9', |
|
59 | - '/android/i' => 'Android', |
|
60 | - '/ubuntu/i' => 'Ubuntu', |
|
61 | - '/linux/i' => 'Linux', |
|
62 | - '/blackberry/i' => 'BlackBerry', |
|
63 | - '/webos/i' => 'Mobile' |
|
64 | - ); |
|
65 | - |
|
66 | - /** |
|
67 | - * List of know browsers |
|
68 | - * @var array |
|
69 | - */ |
|
70 | - private $browsers = array( |
|
71 | - '/mobile/i' => 'Handheld Browser', |
|
72 | - '/msie/i' => 'Internet Explorer', |
|
73 | - '/firefox/i' => 'Firefox', |
|
74 | - '/chrome/i' => 'Chrome', |
|
75 | - '/safari/i' => 'Safari', |
|
76 | - '/edge/i' => 'Edge', |
|
77 | - '/opera/i' => 'Opera', |
|
78 | - '/netscape/i' => 'Netscape', |
|
79 | - '/maxthon/i' => 'Maxthon', |
|
80 | - '/konqueror/i' => 'Konqueror' |
|
81 | - ); |
|
82 | - |
|
83 | - /** |
|
84 | - * Agent string |
|
85 | - * @var string |
|
86 | - */ |
|
87 | - private $agent = ''; |
|
88 | - |
|
89 | - /** |
|
90 | - * Browser name |
|
91 | - * @var string |
|
92 | - */ |
|
58 | + '/mac_powerpc/i' => 'Mac OS 9', |
|
59 | + '/android/i' => 'Android', |
|
60 | + '/ubuntu/i' => 'Ubuntu', |
|
61 | + '/linux/i' => 'Linux', |
|
62 | + '/blackberry/i' => 'BlackBerry', |
|
63 | + '/webos/i' => 'Mobile' |
|
64 | + ); |
|
65 | + |
|
66 | + /** |
|
67 | + * List of know browsers |
|
68 | + * @var array |
|
69 | + */ |
|
70 | + private $browsers = array( |
|
71 | + '/mobile/i' => 'Handheld Browser', |
|
72 | + '/msie/i' => 'Internet Explorer', |
|
73 | + '/firefox/i' => 'Firefox', |
|
74 | + '/chrome/i' => 'Chrome', |
|
75 | + '/safari/i' => 'Safari', |
|
76 | + '/edge/i' => 'Edge', |
|
77 | + '/opera/i' => 'Opera', |
|
78 | + '/netscape/i' => 'Netscape', |
|
79 | + '/maxthon/i' => 'Maxthon', |
|
80 | + '/konqueror/i' => 'Konqueror' |
|
81 | + ); |
|
82 | + |
|
83 | + /** |
|
84 | + * Agent string |
|
85 | + * @var string |
|
86 | + */ |
|
87 | + private $agent = ''; |
|
88 | + |
|
89 | + /** |
|
90 | + * Browser name |
|
91 | + * @var string |
|
92 | + */ |
|
93 | 93 | private $browserName = ''; |
94 | 94 | |
95 | 95 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private $isFacebook = false; |
130 | 130 | |
131 | - /** |
|
131 | + /** |
|
132 | 132 | * Class constructor |
133 | 133 | */ |
134 | 134 | public function __construct($userAgent = '') { |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | return $this->isFacebook; |
256 | 256 | } |
257 | 257 | |
258 | - /** |
|
259 | - * Returns a formatted string with a summary of the details of the browser. |
|
260 | - * @codeCoverageIgnore |
|
261 | - * |
|
262 | - * @return string formatted string with a summary of the browser |
|
263 | - */ |
|
258 | + /** |
|
259 | + * Returns a formatted string with a summary of the details of the browser. |
|
260 | + * @codeCoverageIgnore |
|
261 | + * |
|
262 | + * @return string formatted string with a summary of the browser |
|
263 | + */ |
|
264 | 264 | public function __toString() { |
265 | 265 | return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
266 | 266 | "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
@@ -304,70 +304,70 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * Determine the user's platform |
306 | 306 | */ |
307 | - protected function checkPlatform() { |
|
308 | - foreach ($this->platforms as $regex => $value) { |
|
309 | - if (preg_match($regex, $this->agent) ) { |
|
310 | - $this->setPlatform($value); |
|
311 | - break; |
|
312 | - } |
|
313 | - } |
|
314 | - } |
|
307 | + protected function checkPlatform() { |
|
308 | + foreach ($this->platforms as $regex => $value) { |
|
309 | + if (preg_match($regex, $this->agent) ) { |
|
310 | + $this->setPlatform($value); |
|
311 | + break; |
|
312 | + } |
|
313 | + } |
|
314 | + } |
|
315 | 315 | |
316 | - /** |
|
316 | + /** |
|
317 | 317 | * Routine to determine the browser type |
318 | 318 | */ |
319 | - protected function checkBrowser() { |
|
320 | - foreach ($this->browsers as $regex => $value) { |
|
321 | - if (preg_match($regex, $this->agent ) ) { |
|
322 | - $this->setBrowser($value); |
|
323 | - break; |
|
324 | - } |
|
325 | - } |
|
326 | - } |
|
319 | + protected function checkBrowser() { |
|
320 | + foreach ($this->browsers as $regex => $value) { |
|
321 | + if (preg_match($regex, $this->agent ) ) { |
|
322 | + $this->setBrowser($value); |
|
323 | + break; |
|
324 | + } |
|
325 | + } |
|
326 | + } |
|
327 | 327 | |
328 | - /** |
|
328 | + /** |
|
329 | 329 | * Routine to determine the browser version |
330 | 330 | */ |
331 | - protected function checkBrowserVersion(){ |
|
332 | - $detected = $this->getBrowser(); |
|
333 | - $detect = array_search($detected, $this->browsers); |
|
334 | - $browser = str_replace(array('/i','/'), '', $detect); |
|
335 | - $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
336 | - if (preg_match_all($regex, $this->agent, $matches)) { |
|
337 | - $found = array_search($browser, $matches['browser']); |
|
338 | - $this->setVersion($matches['version'][$found]); |
|
339 | - } |
|
340 | - } |
|
341 | - |
|
342 | - /** |
|
331 | + protected function checkBrowserVersion(){ |
|
332 | + $detected = $this->getBrowser(); |
|
333 | + $detect = array_search($detected, $this->browsers); |
|
334 | + $browser = str_replace(array('/i','/'), '', $detect); |
|
335 | + $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
336 | + if (preg_match_all($regex, $this->agent, $matches)) { |
|
337 | + $found = array_search($browser, $matches['browser']); |
|
338 | + $this->setVersion($matches['version'][$found]); |
|
339 | + } |
|
340 | + } |
|
341 | + |
|
342 | + /** |
|
343 | 343 | * Determine if the browser is Mobile or not |
344 | 344 | */ |
345 | - protected function checkMobile() { |
|
346 | - if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
345 | + protected function checkMobile() { |
|
346 | + if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
|
347 | 347 | . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent) ) { |
348 | - $this->setMobile(true); |
|
349 | - } |
|
350 | - } |
|
348 | + $this->setMobile(true); |
|
349 | + } |
|
350 | + } |
|
351 | 351 | |
352 | - /** |
|
352 | + /** |
|
353 | 353 | * Determine if the browser is Tablet or not |
354 | 354 | */ |
355 | - protected function checkTablet() { |
|
356 | - if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
357 | - $this->setTablet(true); |
|
358 | - } |
|
359 | - } |
|
355 | + protected function checkTablet() { |
|
356 | + if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
357 | + $this->setTablet(true); |
|
358 | + } |
|
359 | + } |
|
360 | 360 | |
361 | - /** |
|
361 | + /** |
|
362 | 362 | * Determine if the browser is Robot or not |
363 | 363 | */ |
364 | - protected function checkBot() { |
|
365 | - if (preg_match('/bot/i', $this->agent) ) { |
|
366 | - $this->setRobot(true); |
|
367 | - } |
|
368 | - } |
|
364 | + protected function checkBot() { |
|
365 | + if (preg_match('/bot/i', $this->agent) ) { |
|
366 | + $this->setRobot(true); |
|
367 | + } |
|
368 | + } |
|
369 | 369 | |
370 | - /** |
|
370 | + /** |
|
371 | 371 | * Detect if URL is loaded from FacebookExternalHit |
372 | 372 | */ |
373 | 373 | protected function checkFacebook() { |
@@ -380,10 +380,10 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | |
383 | - /** |
|
384 | - * Protected routine to calculate and determine what |
|
385 | - * the browser is in use (including platform) |
|
386 | - */ |
|
383 | + /** |
|
384 | + * Protected routine to calculate and determine what |
|
385 | + * the browser is in use (including platform) |
|
386 | + */ |
|
387 | 387 | protected function determine() { |
388 | 388 | $this->checkPlatform(); |
389 | 389 | $this->checkBrowser(); |
@@ -394,4 +394,4 @@ discard block |
||
394 | 394 | $this->checkFacebook(); |
395 | 395 | } |
396 | 396 | |
397 | - } |
|
397 | + } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * Reset all properties |
145 | 145 | */ |
146 | 146 | public function reset() { |
147 | - $this->agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
147 | + $this->agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
148 | 148 | $this->browserName = 'unknown'; |
149 | 149 | $this->version = 'unknown'; |
150 | 150 | $this->platform = 'unknown'; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | protected function checkPlatform() { |
308 | 308 | foreach ($this->platforms as $regex => $value) { |
309 | - if (preg_match($regex, $this->agent) ) { |
|
309 | + if (preg_match($regex, $this->agent)) { |
|
310 | 310 | $this->setPlatform($value); |
311 | 311 | break; |
312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | protected function checkBrowser() { |
320 | 320 | foreach ($this->browsers as $regex => $value) { |
321 | - if (preg_match($regex, $this->agent ) ) { |
|
321 | + if (preg_match($regex, $this->agent)) { |
|
322 | 322 | $this->setBrowser($value); |
323 | 323 | break; |
324 | 324 | } |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | /** |
329 | 329 | * Routine to determine the browser version |
330 | 330 | */ |
331 | - protected function checkBrowserVersion(){ |
|
331 | + protected function checkBrowserVersion() { |
|
332 | 332 | $detected = $this->getBrowser(); |
333 | 333 | $detect = array_search($detected, $this->browsers); |
334 | - $browser = str_replace(array('/i','/'), '', $detect); |
|
334 | + $browser = str_replace(array('/i', '/'), '', $detect); |
|
335 | 335 | $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
336 | 336 | if (preg_match_all($regex, $this->agent, $matches)) { |
337 | 337 | $found = array_search($browser, $matches['browser']); |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | protected function checkMobile() { |
346 | 346 | if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket' |
347 | - . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent) ) { |
|
347 | + . '|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->agent)) { |
|
348 | 348 | $this->setMobile(true); |
349 | 349 | } |
350 | 350 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * Determine if the browser is Tablet or not |
354 | 354 | */ |
355 | 355 | protected function checkTablet() { |
356 | - if (preg_match('/tablet|ipad/i', $this->agent) ) { |
|
356 | + if (preg_match('/tablet|ipad/i', $this->agent)) { |
|
357 | 357 | $this->setTablet(true); |
358 | 358 | } |
359 | 359 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * Determine if the browser is Robot or not |
363 | 363 | */ |
364 | 364 | protected function checkBot() { |
365 | - if (preg_match('/bot/i', $this->agent) ) { |
|
365 | + if (preg_match('/bot/i', $this->agent)) { |
|
366 | 366 | $this->setRobot(true); |
367 | 367 | } |
368 | 368 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | if (stristr($this->agent, 'FacebookExternalHit')) { |
375 | 375 | $this->setRobot(true); |
376 | 376 | $this->setFacebook(true); |
377 | - } else if (stristr($this->agent, 'FBIOS')) { |
|
377 | + } else if (stristr($this->agent, 'FBIOS')) { |
|
378 | 378 | $this->setFacebook(true); |
379 | 379 | } |
380 | 380 | } |
@@ -374,7 +374,7 @@ |
||
374 | 374 | if (stristr($this->agent, 'FacebookExternalHit')) { |
375 | 375 | $this->setRobot(true); |
376 | 376 | $this->setFacebook(true); |
377 | - } else if (stristr($this->agent, 'FBIOS')) { |
|
377 | + } else if (stristr($this->agent, 'FBIOS')) { |
|
378 | 378 | $this->setFacebook(true); |
379 | 379 | } |
380 | 380 | } |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | return $this; |
289 | 289 | } |
290 | 290 | |
291 | - /** |
|
292 | - * Get the uploade file array |
|
293 | - * @return array |
|
294 | - */ |
|
291 | + /** |
|
292 | + * Get the uploade file array |
|
293 | + * @return array |
|
294 | + */ |
|
295 | 295 | public function getUploadedFileData() { |
296 | 296 | return $this->uploadedFileData; |
297 | 297 | } |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | return $this; |
332 | 332 | } |
333 | 333 | |
334 | - /** |
|
335 | - * Get the filename |
|
336 | - * @return string |
|
337 | - */ |
|
334 | + /** |
|
335 | + * Get the filename |
|
336 | + * @return string |
|
337 | + */ |
|
338 | 338 | public function getFilename() { |
339 | 339 | return $this->filename; |
340 | 340 | } |
@@ -363,23 +363,23 @@ discard block |
||
363 | 363 | return $this; |
364 | 364 | } |
365 | 365 | |
366 | - /** |
|
367 | - * Get the max file size |
|
368 | - * @return double|int |
|
369 | - */ |
|
366 | + /** |
|
367 | + * Get the max file size |
|
368 | + * @return double|int |
|
369 | + */ |
|
370 | 370 | public function getMaxFileSize() { |
371 | 371 | return $this->maxFileSize; |
372 | 372 | } |
373 | 373 | |
374 | - /** |
|
375 | - * Append a mime type to allowed mime types |
|
376 | - * |
|
377 | - * @since 1.0 |
|
378 | - * @version 1.0.1 |
|
379 | - * @param string $mime |
|
380 | - * @return object |
|
381 | - * @method boolean setAllowMimeType |
|
382 | - */ |
|
374 | + /** |
|
375 | + * Append a mime type to allowed mime types |
|
376 | + * |
|
377 | + * @since 1.0 |
|
378 | + * @version 1.0.1 |
|
379 | + * @param string $mime |
|
380 | + * @return object |
|
381 | + * @method boolean setAllowMimeType |
|
382 | + */ |
|
383 | 383 | public function setAllowMimeType($mime) { |
384 | 384 | if (!empty($mime) && is_string($mime)) { |
385 | 385 | $this->allowedMimeTypes[] = strtolower($mime); |
@@ -500,10 +500,10 @@ discard block |
||
500 | 500 | return $this; |
501 | 501 | } |
502 | 502 | |
503 | - /** |
|
504 | - * Get the upload function name like "copy", "move_uploaded_file" |
|
505 | - * @return string |
|
506 | - */ |
|
503 | + /** |
|
504 | + * Get the upload function name like "copy", "move_uploaded_file" |
|
505 | + * @return string |
|
506 | + */ |
|
507 | 507 | public function getUploadFunction() { |
508 | 508 | return $this->uploadFunction; |
509 | 509 | } |
@@ -521,10 +521,10 @@ discard block |
||
521 | 521 | return $this; |
522 | 522 | } |
523 | 523 | |
524 | - /** |
|
525 | - * Get the allow overwriting |
|
526 | - * @return boolean |
|
527 | - */ |
|
524 | + /** |
|
525 | + * Get the allow overwriting |
|
526 | + * @return boolean |
|
527 | + */ |
|
528 | 528 | public function isAllowOverwriting() { |
529 | 529 | return $this->overwriteFile ; |
530 | 530 | } |
@@ -646,14 +646,14 @@ discard block |
||
646 | 646 | return $this->error; |
647 | 647 | } |
648 | 648 | |
649 | - /** |
|
650 | - * Retrive status of upload |
|
651 | - * |
|
652 | - * @since 1.0 |
|
653 | - * @version 1.0 |
|
654 | - * @return boolean |
|
655 | - * @method boolean getStatus |
|
656 | - */ |
|
649 | + /** |
|
650 | + * Retrive status of upload |
|
651 | + * |
|
652 | + * @since 1.0 |
|
653 | + * @version 1.0 |
|
654 | + * @return boolean |
|
655 | + * @method boolean getStatus |
|
656 | + */ |
|
657 | 657 | public function getStatus() { |
658 | 658 | return $this->file['status']; |
659 | 659 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return object the current instance |
285 | 285 | */ |
286 | - public function setUploadedFileData(array $fileData){ |
|
286 | + public function setUploadedFileData(array $fileData) { |
|
287 | 287 | $this->uploadedFileData = $fileData; |
288 | 288 | return $this; |
289 | 289 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | * @return boolean |
527 | 527 | */ |
528 | 528 | public function isAllowOverwriting() { |
529 | - return $this->overwriteFile ; |
|
529 | + return $this->overwriteFile; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | /** |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @return string |
566 | 566 | */ |
567 | 567 | public function getDestinationDirectory() { |
568 | - return $this->destinationDirectory ; |
|
568 | + return $this->destinationDirectory; |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | /** |
@@ -200,17 +200,17 @@ |
||
200 | 200 | die(); |
201 | 201 | } |
202 | 202 | |
203 | - /** |
|
204 | - * Function defined for PHP error message handling |
|
205 | - * |
|
206 | - * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
207 | - * @param string $errstr the error message |
|
208 | - * @param string $errfile the file where the error occurred |
|
209 | - * @param int $errline the line number where the error occurred |
|
210 | - * @codeCoverageIgnore |
|
211 | - * |
|
212 | - * @return boolean |
|
213 | - */ |
|
203 | + /** |
|
204 | + * Function defined for PHP error message handling |
|
205 | + * |
|
206 | + * @param int $errno the type of error for example: E_USER_ERROR, E_USER_WARNING, etc. |
|
207 | + * @param string $errstr the error message |
|
208 | + * @param string $errfile the file where the error occurred |
|
209 | + * @param int $errline the line number where the error occurred |
|
210 | + * @codeCoverageIgnore |
|
211 | + * |
|
212 | + * @return boolean |
|
213 | + */ |
|
214 | 214 | function fw_error_handler($errno, $errstr, $errfile, $errline) { |
215 | 215 | $isError = (((E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR | E_USER_ERROR) & $errno) === $errno); |
216 | 216 | if ($isError) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | class Model { |
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * This model's default database table. |
35 | 35 | * @var string the name of table |
36 | 36 | */ |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | if ($db !== null) { |
174 | 174 | $this->setDb($db); |
175 | 175 | } else { |
176 | - /** |
|
177 | - * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
178 | - * to prevent duplication |
|
179 | - */ |
|
176 | + /** |
|
177 | + * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
178 | + * to prevent duplication |
|
179 | + */ |
|
180 | 180 | $obj = & get_instance(); |
181 | - $this->setDb(clone $obj->database); |
|
181 | + $this->setDb(clone $obj->database); |
|
182 | 182 | /* $obj = & get_instance(); |
183 | 183 | if (isset($obj->database)){ |
184 | 184 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * Only get deleted rows on the next call |
628 | 628 | * |
629 | 629 | * @return object the current instance |
630 | - */ |
|
630 | + */ |
|
631 | 631 | public function onlyRecordDeleted() { |
632 | 632 | $this->returnOnlyRecordDeleted = true; |
633 | 633 | return $this; |
@@ -653,8 +653,8 @@ discard block |
||
653 | 653 | * @return array the data after add field for updated time |
654 | 654 | */ |
655 | 655 | public function updatedAt($row) { |
656 | - $row['updated_at'] = date('Y-m-d H:i:s'); |
|
657 | - return $row; |
|
656 | + $row['updated_at'] = date('Y-m-d H:i:s'); |
|
657 | + return $row; |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | /** |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | */ |
700 | 700 | public function removeProtectedTableColumns($row) { |
701 | 701 | foreach ($this->protectedTableColumns as $attr) { |
702 | - if (isset($row[$attr])) { |
|
702 | + if (isset($row[$attr])) { |
|
703 | 703 | unset($row[$attr]); |
704 | 704 | } |
705 | 705 | } |
@@ -822,23 +822,23 @@ discard block |
||
822 | 822 | return false; |
823 | 823 | } |
824 | 824 | |
825 | - /** |
|
826 | - * Get the record return type array or object |
|
827 | - * |
|
828 | - * @return string|boolean |
|
829 | - */ |
|
825 | + /** |
|
826 | + * Get the record return type array or object |
|
827 | + * |
|
828 | + * @return string|boolean |
|
829 | + */ |
|
830 | 830 | protected function getReturnType(){ |
831 | 831 | $type = false; |
832 | 832 | if ($this->temporaryReturnRecordType == 'array') { |
833 | - $type = 'array'; |
|
833 | + $type = 'array'; |
|
834 | 834 | } |
835 | 835 | return $type; |
836 | 836 | } |
837 | 837 | |
838 | - /** |
|
839 | - * Check if soft delete is enable setting the condition |
|
840 | - * @return object the current instance |
|
841 | - */ |
|
838 | + /** |
|
839 | + * Check if soft delete is enable setting the condition |
|
840 | + * @return object the current instance |
|
841 | + */ |
|
842 | 842 | protected function checkForSoftDelete(){ |
843 | 843 | if ($this->softDeleteStatus && $this->returnRecordWithDeleted !== true) { |
844 | 844 | $this->getQueryBuilder()->where( |
@@ -849,16 +849,16 @@ discard block |
||
849 | 849 | return $this; |
850 | 850 | } |
851 | 851 | |
852 | - /** |
|
853 | - * Relate for "manyToOne" and "oneToMany" |
|
854 | - * |
|
855 | - * @param string $relationship the name of relation |
|
856 | - * @param string|array $options the model and primary key values |
|
857 | - * @param object|array $row the row to update |
|
858 | - * @param string $type the type can be "manyToOne", "oneToMany" |
|
859 | - * |
|
860 | - * @return array|object the final row values |
|
861 | - */ |
|
852 | + /** |
|
853 | + * Relate for "manyToOne" and "oneToMany" |
|
854 | + * |
|
855 | + * @param string $relationship the name of relation |
|
856 | + * @param string|array $options the model and primary key values |
|
857 | + * @param object|array $row the row to update |
|
858 | + * @param string $type the type can be "manyToOne", "oneToMany" |
|
859 | + * |
|
860 | + * @return array|object the final row values |
|
861 | + */ |
|
862 | 862 | protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type){ |
863 | 863 | if (in_array($relationship, $this->withs)) { |
864 | 864 | get_instance()->loader->model($options['model'], $relationship . '_model'); |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * |
828 | 828 | * @return string|boolean |
829 | 829 | */ |
830 | - protected function getReturnType(){ |
|
830 | + protected function getReturnType() { |
|
831 | 831 | $type = false; |
832 | 832 | if ($this->temporaryReturnRecordType == 'array') { |
833 | 833 | $type = 'array'; |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | * Check if soft delete is enable setting the condition |
840 | 840 | * @return object the current instance |
841 | 841 | */ |
842 | - protected function checkForSoftDelete(){ |
|
842 | + protected function checkForSoftDelete() { |
|
843 | 843 | if ($this->softDeleteStatus && $this->returnRecordWithDeleted !== true) { |
844 | 844 | $this->getQueryBuilder()->where( |
845 | 845 | $this->softDeleteTableColumn, |
@@ -859,11 +859,11 @@ discard block |
||
859 | 859 | * |
860 | 860 | * @return array|object the final row values |
861 | 861 | */ |
862 | - protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type){ |
|
862 | + protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type) { |
|
863 | 863 | if (in_array($relationship, $this->withs)) { |
864 | 864 | get_instance()->loader->model($options['model'], $relationship . '_model'); |
865 | 865 | $model = get_instance()->{$relationship . '_model'}; |
866 | - if($type == 'manyToOne'){ |
|
866 | + if ($type == 'manyToOne') { |
|
867 | 867 | if (is_object($row)) { |
868 | 868 | $row->{$relationship} = $model->getSingleRecord($row->{$options['primary_key']}); |
869 | 869 | } else { |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | parent::__construct(); |
46 | 46 | if ($init) { |
47 | 47 | $this->init(); |
48 | - if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
48 | + if (ENVIRONMENT == 'production' && in_array(strtolower($this->config['log_level']), array('debug', 'info', 'all'))) { |
|
49 | 49 | $this->logger->warning('You are in production environment, please set ' |
50 | - . 'log level to WARNING, ERROR, FATAL to increase the application performance'); |
|
50 | + . 'log level to WARNING, ERROR, FATAL to increase the application performance'); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | - * Return the server port using variable |
|
179 | - * |
|
180 | - * @codeCoverageIgnore |
|
181 | - * @return string |
|
182 | - */ |
|
178 | + * Return the server port using variable |
|
179 | + * |
|
180 | + * @codeCoverageIgnore |
|
181 | + * @return string |
|
182 | + */ |
|
183 | 183 | protected function getServerPort() { |
184 | 184 | $globals = & class_loader('GlobalVar', 'classes'); |
185 | 185 | $serverPortValue = $globals->server('SERVER_PORT'); |
186 | 186 | $serverPort = 80; |
187 | 187 | if ($serverPortValue) { |
188 | - $serverPort = $serverPortValue; |
|
188 | + $serverPort = $serverPortValue; |
|
189 | 189 | } |
190 | 190 | $port = ''; |
191 | 191 | if ((is_https() && $serverPort != 443) || (!is_https() && $serverPort != 80)) { |
@@ -318,7 +318,7 @@ |
||
318 | 318 | * Get some parameters data need like ip address, hostname, browser info, etc. |
319 | 319 | * @return array |
320 | 320 | */ |
321 | - protected function getSessionDataParams(){ |
|
321 | + protected function getSessionDataParams() { |
|
322 | 322 | $this->OBJ->loader->functions('user_agent'); |
323 | 323 | $this->OBJ->loader->library('Browser'); |
324 | 324 |
@@ -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'); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } else { |
190 | 190 | $this->logger->info('Cannot find view [' . $view . '] in module [' . $module . '] using the default location'); |
191 | 191 | } |
192 | - if (!$path) { |
|
192 | + if (!$path) { |
|
193 | 193 | $path = $this->getDefaultFilePathForView($viewFile); |
194 | 194 | } |
195 | 195 | $this->logger->info('The view file path to be loaded is [' . $path . ']'); |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | return $this->finalPageContent; |
290 | 290 | } |
291 | 291 | |
292 | - /** |
|
293 | - * Set the final page to be rendered |
|
294 | - * @param string $finalPage the content of the final page |
|
295 | - * |
|
296 | - * @return object |
|
297 | - */ |
|
292 | + /** |
|
293 | + * Set the final page to be rendered |
|
294 | + * @param string $finalPage the content of the final page |
|
295 | + * |
|
296 | + * @return object |
|
297 | + */ |
|
298 | 298 | public function setFinalPageContent($finalPage) { |
299 | 299 | $this->finalPageContent = $finalPage; |
300 | 300 | return $this; |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | |
374 | - /** |
|
375 | - * Return the default full file path for view |
|
376 | - * @param string $file the filename |
|
377 | - * |
|
378 | - * @return string|null the full file path |
|
379 | - */ |
|
374 | + /** |
|
375 | + * Return the default full file path for view |
|
376 | + * @param string $file the filename |
|
377 | + * |
|
378 | + * @return string|null the full file path |
|
379 | + */ |
|
380 | 380 | protected function getDefaultFilePathForView($file){ |
381 | 381 | $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH); |
382 | 382 | $fullFilePath = null; |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | $headerModifiedSince = $globals->server('HTTP_IF_MODIFIED_SINCE'); |
410 | 410 | if (!empty($headerModifiedSince) && $lastModified <= strtotime($headerModifiedSince)) { |
411 | 411 | $this->logger->info('The cache page content is not yet expire for the ' |
412 | - . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
412 | + . 'URL [' . $this->currentUrl . '] send 304 header to browser'); |
|
413 | 413 | $this->sendHeaders(304); |
414 | 414 | return true; |
415 | 415 | } |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | */ |
425 | 425 | protected function sendCachePageContentToBrowser(&$cache) { |
426 | 426 | $this->logger->info('The cache page content is expired or the browser does ' |
427 | - . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
428 | - . 'send cache headers to tell the browser'); |
|
427 | + . 'not send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $this->currentUrl . '] ' |
|
428 | + . 'send cache headers to tell the browser'); |
|
429 | 429 | $this->sendHeaders(200); |
430 | 430 | //current page cache key |
431 | 431 | $pageCacheKey = $this->currentUrlCacheKey; |
@@ -564,18 +564,18 @@ discard block |
||
564 | 564 | } |
565 | 565 | } |
566 | 566 | |
567 | - /** |
|
568 | - * Set the mandory headers, like security, etc. |
|
569 | - */ |
|
567 | + /** |
|
568 | + * Set the mandory headers, like security, etc. |
|
569 | + */ |
|
570 | 570 | protected function setRequiredHeaders() { |
571 | 571 | $requiredHeaders = array( |
572 | 572 | 'X-XSS-Protection' => '1; mode=block', |
573 | 573 | 'X-Frame-Options' => 'SAMEORIGIN' |
574 | 574 | ); |
575 | 575 | foreach ($requiredHeaders as $key => $value) { |
576 | - if (!isset($this->headers[$key])) { |
|
576 | + if (!isset($this->headers[$key])) { |
|
577 | 577 | $this->headers[$key] = $value; |
578 | - } |
|
578 | + } |
|
579 | 579 | } |
580 | 580 | } |
581 | 581 | } |