Skip to content

Commit 71254ba

Browse files
committed
Performance patch.
Only check each unique value ONCE.
1 parent 461f588 commit 71254ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Web.php

Lines changed: 2 additions & 2 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: 2023.04.03).
11+
* This file: Upload handler (last modified: 2023.04.04).
1212
*/
1313

1414
namespace phpMussel\Web;
@@ -387,7 +387,7 @@ public function scan()
387387
/** Generate HTML output. */
388388
$Output = $this->Loader->parse($TemplateData, $this->Loader->readFile($TemplateFile));
389389
if (preg_match_all('~\{([A-Za-z\d_ -]+)\}~', $Output, $Matches)) {
390-
foreach ($Matches[1] as $Key) {
390+
foreach (array_unique($Matches[1]) as $Key) {
391391
if (($Value = $this->Loader->ClientL10N->getString($Key)) !== '') {
392392
$Output = str_replace('{' . $Key . '}', $Value, $Output);
393393
}

0 commit comments

Comments
 (0)