| 1 |
<?php |
| 2 |
/** |
| 3 |
* CartFlows Step Meta Helper. |
| 4 |
* |
| 5 |
* @package CartFlows |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace CartflowsAdmin\AdminLegacyCore\Inc; |
| 9 |
|
| 10 |
// Exit if accessed directly. |
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Class StepMeta. |
| 17 |
*/ |
| 18 |
class StepMeta { |
| 19 |
|
| 20 |
|
| 21 |
/** |
| 22 |
* Get flow meta options. |
| 23 |
* |
| 24 |
* @param int $step_id step id. |
| 25 |
* @param string $step_type type. |
| 26 |
*/ |
| 27 |
public static function get_meta_settings( $step_id, $step_type ) { |
| 28 |
|
| 29 |
$settings = array( |
| 30 |
'tabs' => array(), |
| 31 |
); |
| 32 |
|
| 33 |
/** |
| 34 |
* Set metabox options |
| 35 |
*/ |
| 36 |
switch ( $step_type ) { |
| 37 |
case 'landing': |
| 38 |
$settings = \Cartflows_Landing_Meta_Data::get_instance()->get_settings( $step_id ); |
| 39 |
break; |
| 40 |
case 'checkout': |
| 41 |
if ( class_exists( 'WooCommerce' ) ) { |
| 42 |
$settings = \Cartflows_Checkout_Meta_Data::get_instance()->get_settings( $step_id ); |
| 43 |
} |
| 44 |
break; |
| 45 |
case 'optin': |
| 46 |
if ( class_exists( 'WooCommerce' ) ) { |
| 47 |
$settings = \Cartflows_Optin_Meta_Data::get_instance()->get_settings( $step_id ); |
| 48 |
} |
| 49 |
break; |
| 50 |
case 'thankyou': |
| 51 |
if ( class_exists( 'WooCommerce' ) ) { |
| 52 |
$settings = \Cartflows_Thankyou_Meta_Data::get_instance()->get_settings( $step_id ); |
| 53 |
} |
| 54 |
break; |
| 55 |
default: |
| 56 |
break; |
| 57 |
} |
| 58 |
|
| 59 |
// Added WP Fusion filter compatibility. |
| 60 |
$settings = wcf_apply_filters_deprecated( 'cartflows_' . $step_type . '_step_meta_settings', array( $settings, $step_id ), '1.8.0', 'cartflows_admin_' . $step_type . '_step_meta_settings' ); |
| 61 |
$settings = apply_filters( 'cartflows_admin_' . $step_type . '_step_meta_settings', $settings, $step_id ); |
| 62 |
return $settings; |
| 63 |
} |
| 64 |
|
| 65 |
} |
| 66 |
|