File tree Expand file tree Collapse file tree 3 files changed +41
-6
lines changed Expand file tree Collapse file tree 3 files changed +41
-6
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
15
15
*/
16
16
class Signature implements CommentInterface
17
17
{
18
+ /**
19
+ * @var string
20
+ */
21
+ private $ instructionLink ;
22
+
23
+ /**
24
+ * @var Escaper
25
+ */
26
+ private $ escaper ;
27
+
28
+ /**
29
+ * @param Escaper $escaper
30
+ * @param string $instructionLink
31
+ */
32
+ public function __construct (
33
+ Escaper $ escaper ,
34
+ string $ instructionLink = ''
35
+ ) {
36
+ $ this ->escaper = $ escaper ;
37
+ $ this ->instructionLink = $ instructionLink ;
38
+ }
39
+
18
40
/**
19
41
* Get comment for signature field of security txt extension.
20
42
*
@@ -24,8 +46,13 @@ class Signature implements CommentInterface
24
46
*/
25
47
public function getCommentText ($ elementValue ): string
26
48
{
27
- return "<a href='https://devdocs.magento.com/' target='_blank'>
28
- Read instructions on how to generate signature
29
- </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
+ );
30
57
}
31
58
}
Original file line number Diff line number Diff line change 22
22
<argument name =" resultPageFactory" xsi : type =" object" >securitytxtResultPageFactory</argument >
23
23
</arguments >
24
24
</type >
25
- </config >
25
+ <type name =" Magento\Securitytxt\Model\Config\Signature" >
26
+ <arguments >
27
+ <argument name =" instructionLink" xsi : type =" string" >
28
+ https://github.com/magento/security-package/blob/1.0-develop/Securitytxt/README.md
29
+ </argument >
30
+ </arguments >
31
+ </type >
32
+ </config >
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