Skip to content

Commit 3ae1d1f

Browse files
committed
Fix formatting for yml
1 parent 0a8dc74 commit 3ae1d1f

1 file changed

Lines changed: 37 additions & 29 deletions

File tree

proxy-aware-https-fix.php

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,42 @@
77
* Author: BitCryptic
88
*/
99

10-
if (defined('WP_CLI') && WP_CLI) return;
11-
12-
add_action('plugins_loaded', function() {
13-
$host = $_SERVER['HTTP_HOST'] ?? '';
14-
$proto = $_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '';
15-
16-
if (
17-
(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') &&
18-
($proto === 'https' || strpos($host, '.') !== false)
19-
) {
20-
$_SERVER['HTTPS'] = 'on';
21-
}
22-
});
23-
24-
add_filter('home_url', function($url) {
25-
return str_starts_with($url, 'http:') ? 'https:' . substr($url, 5) : $url;
26-
});
27-
28-
add_filter('site_url', function($url) {
29-
return str_starts_with($url, 'http:') ? 'https:' . substr($url, 5) : $url;
30-
});
31-
32-
add_filter('rank_math/rest_api_url', function() {
33-
return get_site_url(null, '/wp-json/');
34-
});
35-
36-
function badFunctionName( )
37-
{
38-
echo "This line is missing indentation and spacing.";
10+
if ( defined( 'WP_CLI' ) && WP_CLI ) {
11+
return;
3912
}
4013

14+
add_action(
15+
'plugins_loaded',
16+
function () {
17+
$host = $_SERVER['HTTP_HOST'] ?? '';
18+
$proto = $_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '';
19+
20+
if (
21+
( ! isset( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] !== 'on' ) &&
22+
( $proto === 'https' || strpos( $host, '.' ) !== false )
23+
) {
24+
$_SERVER['HTTPS'] = 'on';
25+
}
26+
}
27+
);
28+
29+
add_filter(
30+
'home_url',
31+
function ( $url ) {
32+
return str_starts_with( $url, 'http:' ) ? 'https:' . substr( $url, 5 ) : $url;
33+
}
34+
);
35+
36+
add_filter(
37+
'site_url',
38+
function ( $url ) {
39+
return str_starts_with( $url, 'http:' ) ? 'https:' . substr( $url, 5 ) : $url;
40+
}
41+
);
42+
43+
add_filter(
44+
'rank_math/rest_api_url',
45+
function () {
46+
return get_site_url( null, '/wp-json/' );
47+
}
48+
);

0 commit comments

Comments
 (0)