| 1 |
<?php |
| 2 |
/** |
| 3 |
* Thrive Visual Editor Compatibility |
| 4 |
* |
| 5 |
* @package CartFlows |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Class for Thrive Visual Editor Compatibility |
| 10 |
*/ |
| 11 |
class Cartflows_Thrive_Compatibility { |
| 12 |
|
| 13 |
/** |
| 14 |
* Member Variable |
| 15 |
* |
| 16 |
* @var instance |
| 17 |
*/ |
| 18 |
private static $instance; |
| 19 |
|
| 20 |
/** |
| 21 |
* Initiator |
| 22 |
*/ |
| 23 |
public static function get_instance() { |
| 24 |
if ( ! isset( self::$instance ) ) { |
| 25 |
self::$instance = new self; |
| 26 |
} |
| 27 |
return self::$instance; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Constructor |
| 32 |
*/ |
| 33 |
public function __construct() { |
| 34 |
|
| 35 |
// Add CartFlows post type in the thrive page editor. |
| 36 |
add_filter( 'tve_landing_page_post_types', array( $this, 'send_post_type_to_thrive' ) ); |
| 37 |
|
| 38 |
add_filter( 'tcb_can_use_landing_pages', array( $this, 'send_post_type_to_thrive' ) ); |
| 39 |
|
| 40 |
add_filter( 'tcb_has_templates_tab', array( $this, 'send_post_type_to_thrive' ) ); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Return step post type for Thrive Architect. |
| 45 |
* |
| 46 |
* @since 1.0.0 |
| 47 |
* @param array $post_type_pt the current step post type. |
| 48 |
* @return array $post_type_pt current step post type. |
| 49 |
*/ |
| 50 |
function send_post_type_to_thrive( $post_type_pt ) { |
| 51 |
|
| 52 |
$post_type_pt = array(); |
| 53 |
|
| 54 |
$post_type_pt[] = CARTFLOWS_STEP_POST_TYPE; |
| 55 |
|
| 56 |
return $post_type_pt; |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Kicking this off by calling 'get_instance()' method |
| 62 |
*/ |
| 63 |
Cartflows_Thrive_Compatibility::get_instance(); |
| 64 |
|