| 1 |
<?php |
| 2 |
/** |
| 3 |
* Divi compatibility controller. |
| 4 |
* |
| 5 |
* @package ContentControl\Admin |
| 6 |
* @copyright (c) 2023 Code Atlantic LLC |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace ContentControl\Controllers\Compatibility; |
| 10 |
|
| 11 |
use ContentControl\Base\Controller; |
| 12 |
|
| 13 |
/** |
| 14 |
* Divi controller class. |
| 15 |
*/ |
| 16 |
class Divi extends Controller { |
| 17 |
|
| 18 |
/** |
| 19 |
* Initialize widget editor UX. |
| 20 |
* |
| 21 |
* @return void |
| 22 |
*/ |
| 23 |
public function init() { |
| 24 |
add_filter( 'content_control/protection_is_disabled', [ $this, 'protection_is_disabled' ] ); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Check if controller is enabled. |
| 29 |
* |
| 30 |
* @return bool |
| 31 |
*/ |
| 32 |
public function controller_enabled() { |
| 33 |
return defined( 'ET_CORE_VERSION' ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Conditionally disable Content Control for Divi builder. |
| 38 |
* |
| 39 |
* @param boolean $protection_is_disabled Whether protection is disabled. |
| 40 |
* @return boolean |
| 41 |
*/ |
| 42 |
public function protection_is_disabled( $protection_is_disabled ) { |
| 43 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 44 |
if ( isset( $_GET['et_fb'] ) && ! empty( $_GET['et_fb'] ) ) { |
| 45 |
return true; |
| 46 |
} |
| 47 |
|
| 48 |
return $protection_is_disabled; |
| 49 |
} |
| 50 |
} |
| 51 |
|