PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 1.3.0
JetFormBuilder — Dynamic Blocks Form Builder v1.3.0
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / integrations / getresponse-handler.php
jetformbuilder / includes / integrations Last commit date
active-campaign-handler.php 4 years ago forms-captcha.php 4 years ago getresponse-handler.php 4 years ago integration-base.php 4 years ago mailchimp-handler.php 4 years ago
getresponse-handler.php
102 lines
1 <?php
2
3 namespace Jet_Form_Builder\Integrations;
4
5 /**
6 * GetResponse Handler
7 */
8
9 // If this file is called directly, abort.
10 if ( ! defined( 'WPINC' ) ) {
11 die;
12 }
13
14 /**
15 * Define Getresponse_Handler class
16 */
17 class Getresponse_Handler extends Integration_Base {
18
19 protected $api_base_url = 'https://api.getresponse.com/v3/';
20
21 /**
22 * Constructor for the class
23 *
24 * @param $api_key
25 */
26 public function __construct( $api_key ) {
27
28 if ( empty( $api_key ) ) {
29 return new \WP_Error( 'invalid_api_key' );
30 }
31
32 $this->api_key = $api_key;
33 $this->api_request_args = array(
34 'headers' => array(
35 'X-Auth-Token' => 'api-key ' . $api_key,
36 'Content-Type' => 'application/json',
37 ),
38 );
39
40 }
41
42
43 public function get_all_data() {
44 $lists = $this->get_lists();
45 $fields = $this->get_fields();
46
47 return ( empty( $lists ) && empty( $fields ) ) ? array() : array(
48 'lists' => $lists,
49 'fields' => $fields,
50 );
51 }
52
53 public function get_lists() {
54 $result = array();
55 $lists = $this->request( 'campaigns' );
56
57 if ( ! empty( $lists ) ) {
58 foreach ( $lists as $list ) {
59 if ( ! is_array( $list ) ) {
60 continue;
61 }
62 if ( ! isset( $list['campaignId'] ) ) {
63 return array();
64 }
65
66 $result[ $list['campaignId'] ] = $list['name'];
67 }
68 }
69
70 return $result;
71 }
72
73 public function get_fields() {
74 $result = array(
75 'email' => array(
76 'label' => esc_html__( 'Email', 'jet-form-builder' ),
77 'required' => true,
78 ),
79 'name' => array(
80 'label' => esc_html__( 'Name', 'jet-form-builder' ),
81 'required' => false,
82 ),
83 );
84
85 $custom_fields = $this->request( 'custom-fields' );
86
87 if ( ! empty( $custom_fields ) ) {
88 foreach ( $custom_fields as $field ) {
89 if ( ! isset( $field['customFieldId'] ) ) {
90 return array();
91 }
92 $result[ $field['customFieldId'] ] = array(
93 'label' => $field['name'],
94 'required' => false,
95 );
96 }
97 }
98
99 return $result;
100 }
101 }
102