PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
automatorwp / integrations / campaign-monitor / includes / admin.php

admin.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.3, at integrations/campaign-monitor/includes/admin.php

112 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin
4 *
5 * @package AutomatorWP\Integrations\Campaign_Monitor\Admin
6 * @since 1.0.0
7 */
8 // Exit if accessed directly
9 if( !defined( 'ABSPATH' ) ) exit;
10
11 /**
12 * Shortcut function to get plugin options
13 *
14 * @since 1.0.0
15 *
16 * @param string $option_name
17 * @param bool $default
18 *
19 * @return mixed
20 */
21 function automatorwp_campaign_monitor_get_option( $option_name, $default = false ) {
22
23 $prefix = 'automatorwp_campaign_monitor_';
24
25 return automatorwp_get_option( $prefix . $option_name, $default );
26
27 }
28
29 /**
30 * Register plugin settings sections
31 *
32 * @since 1.0.0
33 *
34 * @return array
35 */
36 function automatorwp_campaign_monitor_settings_sections( $automatorwp_settings_sections ) {
37
38 $automatorwp_settings_sections['campaign_monitor'] = array(
39 'title' => __( 'Campaign Monitor', 'automatorwp' ),
40 'icon' => 'dashicons-email',
41 );
42
43 return $automatorwp_settings_sections;
44
45 }
46 add_filter( 'automatorwp_settings_sections', 'automatorwp_campaign_monitor_settings_sections' );
47
48 /**
49 * Register plugin settings meta boxes
50 *
51 * @since 1.0.0
52 *
53 * @return array
54 */
55 function automatorwp_campaign_monitor_settings_meta_boxes( $meta_boxes ) {
56 $prefix = 'automatorwp_campaign_monitor_';
57
58 $meta_boxes['automatorwp-campaign-monitor-settings'] = array(
59 'title' => automatorwp_dashicon( 'email' ) . __( 'Campaign Monitor', 'automatorwp' ),
60 'fields' => apply_filters( 'automatorwp_campaign_monitor_settings_fields', array(
61 $prefix . 'client_id' => array(
62 'name' => __( 'Client ID:', 'automatorwp' ),
63 'desc' => __( 'Your Campaign Monitor Client ID.', 'automatorwp' ),
64 'type' => 'text',
65 ),
66 $prefix . 'api_key' => array(
67 'name' => __( 'API Key:', 'automatorwp' ),
68 'desc' => __( 'Your Campaign Monitor API Key.', 'automatorwp' ),
69 'type' => 'text',
70 ),
71 $prefix . 'authorize' => array(
72 'type' => 'text',
73 'render_row_cb' => 'automatorwp_campaign_monitor_authorize_display_cb'
74 ),
75 ) ),
76 );
77
78 return $meta_boxes;
79 }
80 add_filter( "automatorwp_settings_campaign_monitor_meta_boxes", 'automatorwp_campaign_monitor_settings_meta_boxes' );
81
82 /**
83 * Display callback for the authorize setting
84 *
85 * @since 1.0.0
86 *
87 * @param array $field_args Array of field arguments.
88 * @param CMB2_Field $field The field object
89 */
90 function automatorwp_campaign_monitor_authorize_display_cb( $field_args, $field ) {
91
92 $field_id = $field_args['id'];
93 $client_id = automatorwp_campaign_monitor_get_option( 'client_id', '' );
94 $api_key = automatorwp_campaign_monitor_get_option( 'api_key', '' );
95
96 ?>
97 <div class="cmb-row cmb-type-custom cmb2-id-automatorwp-campaign-monitor-authorize table-layout" data-fieldtype="custom">
98 <div class="cmb-th">
99 <label><?php echo __( 'Connect with Campaign Monitor:', 'automatorwp' ); ?></label>
100 </div>
101 <div class="cmb-td">
102 <a id="<?php echo esc_attr( $field_id ); ?>" class="button button-primary" href="#"><?php echo __( 'Save Credentials', 'automatorwp' ); ?></a>
103 <p class="cmb2-metabox-description"><?php echo __( 'Enter your Client ID and API Key, then click "Save Credentials" to connect.', 'automatorwp' ); ?></p>
104 <?php if ( ! empty( $client_id ) && ! empty( $api_key ) ) : ?>
105 <div class="automatorwp-notice-success"><?php echo __( 'Connected to Campaign Monitor successfully.', 'automatorwp' ); ?></div>
106 <?php endif; ?>
107 </div>
108 </div>
109 <?php
110
111 }
112