File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ abstract class Optml_App_Replacer {
5959 * @var Optml_Settings $settings
6060 */
6161 public $ settings = null ;
62+ /**
63+ * Cached offloading status.
64+ *
65+ * @var null|bool Offload status.
66+ */
67+ public static $ offload_enabled = null ;
6268 /**
6369 * Defines if the dimensions should be limited when images are served.
6470 *
@@ -356,6 +362,9 @@ function ( $strings = [] ) {
356362 },
357363 10
358364 );
365+ if ( self ::$ offload_enabled === null ) {
366+ self ::$ offload_enabled = ( new Optml_Settings () )->is_offload_enabled ();
367+ }
359368 }
360369
361370
Original file line number Diff line number Diff line change @@ -383,6 +383,9 @@ private function is_dam_url( $url ) {
383383 private function is_offloaded_url ( $ source_url ) {
384384 $ attachment_id = 0 ;
385385
386+ if ( ! self ::$ offload_enabled ) {
387+ return 0 ;
388+ }
386389 if ( strpos ( $ source_url , Optml_Media_Offload::KEYS ['not_processed_flag ' ] ) !== false ) {
387390 $ attachment_id = (int ) Optml_Media_Offload::get_attachment_id_from_url ( $ source_url );
388391 } else {
You can’t perform that action at this time.
0 commit comments