@@ -35,7 +35,7 @@ class Forwarded_URLs {
3535 public $ non_forwarded_host ;
3636
3737 /** @var array values to find and replace in URLS */
38- private $ find_replace = [] ;
38+ private $ find_replace = array () ;
3939
4040
4141 /**
@@ -135,7 +135,7 @@ private function has_forwarded_host() {
135135 public function get_forwarded_host () {
136136
137137 // are we using Forward HQ?
138- $ host = $ _SERVER ['HTTP_X_FORWARDED_HOST ' ] ?? false ;
138+ $ host = isset ( $ _SERVER ['HTTP_X_FORWARDED_HOST ' ] ) ? $ _SERVER [ ' HTTP_X_FORWARDED_HOST ' ] : false ;
139139
140140 // if not, check if we're using ngrok
141141 $ host = ! $ host && isset ( $ _SERVER ['HTTP_X_ORIGINAL_HOST ' ] ) ? $ _SERVER ['HTTP_X_ORIGINAL_HOST ' ] : $ _SERVER ['HTTP_HOST ' ];
@@ -161,13 +161,13 @@ public function replace_with_forwarded_url( $content ) {
161161 $ forwarded_host = $ this ->get_forwarded_host ();
162162
163163 // http, https, and protocol-less URLs
164- $ this ->find_replace = [
164+ $ this ->find_replace = array (
165165 "http:// {$ non_forwarded_host }" => "http:// {$ forwarded_host }" ,
166166 "https:// {$ non_forwarded_host }" => "https:// {$ forwarded_host }" ,
167167 "// {$ non_forwarded_host }" => "// {$ forwarded_host }" ,
168- ] ;
168+ ) ;
169169
170- $ new = is_array ( $ content ) ? array_walk_recursive ( $ content , [ $ this , 'replace_url ' ] ) : str_replace ( array_keys ( $ this ->find_replace ), array_values ( $ this ->find_replace ), $ content );
170+ $ new = is_array ( $ content ) ? array_walk_recursive ( $ content , array ( $ this , 'replace_url ' ) ) : str_replace ( array_keys ( $ this ->find_replace ), array_values ( $ this ->find_replace ), $ content );
171171
172172 return $ new ;
173173 }
0 commit comments