PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.20
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.20
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / compatibility / class-wpo-page-builder-compatibility.php

class-wpo-page-builder-compatibility.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.20, at compatibility/class-wpo-page-builder-compatibility.php

48 lines 901 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 die('No direct access allowed');
4 }
5
6 /**
7 * Adds compatibility for Page Builder plugins.
8 */
9 class WPO_Page_Builder_Compatibility {
10
11 /**
12 * Constructor.
13 */
14 private function __construct() {
15 $this->disable_webp_alter_html_in_edit_mode();
16 }
17
18 /**
19 * Returns singleton instance.
20 */
21 public static function instance() {
22 static $instance = null;
23 if (null == $instance) {
24 $instance = new static;
25 }
26
27 return $instance;
28 }
29
30 /**
31 * Checks if current page is in Page Builder edit mode.
32 *
33 * @return bool
34 */
35 private function is_edit_mode() {
36 return isset($_GET['fl_builder']) || isset($_GET['et_fb']);
37 }
38
39 /**
40 * Disables altering HTML for WebP when current page is in edit mode.
41 */
42 private function disable_webp_alter_html_in_edit_mode() {
43 if ($this->is_edit_mode()) {
44 add_filter('wpo_disable_webp_alter_html', '__return_true');
45 }
46 }
47 }
48