@@ -284,7 +284,12 @@ public function block_style_load( $source ) {
284
284
}
285
285
286
286
// If we don't share the same URL as the site itself, return null. Otherwise return the URL.
287
- return isset ( $ parsed ) && false === strpos ( home_url (), $ parsed ) ? null : $ source ;
287
+ return isset ( $ parsed ) && false === strpos ( home_url (), $ parsed )
288
+ ? new Airplane_Mode_WP_Error ( 'airplane_mode_enabled ' , __ ( 'Airplane Mode blocked style ' , 'airplane-mode ' ), array (
289
+ 'return ' => '' ,
290
+ 'src ' => $ source ,
291
+ ) )
292
+ : $ source ;
288
293
}
289
294
290
295
/**
@@ -310,7 +315,12 @@ public function block_script_load( $source ) {
310
315
}
311
316
312
317
// If we don't share the same URL as the site itself, return null. Otherwise return the URL.
313
- return isset ( $ parsed ) && false === strpos ( home_url (), $ parsed ) ? null : $ source ;
318
+ return isset ( $ parsed ) && false === strpos ( home_url (), $ parsed )
319
+ ? new Airplane_Mode_WP_Error ( 'airplane_mode_enabled ' , __ ( 'Airplane Mode blocked script ' , 'airplane-mode ' ), array (
320
+ 'return ' => '' ,
321
+ 'src ' => $ source ,
322
+ ) )
323
+ : $ source ;
314
324
}
315
325
316
326
/**
@@ -888,6 +898,18 @@ public function count_http_requests() {
888
898
889
899
} //end class_exists
890
900
901
+ if ( ! class_exists ( 'Airplane_Mode_WP_Error ' ) ) {
902
+
903
+ class Airplane_Mode_WP_Error extends WP_Error {
904
+
905
+ public function __tostring () {
906
+ $ data = $ this ->get_error_data ();
907
+ return $ data ['return ' ];
908
+ }
909
+
910
+ }
911
+
912
+ }
891
913
892
914
// Instantiate our class.
893
915
$ Airplane_Mode_Core = Airplane_Mode_Core::getInstance ();
0 commit comments