| 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 |
|