File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
-
7
6
declare (strict_types=1 );
8
7
9
8
namespace Magento \Securitytxt \Model \Config ;
10
9
11
10
use Magento \Config \Model \Config \CommentInterface ;
11
+ use Magento \Framework \Escaper ;
12
12
13
13
/**
14
14
* Signature field description
@@ -21,11 +21,19 @@ class Signature implements CommentInterface
21
21
private $ instructionLink ;
22
22
23
23
/**
24
+ * @var Escaper
25
+ */
26
+ private $ escaper ;
27
+
28
+ /**
29
+ * @param Escaper $escaper
24
30
* @param string $instructionLink
25
31
*/
26
32
public function __construct (
33
+ Escaper $ escaper ,
27
34
string $ instructionLink = ''
28
35
) {
36
+ $ this ->escaper = $ escaper ;
29
37
$ this ->instructionLink = $ instructionLink ;
30
38
}
31
39
@@ -38,8 +46,13 @@ public function __construct(
38
46
*/
39
47
public function getCommentText ($ elementValue ): string
40
48
{
41
- return "<a href=' {$ this ->instructionLink }' target='_blank'>
42
- Read instructions on how to generate signature
43
- </a> " ;
49
+ if ($ this ->instructionLink === '' ) {
50
+ return '' ;
51
+ }
52
+ return sprintf (
53
+ "<a href='%s' target='_blank'>%s</a> " ,
54
+ $ this ->escaper ->escapeUrl ($ this ->instructionLink ),
55
+ __ ('Read instructions on how to generate signature ' )
56
+ );
44
57
}
45
58
}
Original file line number Diff line number Diff line change @@ -26,4 +26,5 @@ Hiring,Hiring
26
26
"Example: https://example.com/jobs.html","Example: https://example.com/jobs.html"
27
27
Policy,Policy
28
28
"Example: https://example.com/security-policy.html","Example: https://example.com/security-policy.html"
29
- Signature,Signature
29
+ Signature,Signature
30
+ "Read instructions on how to generate signature","Read instructions on how to generate signature"
You can’t perform that action at this time.
0 commit comments