File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 6
6
7
7
class URLHelper {
8
8
public static function isSecure () : bool {
9
- return ( ! empty ( $ _SERVER ['HTTPS ' ] ) && $ _SERVER ['HTTPS ' ] !== 'off ' ) ||
10
- $ _SERVER ['SERVER_PORT ' ] == 443 ;
9
+ return ( ! empty ( filter_input ( INPUT_SERVER , 'HTTPS ' ) ) &&
10
+ filter_input ( INPUT_SERVER , 'HTTPS ' ) !== 'off ' ) ||
11
+ filter_input ( INPUT_SERVER , 'SERVER_PORT ' ) == 443 ;
11
12
}
12
13
13
14
/*
@@ -17,14 +18,14 @@ public static function isSecure() : bool {
17
18
*/
18
19
public static function getCurrent () : string {
19
20
$ scheme = self ::isSecure () ? 'https ' : 'http ' ;
20
- $ url = $ scheme . ':// ' . $ _SERVER [ 'HTTP_HOST ' ] ;
21
+ $ url = $ scheme . ':// ' . filter_input ( INPUT_SERVER , 'HTTP_HOST ' ) ;
21
22
22
23
// Only include port number if needed
23
- if ( ! in_array ( $ _SERVER [ 'SERVER_PORT ' ] , [ 80 , 443 ] ) ) {
24
- $ url .= ': ' . $ _SERVER [ 'SERVER_PORT ' ] ;
24
+ if ( ! in_array ( filter_input ( INPUT_SERVER , 'SERVER_PORT ' ) , [ 80 , 443 ] ) ) {
25
+ $ url .= ': ' . filter_input ( INPUT_SERVER , 'SERVER_PORT ' ) ;
25
26
}
26
27
27
- $ url .= $ _SERVER [ 'REQUEST_URI ' ] ;
28
+ $ url .= filter_input ( INPUT_SERVER , 'REQUEST_URI ' ) ;
28
29
29
30
return $ url ;
30
31
}
You can’t perform that action at this time.
0 commit comments