| @@ -12,10 +12,10 @@ | ||
| 12 | 12 | * Should we load the integration logic. |
| 13 | 13 | * |
| 14 | 14 | * @return bool Should we load. |
| 15 | 15 | */ |
| 16 | - function should_load() { | |
| 17 | - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
| 16 | + public function should_load() { | |
| 17 | + include_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 18 | 18 | |
| 19 | 19 | return is_plugin_active( 'bb-plugin/fl-builder.php' ) || is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ); |
| 20 | 20 | } |
| 21 | 21 | |
| @@ -27,13 +27,24 @@ | ||
| 27 | 27 | 'optml_lazyload_bg_selectors', |
| 28 | 28 | function ( $all_watchers ) { |
| 29 | 29 | $all_watchers[] = '.fl-col-content'; |
| 30 | 30 | $all_watchers[] = '.fl-row-bg-photo > .fl-row-content-wrap'; |
| 31 | + $all_watchers[] = '.fl-module-box'; | |
| 31 | 32 | |
| 32 | 33 | return $all_watchers; |
| 33 | 34 | } |
| 34 | 35 | ); |
| 35 | - add_filter( 'fl_builder_render_css', [ Optml_Main::instance()->manager, 'replace_content' ], PHP_INT_MAX, 1 ); | |
| 36 | - add_filter( 'fl_builder_render_js', [ Optml_Main::instance()->manager, 'replace_content' ], PHP_INT_MAX, 1 ); | |
| 36 | + add_filter( 'fl_builder_render_css', [ $this, 'replace_static_content' ], PHP_INT_MAX, 1 ); | |
| 37 | + add_filter( 'fl_builder_render_js', [ $this, 'replace_static_content' ], PHP_INT_MAX, 1 ); | |
| 37 | 38 | } |
| 38 | 39 | |
| 40 | + /** | |
| 41 | + * Replace urls in static content. | |
| 42 | + * | |
| 43 | + * @param string $content Content to replace. | |
| 44 | + * | |
| 45 | + * @return string Altered content. | |
| 46 | + */ | |
| 47 | + public function replace_static_content( $content ) { | |
| 48 | + return Optml_Main::instance()->manager->replace_content( $content, true ); | |
| 49 | + } | |
| 39 | 50 | } |