Skip to content

Commit 3531f6b

Browse files
committed
Various minor performance improvements.
1 parent 30ed367 commit 3531f6b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Web.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: Upload handler (last modified: 2026.03.17).
11+
* This file: Upload handler (last modified: 2026.03.18).
1212
*/
1313

1414
namespace phpMussel\Web;
@@ -33,12 +33,12 @@ class Web
3333
/**
3434
* @var string The path to the upload handler's asset files.
3535
*/
36-
private $AssetsPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR;
36+
private $AssetsPath = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'assets' . \DIRECTORY_SEPARATOR;
3737

3838
/**
3939
* @var string The path to the upload handler's L10N files.
4040
*/
41-
private $L10NPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'l10n' . DIRECTORY_SEPARATOR;
41+
private $L10NPath = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'l10n' . \DIRECTORY_SEPARATOR;
4242

4343
/**
4444
* @var int The number of uploads caught by PHP.
@@ -84,7 +84,7 @@ public function __construct(\phpMussel\Core\Loader &$Loader, \phpMussel\Core\Sca
8484
$this->Loader->loadL10N($this->L10NPath);
8585

8686
/** Count uploads caught by PHP. */
87-
$this->Uploads = empty($_FILES) ? 0 : count($_FILES);
87+
$this->Uploads = empty($_FILES) ? 0 : \count($_FILES);
8888

8989
/** Generate output language information attachment. */
9090
if ($this->Loader->L10NAccepted !== $this->Loader->ClientL10NAccepted) {
@@ -119,7 +119,7 @@ public function __construct(\phpMussel\Core\Loader &$Loader, \phpMussel\Core\Sca
119119
$WriteMode = ($Truncate > 0 && \filesize($File) >= $Truncate) ? 'wb' : 'ab';
120120
}
121121
if (!\is_resource($Stream = \fopen($File, $WriteMode))) {
122-
trigger_error('The "writeToUploadsLog" event failed to open "' . $File . '" for writing.');
122+
\trigger_error('The "writeToUploadsLog" event failed to open "' . $File . '" for writing.');
123123
return false;
124124
}
125125
\fwrite($Stream, $Data);
@@ -183,7 +183,7 @@ public function scan()
183183
}
184184
}
185185

186-
$FilesCount = count($FilesData['error']);
186+
$FilesCount = \count($FilesData['error']);
187187

188188
/** Iterate through normalised array and scan as necessary. */
189189
for ($Iterator = 0; $Iterator < $FilesCount; $Iterator++) {
@@ -276,7 +276,7 @@ public function scan()
276276
}
277277

278278
/** Check these first, because they'll reset otherwise, then execute the scan. */
279-
if (!count($this->Loader->ScanResultsText) && count($FilesToScan)) {
279+
if (!\count($this->Loader->ScanResultsText) && \count($FilesToScan)) {
280280
$this->Scanner->scan($FilesToScan, 4);
281281
}
282282

@@ -400,7 +400,7 @@ public function scan()
400400
/** Generate email body. */
401401
$EmailBody = \sprintf(
402402
$this->Loader->L10N->getString('notifications_message'),
403-
\preg_replace(['~^([\da-z]+:\d+:)~i', '~\n~'], ['', "<br />\n"], strip_tags($this->Loader->HashReference)),
403+
\preg_replace(['~^([\da-z]+:\d+:)~i', '~\n~'], ['', "<br />\n"], \strip_tags($this->Loader->HashReference)),
404404
$TemplateData['detected'],
405405
$this->Loader->timeFormat($this->Loader->Time, $this->Loader->Configuration['core']['time_format'])
406406
);
@@ -410,7 +410,7 @@ public function scan()
410410
[],
411411
$this->Loader->L10N->getString('notifications_subject'),
412412
$EmailBody,
413-
strip_tags($EmailBody),
413+
\strip_tags($EmailBody),
414414
''
415415
];
416416

0 commit comments

Comments
 (0)