| 1 |
<?php |
| 2 |
/** |
| 3 |
* Beaver Builder page builder compatibility |
| 4 |
* |
| 5 |
* @package CartFlows |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! class_exists( 'Cartflows_BB_Compatibility' ) ) : |
| 9 |
|
| 10 |
/** |
| 11 |
* Class for Beaver Builder page builder compatibility |
| 12 |
*/ |
| 13 |
class Cartflows_BB_Compatibility { |
| 14 |
|
| 15 |
/** |
| 16 |
* Member Variable |
| 17 |
* |
| 18 |
* @var instance |
| 19 |
*/ |
| 20 |
private static $instance; |
| 21 |
|
| 22 |
/** |
| 23 |
* Initiator |
| 24 |
* |
| 25 |
* @since 1.1.4 |
| 26 |
*/ |
| 27 |
public static function get_instance() { |
| 28 |
if ( ! isset( self::$instance ) ) { |
| 29 |
self::$instance = new self; |
| 30 |
} |
| 31 |
return self::$instance; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Constructor |
| 36 |
* |
| 37 |
* @since 1.1.4 |
| 38 |
*/ |
| 39 |
public function __construct() { |
| 40 |
add_filter( 'fl_builder_post_types', array( $this, 'post_types' ) ); |
| 41 |
add_action( 'admin_init', array( $this, 'disable_rediraction' ), 99 ); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Disable Beaver Builder Redirection after plugin install. |
| 46 |
* |
| 47 |
* @since 1.1.4 |
| 48 |
* |
| 49 |
* @return void |
| 50 |
*/ |
| 51 |
function disable_rediraction() { |
| 52 |
delete_transient( '_fl_builder_activation_admin_notice' ); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Add beaver builder support for step post type. |
| 57 |
* |
| 58 |
* @since 1.1.4 |
| 59 |
* |
| 60 |
* @param array $post_types container Post types. |
| 61 |
* @return array |
| 62 |
*/ |
| 63 |
public function post_types( $post_types ) { |
| 64 |
|
| 65 |
$post_types[] = 'cartflows_step'; |
| 66 |
|
| 67 |
return $post_types; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Kicking this off by calling 'get_instance()' method |
| 73 |
*/ |
| 74 |
Cartflows_BB_Compatibility::get_instance(); |
| 75 |
|
| 76 |
endif; |
| 77 |
|