Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 3 |
CRAP | n/a |
0 / 0 |
|
| Automattic\Jetpack_CRM\Modules\Automations\disable_ui_if_feature_flag_is_disabled | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| Automattic\Jetpack_CRM\Modules\Automations\load_module | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| Automattic\Jetpack_CRM\Modules\Automations\define_constants | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jetpack CRM |
| 4 | * https://jetpackcrm.com |
| 5 | * |
| 6 | * Automation Module initialization |
| 7 | * |
| 8 | * @package automattic/jetpack-crm |
| 9 | */ |
| 10 | |
| 11 | namespace Automattic\Jetpack_CRM\Modules\Automations; |
| 12 | |
| 13 | use Automattic\Jetpack\CRM\Automation\Automation_Bootstrap; |
| 14 | |
| 15 | if ( ! defined( 'ZEROBSCRM_PATH' ) ) { |
| 16 | exit( 0 ); |
| 17 | } |
| 18 | |
| 19 | if ( ! apply_filters( 'jetpack_crm_feature_flag_automations', false ) ) { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * This is a temporary filter to disable the UI until we have completed building it |
| 25 | * |
| 26 | * @todo Remove this filter when the core Automation UI is ready to be released. |
| 27 | * |
| 28 | * @param bool $load_ui Whether to load the UI or not. |
| 29 | * @return bool Whether to load the UI or not. |
| 30 | */ |
| 31 | function disable_ui_if_feature_flag_is_disabled( $load_ui ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 32 | return apply_filters( 'jetpack_crm_feature_flag_automations', false ); |
| 33 | } |
| 34 | |
| 35 | add_filter( 'jetpack_crm_automations_load_ui', __NAMESPACE__ . '\disable_ui_if_feature_flag_is_disabled', 99 ); |
| 36 | |
| 37 | /** |
| 38 | * Load the Automation module. |
| 39 | * |
| 40 | * This is a core module that will always be loaded, so we do not allow it to be enabled/deactivated. |
| 41 | * |
| 42 | * @since 6.2.0 |
| 43 | * |
| 44 | * @return void |
| 45 | */ |
| 46 | function load_module() { |
| 47 | define_constants(); |
| 48 | |
| 49 | require_once JPCRM_AUTOMATIONS_MODULE_PATH . '/admin/admin-page-init.php'; |
| 50 | initialize_admin_page(); |
| 51 | |
| 52 | $bootstrap = new Automation_Bootstrap(); |
| 53 | $bootstrap->init(); |
| 54 | } |
| 55 | |
| 56 | add_action( 'jpcrm_load_modules', __NAMESPACE__ . '\load_module' ); |
| 57 | |
| 58 | /** |
| 59 | * Defines constants |
| 60 | * |
| 61 | * @since 6.2.0 |
| 62 | * |
| 63 | * @return void |
| 64 | */ |
| 65 | function define_constants() { |
| 66 | if ( ! defined( 'JPCRM_AUTOMATIONS_MODULE_ROOT_FILE' ) ) { |
| 67 | define( 'JPCRM_AUTOMATIONS_MODULE_ROOT_FILE', __FILE__ ); |
| 68 | } |
| 69 | if ( ! defined( 'JPCRM_AUTOMATIONS_MODULE_PATH' ) ) { |
| 70 | define( 'JPCRM_AUTOMATIONS_MODULE_PATH', __DIR__ ); |
| 71 | } |
| 72 | } |