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 33 * Copyright © Magento, Inc. All rights reserved. 
44 * See COPYING.txt for license details. 
55 */ 
6- 
76declare (strict_types=1 );
87
98namespace  Magento \Securitytxt \Model \Config ;
109
1110use  Magento \Config \Model \Config \CommentInterface ;
11+ use  Magento \Framework \Escaper ;
1212
1313/** 
1414 * Signature field description 
1515 */ 
1616class  Signature implements  CommentInterface
1717{
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+ 
1840 /** 
1941 * Get comment for signature field of security txt extension. 
2042 * 
@@ -24,8 +46,13 @@ class Signature implements CommentInterface
2446 */ 
2547 public  function  getCommentText ($ elementValue ): string 
2648 {
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+  );
3057 }
3158}
Original file line number Diff line number Diff line change 2222 <argument  name =" resultPageFactory"   xsi : type =" object"  >securitytxtResultPageFactory</argument >
2323 </arguments >
2424 </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
2626"Example: https://example.com/jobs.html","Example: https://example.com/jobs.html"
2727Policy,Policy
2828"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