Version Notes
Supplied missing API wrapper files
Download this release
Release Info
Developer | ActiveCampaign, Inc. |
Extension | ActiveCampaign_Subscriptions |
Version | 1.5.8 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 1.5.8
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/ActiveCampaign.class.php +6 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Automation.class.php +51 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Connector.class.php +7 -21
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Contact.class.php +6 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Deal.class.php +139 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Form.class.php +12 -5
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Segment.class.php +26 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Settings.class.php +25 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Tag.class.php +25 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Tracking.class.php +118 -0
- package.xml +5 -5
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/ActiveCampaign.class.php
CHANGED
@@ -16,6 +16,7 @@ class ActiveCampaign extends AC_Connector {
|
|
16 |
public $track_key;
|
17 |
public $version = 1;
|
18 |
public $debug = false;
|
|
|
19 |
|
20 |
function __construct($url, $api_key, $api_user = "", $api_pass = "") {
|
21 |
$this->url_base = $this->url = $url;
|
@@ -85,6 +86,9 @@ class ActiveCampaign extends AC_Connector {
|
|
85 |
|
86 |
$add_tracking = false;
|
87 |
if ($class == "AC_Tracking") $add_tracking = true;
|
|
|
|
|
|
|
88 |
|
89 |
$class = new $class($this->version, $this->url_base, $this->url, $this->api_key);
|
90 |
// IE: $contact->view()
|
@@ -119,8 +123,10 @@ require_once("Form.class.php");
|
|
119 |
require_once("Group.class.php");
|
120 |
require_once("List.class.php");
|
121 |
require_once("Message.class.php");
|
|
|
122 |
require_once("Settings.class.php");
|
123 |
require_once("Subscriber.class.php");
|
|
|
124 |
require_once("Tracking.class.php");
|
125 |
require_once("User.class.php");
|
126 |
require_once("Webhook.class.php");
|
16 |
public $track_key;
|
17 |
public $version = 1;
|
18 |
public $debug = false;
|
19 |
+
public $curl_response_error = "";
|
20 |
|
21 |
function __construct($url, $api_key, $api_user = "", $api_pass = "") {
|
22 |
$this->url_base = $this->url = $url;
|
86 |
|
87 |
$add_tracking = false;
|
88 |
if ($class == "AC_Tracking") $add_tracking = true;
|
89 |
+
if ($class == "AC_Tags") {
|
90 |
+
$class = "AC_Tag";
|
91 |
+
}
|
92 |
|
93 |
$class = new $class($this->version, $this->url_base, $this->url, $this->api_key);
|
94 |
// IE: $contact->view()
|
123 |
require_once("Group.class.php");
|
124 |
require_once("List.class.php");
|
125 |
require_once("Message.class.php");
|
126 |
+
require_once("Segment.class.php");
|
127 |
require_once("Settings.class.php");
|
128 |
require_once("Subscriber.class.php");
|
129 |
+
require_once("Tag.class.php");
|
130 |
require_once("Tracking.class.php");
|
131 |
require_once("User.class.php");
|
132 |
require_once("Webhook.class.php");
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Automation.class.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Automation extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $version;
|
6 |
+
public $url_base;
|
7 |
+
public $url;
|
8 |
+
public $api_key;
|
9 |
+
|
10 |
+
function __construct($version, $url_base, $url, $api_key) {
|
11 |
+
$this->version = $version;
|
12 |
+
$this->url_base = $url_base;
|
13 |
+
$this->url = $url;
|
14 |
+
$this->api_key = $api_key;
|
15 |
+
}
|
16 |
+
|
17 |
+
function list_($params) {
|
18 |
+
$request_url = "{$this->url}&api_action=automation_list&api_output={$this->output}&{$params}";
|
19 |
+
$response = $this->curl($request_url);
|
20 |
+
return $response;
|
21 |
+
}
|
22 |
+
|
23 |
+
function contact_add($params, $post_data) {
|
24 |
+
$request_url = "{$this->url}&api_action=automation_contact_add&api_output={$this->output}";
|
25 |
+
if ($params) $request_url .= "&{$params}";
|
26 |
+
$response = $this->curl($request_url, $post_data);
|
27 |
+
return $response;
|
28 |
+
}
|
29 |
+
|
30 |
+
function contact_remove($params, $post_data) {
|
31 |
+
$request_url = "{$this->url}&api_action=automation_contact_remove&api_output={$this->output}";
|
32 |
+
if ($params) $request_url .= "&{$params}";
|
33 |
+
$response = $this->curl($request_url, $post_data);
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
function contact_list($params) {
|
38 |
+
$request_url = "{$this->url}&api_action=automation_contact_list&api_output={$this->output}&{$params}";
|
39 |
+
$response = $this->curl($request_url);
|
40 |
+
return $response;
|
41 |
+
}
|
42 |
+
|
43 |
+
function contact_view($params) {
|
44 |
+
$request_url = "{$this->url}&api_action=automation_contact_view&api_output={$this->output}&{$params}";
|
45 |
+
$response = $this->curl($request_url);
|
46 |
+
return $response;
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Connector.class.php
CHANGED
@@ -28,11 +28,6 @@ class AC_Connector {
|
|
28 |
$this->api_key = $api_key;
|
29 |
}
|
30 |
|
31 |
-
/**
|
32 |
-
* @return boolean Whether or not the API credentials are valid.
|
33 |
-
*
|
34 |
-
* Tests the API URL and key using the user_me API method.
|
35 |
-
*/
|
36 |
public function credentials_test() {
|
37 |
$test_url = "{$this->url}&api_action=user_me&api_output={$this->output}";
|
38 |
$r = $this->curl($test_url);
|
@@ -47,9 +42,7 @@ class AC_Connector {
|
|
47 |
return $r;
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
* Standard debug function (nicely outputs variables).
|
52 |
-
*/
|
53 |
public function dbg($var, $continue = 0, $element = "pre", $extra = "") {
|
54 |
echo "<" . $element . ">";
|
55 |
echo "Vartype: " . gettype($var) . "\n";
|
@@ -64,13 +57,6 @@ class AC_Connector {
|
|
64 |
if (!$continue) exit();
|
65 |
}
|
66 |
|
67 |
-
/**
|
68 |
-
* @param string url The API URL with the relevant method params.
|
69 |
-
* @param array params_data The GET or POST parameters (keys and values).
|
70 |
-
* @param string verb The HTTP verb (GET, POST, DELETE, etc).
|
71 |
-
* @param string custom_method Any custom method that gets handled differently (such as how we process the response).
|
72 |
-
* @return object The response object from the curl request.
|
73 |
-
*/
|
74 |
public function curl($url, $params_data = array(), $verb = "", $custom_method = "") {
|
75 |
if ($this->version == 1) {
|
76 |
// find the method from the URL.
|
@@ -161,14 +147,14 @@ class AC_Connector {
|
|
161 |
$data .= "{$key}=" . urlencode($value) . "&";
|
162 |
}
|
163 |
}
|
164 |
-
$data = rtrim($data, "& ");
|
165 |
}
|
166 |
else {
|
167 |
-
//
|
168 |
-
//
|
169 |
-
$data =
|
170 |
}
|
171 |
|
|
|
172 |
curl_setopt($request, CURLOPT_HTTPHEADER, array("Expect:"));
|
173 |
$debug_str1 .= "curl_setopt(\$ch, CURLOPT_HTTPHEADER, array(\"Expect:\"));\n";
|
174 |
if ($this->debug) {
|
@@ -217,9 +203,9 @@ class AC_Connector {
|
|
217 |
return $response;
|
218 |
}
|
219 |
|
220 |
-
|
221 |
$requestException->setFailedMessage($response);
|
222 |
-
throw $requestException
|
223 |
}
|
224 |
|
225 |
if ($this->debug) {
|
28 |
$this->api_key = $api_key;
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
public function credentials_test() {
|
32 |
$test_url = "{$this->url}&api_action=user_me&api_output={$this->output}";
|
33 |
$r = $this->curl($test_url);
|
42 |
return $r;
|
43 |
}
|
44 |
|
45 |
+
// debug function (nicely outputs variables)
|
|
|
|
|
46 |
public function dbg($var, $continue = 0, $element = "pre", $extra = "") {
|
47 |
echo "<" . $element . ">";
|
48 |
echo "Vartype: " . gettype($var) . "\n";
|
57 |
if (!$continue) exit();
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
public function curl($url, $params_data = array(), $verb = "", $custom_method = "") {
|
61 |
if ($this->version == 1) {
|
62 |
// find the method from the URL.
|
147 |
$data .= "{$key}=" . urlencode($value) . "&";
|
148 |
}
|
149 |
}
|
|
|
150 |
}
|
151 |
else {
|
152 |
+
// not an array - perhaps serialized or JSON string?
|
153 |
+
// just pass it as data
|
154 |
+
$data = "data={$params_data}";
|
155 |
}
|
156 |
|
157 |
+
$data = rtrim($data, "& ");
|
158 |
curl_setopt($request, CURLOPT_HTTPHEADER, array("Expect:"));
|
159 |
$debug_str1 .= "curl_setopt(\$ch, CURLOPT_HTTPHEADER, array(\"Expect:\"));\n";
|
160 |
if ($this->debug) {
|
203 |
return $response;
|
204 |
}
|
205 |
|
206 |
+
$requestException = new RequestException;
|
207 |
$requestException->setFailedMessage($response);
|
208 |
+
throw $requestException;
|
209 |
}
|
210 |
|
211 |
if ($this->debug) {
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Contact.class.php
CHANGED
@@ -21,6 +21,12 @@ class AC_Contact extends ActiveCampaign {
|
|
21 |
return $response;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
function delete_list($params) {
|
25 |
$request_url = "{$this->url}&api_action=contact_delete_list&api_output={$this->output}&{$params}";
|
26 |
$response = $this->curl($request_url);
|
21 |
return $response;
|
22 |
}
|
23 |
|
24 |
+
function automation_list($params) {
|
25 |
+
$request_url = "{$this->url}&api_action=contact_automation_list&api_output={$this->output}&{$params}";
|
26 |
+
$response = $this->curl($request_url);
|
27 |
+
return $response;
|
28 |
+
}
|
29 |
+
|
30 |
function delete_list($params) {
|
31 |
$request_url = "{$this->url}&api_action=contact_delete_list&api_output={$this->output}&{$params}";
|
32 |
$response = $this->curl($request_url);
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Deal.class.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Deal extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $version;
|
6 |
+
public $url_base;
|
7 |
+
public $url;
|
8 |
+
public $api_key;
|
9 |
+
|
10 |
+
function __construct($version, $url_base, $url, $api_key) {
|
11 |
+
$this->version = $version;
|
12 |
+
$this->url_base = $url_base;
|
13 |
+
$this->url = $url;
|
14 |
+
$this->api_key = $api_key;
|
15 |
+
}
|
16 |
+
|
17 |
+
function add($params, $post_data) {
|
18 |
+
$request_url = "{$this->url}&api_action=deal_add&api_output={$this->output}";
|
19 |
+
$response = $this->curl($request_url, $post_data);
|
20 |
+
return $response;
|
21 |
+
}
|
22 |
+
|
23 |
+
function edit($params, $post_data) {
|
24 |
+
$request_url = "{$this->url}&api_action=deal_edit&api_output={$this->output}";
|
25 |
+
$response = $this->curl($request_url, $post_data);
|
26 |
+
return $response;
|
27 |
+
}
|
28 |
+
|
29 |
+
function delete($params, $post_data) {
|
30 |
+
$request_url = "{$this->url}&api_action=deal_delete&api_output={$this->output}";
|
31 |
+
$response = $this->curl($request_url, $post_data);
|
32 |
+
return $response;
|
33 |
+
}
|
34 |
+
|
35 |
+
function get($params) {
|
36 |
+
$request_url = "{$this->url}&api_action=deal_get&api_output={$this->output}&{$params}";
|
37 |
+
$response = $this->curl($request_url);
|
38 |
+
return $response;
|
39 |
+
}
|
40 |
+
|
41 |
+
function list_($params) {
|
42 |
+
$request_url = "{$this->url}&api_action=deal_list&api_output={$this->output}&{$params}";
|
43 |
+
$response = $this->curl($request_url);
|
44 |
+
return $response;
|
45 |
+
}
|
46 |
+
|
47 |
+
function note_add($params, $post_data) {
|
48 |
+
$request_url = "{$this->url}&api_action=deal_note_add&api_output={$this->output}";
|
49 |
+
$response = $this->curl($request_url, $post_data);
|
50 |
+
return $response;
|
51 |
+
}
|
52 |
+
|
53 |
+
function note_edit($params, $post_data) {
|
54 |
+
$request_url = "{$this->url}&api_action=deal_note_edit&api_output={$this->output}";
|
55 |
+
$response = $this->curl($request_url, $post_data);
|
56 |
+
return $response;
|
57 |
+
}
|
58 |
+
|
59 |
+
function pipeline_add($params, $post_data) {
|
60 |
+
$request_url = "{$this->url}&api_action=deal_pipeline_add&api_output={$this->output}";
|
61 |
+
$response = $this->curl($request_url, $post_data);
|
62 |
+
return $response;
|
63 |
+
}
|
64 |
+
|
65 |
+
function pipeline_edit($params, $post_data) {
|
66 |
+
$request_url = "{$this->url}&api_action=deal_pipeline_edit&api_output={$this->output}";
|
67 |
+
$response = $this->curl($request_url, $post_data);
|
68 |
+
return $response;
|
69 |
+
}
|
70 |
+
|
71 |
+
function pipeline_delete($params, $post_data) {
|
72 |
+
$request_url = "{$this->url}&api_action=deal_pipeline_delete&api_output={$this->output}";
|
73 |
+
$response = $this->curl($request_url, $post_data);
|
74 |
+
return $response;
|
75 |
+
}
|
76 |
+
|
77 |
+
function pipeline_list($params) {
|
78 |
+
$request_url = "{$this->url}&api_action=deal_pipeline_list&api_output={$this->output}&{$params}";
|
79 |
+
$response = $this->curl($request_url);
|
80 |
+
return $response;
|
81 |
+
}
|
82 |
+
|
83 |
+
function stage_add($params, $post_data) {
|
84 |
+
$request_url = "{$this->url}&api_action=deal_stage_add&api_output={$this->output}";
|
85 |
+
$response = $this->curl($request_url, $post_data);
|
86 |
+
return $response;
|
87 |
+
}
|
88 |
+
|
89 |
+
function stage_edit($params, $post_data) {
|
90 |
+
$request_url = "{$this->url}&api_action=deal_stage_edit&api_output={$this->output}";
|
91 |
+
$response = $this->curl($request_url, $post_data);
|
92 |
+
return $response;
|
93 |
+
}
|
94 |
+
|
95 |
+
function stage_delete($params, $post_data) {
|
96 |
+
$request_url = "{$this->url}&api_action=deal_stage_delete&api_output={$this->output}";
|
97 |
+
$response = $this->curl($request_url, $post_data);
|
98 |
+
return $response;
|
99 |
+
}
|
100 |
+
|
101 |
+
function stage_list($params) {
|
102 |
+
$request_url = "{$this->url}&api_action=deal_stage_list&api_output={$this->output}&{$params}";
|
103 |
+
$response = $this->curl($request_url);
|
104 |
+
return $response;
|
105 |
+
}
|
106 |
+
|
107 |
+
function task_add($params, $post_data) {
|
108 |
+
$request_url = "{$this->url}&api_action=deal_task_add&api_output={$this->output}";
|
109 |
+
$response = $this->curl($request_url, $post_data);
|
110 |
+
return $response;
|
111 |
+
}
|
112 |
+
|
113 |
+
function task_edit($params, $post_data) {
|
114 |
+
$request_url = "{$this->url}&api_action=deal_task_edit&api_output={$this->output}";
|
115 |
+
$response = $this->curl($request_url, $post_data);
|
116 |
+
return $response;
|
117 |
+
}
|
118 |
+
|
119 |
+
function tasktype_add($params, $post_data) {
|
120 |
+
$request_url = "{$this->url}&api_action=deal_tasktype_add&api_output={$this->output}";
|
121 |
+
$response = $this->curl($request_url, $post_data);
|
122 |
+
return $response;
|
123 |
+
}
|
124 |
+
|
125 |
+
function tasktype_edit($params, $post_data) {
|
126 |
+
$request_url = "{$this->url}&api_action=deal_tasktype_edit&api_output={$this->output}";
|
127 |
+
$response = $this->curl($request_url, $post_data);
|
128 |
+
return $response;
|
129 |
+
}
|
130 |
+
|
131 |
+
function tasktype_delete($params, $post_data) {
|
132 |
+
$request_url = "{$this->url}&api_action=deal_tasktype_delete&api_output={$this->output}";
|
133 |
+
$response = $this->curl($request_url, $post_data);
|
134 |
+
return $response;
|
135 |
+
}
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Form.class.php
CHANGED
@@ -89,7 +89,13 @@ class AC_Form extends ActiveCampaign {
|
|
89 |
|
90 |
// replace the Submit button to be a button type (for ajax).
|
91 |
// forms come out of AC now with a "submit" button (it used to be "button").
|
92 |
-
$html = preg_replace("/
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
$action_val = urldecode($action_val);
|
95 |
|
@@ -100,13 +106,13 @@ var \$j = jQuery.noConflict();
|
|
100 |
|
101 |
\$j(document).ready(function() {
|
102 |
|
103 |
-
\$j('#_form_{$id}
|
104 |
|
105 |
// rename the radio options for Subscribe/Unsubscribe, since they conflict with the hidden field.
|
106 |
\$j('input[type=radio][name=act]').attr('name','act_radio');
|
107 |
|
108 |
var form_data = {};
|
109 |
-
\$j('#_form_{$id}').each(function() {
|
110 |
form_data = \$j(this).serialize();
|
111 |
});
|
112 |
|
@@ -141,7 +147,6 @@ var \$j = jQuery.noConflict();
|
|
141 |
}
|
142 |
|
143 |
function process($params) {
|
144 |
-
|
145 |
$r = array();
|
146 |
if ($_SERVER["REQUEST_METHOD"] != "POST") return $r;
|
147 |
|
@@ -168,6 +173,7 @@ var \$j = jQuery.noConflict();
|
|
168 |
$act = $_POST["act_radio"];
|
169 |
}
|
170 |
$email = $_POST["email"];
|
|
|
171 |
$phone = isset($_POST["phone"]) ? $_POST["phone"] : "";
|
172 |
$lists = (isset($_POST["nlbox"]) && $_POST["nlbox"]) ? $_POST["nlbox"] : array();
|
173 |
if ($captcha_in_form) {
|
@@ -187,7 +193,7 @@ var \$j = jQuery.noConflict();
|
|
187 |
$firstname = array_shift($fullname);
|
188 |
$lastname = implode(" ", $fullname);
|
189 |
}
|
190 |
-
|
191 |
$firstname = trim($_POST["firstname"]);
|
192 |
$lastname = trim($_POST["lastname"]);
|
193 |
if ($firstname == "" && isset($_POST["first_name"])) $firstname = trim($_POST["first_name"]);
|
@@ -213,6 +219,7 @@ var \$j = jQuery.noConflict();
|
|
213 |
foreach ($lists as $listid) {
|
214 |
$contact["p[{$listid}]"] = $listid;
|
215 |
$contact["status[{$listid}]"] = $status;
|
|
|
216 |
}
|
217 |
|
218 |
if (!$sync) {
|
89 |
|
90 |
// replace the Submit button to be a button type (for ajax).
|
91 |
// forms come out of AC now with a "submit" button (it used to be "button").
|
92 |
+
$html = preg_replace("/class=['\"]+_submit['\"]+ type=['\"]+submit['\"]+/", "class='_submit' type='button'", $html);
|
93 |
+
|
94 |
+
// Replace the external image (captcha) script with the local one, so the session var is accessible.
|
95 |
+
$html = preg_replace("/\/\/.*\/ac_global\/scripts\/randomimage\.php/i", "randomimage.php", $html);
|
96 |
+
|
97 |
+
// Remove Embedded forms JS
|
98 |
+
$html = preg_replace('/<script[^>]*>.*?<\/script>/s', '', $html);
|
99 |
|
100 |
$action_val = urldecode($action_val);
|
101 |
|
106 |
|
107 |
\$j(document).ready(function() {
|
108 |
|
109 |
+
\$j('#_form_{$id}_ button').click(function() {
|
110 |
|
111 |
// rename the radio options for Subscribe/Unsubscribe, since they conflict with the hidden field.
|
112 |
\$j('input[type=radio][name=act]').attr('name','act_radio');
|
113 |
|
114 |
var form_data = {};
|
115 |
+
\$j('#_form_{$id}_').each(function() {
|
116 |
form_data = \$j(this).serialize();
|
117 |
});
|
118 |
|
147 |
}
|
148 |
|
149 |
function process($params) {
|
|
|
150 |
$r = array();
|
151 |
if ($_SERVER["REQUEST_METHOD"] != "POST") return $r;
|
152 |
|
173 |
$act = $_POST["act_radio"];
|
174 |
}
|
175 |
$email = $_POST["email"];
|
176 |
+
$firstname = $lastname = "";
|
177 |
$phone = isset($_POST["phone"]) ? $_POST["phone"] : "";
|
178 |
$lists = (isset($_POST["nlbox"]) && $_POST["nlbox"]) ? $_POST["nlbox"] : array();
|
179 |
if ($captcha_in_form) {
|
193 |
$firstname = array_shift($fullname);
|
194 |
$lastname = implode(" ", $fullname);
|
195 |
}
|
196 |
+
elseif (isset($_POST["firstname"]) && isset($_POST["lastname"])) {
|
197 |
$firstname = trim($_POST["firstname"]);
|
198 |
$lastname = trim($_POST["lastname"]);
|
199 |
if ($firstname == "" && isset($_POST["first_name"])) $firstname = trim($_POST["first_name"]);
|
219 |
foreach ($lists as $listid) {
|
220 |
$contact["p[{$listid}]"] = $listid;
|
221 |
$contact["status[{$listid}]"] = $status;
|
222 |
+
$contact["instantresponders[{$listid}]"] = 1;
|
223 |
}
|
224 |
|
225 |
if (!$sync) {
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Segment.class.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Segment extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $version;
|
6 |
+
public $url_base;
|
7 |
+
public $url;
|
8 |
+
public $api_key;
|
9 |
+
|
10 |
+
function __construct($version, $url_base, $url, $api_key) {
|
11 |
+
$this->version = $version;
|
12 |
+
$this->url_base = $url_base;
|
13 |
+
$this->url = $url;
|
14 |
+
$this->api_key = $api_key;
|
15 |
+
}
|
16 |
+
|
17 |
+
function list_($params) {
|
18 |
+
// version 2 only
|
19 |
+
$request_url = "{$this->url_base}/segment/list";
|
20 |
+
$response = $this->curl($request_url, $params, "GET", "segment_list");
|
21 |
+
return $response;
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Settings.class.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Settings extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $version;
|
6 |
+
public $url_base;
|
7 |
+
public $url;
|
8 |
+
public $api_key;
|
9 |
+
|
10 |
+
function __construct($version, $url_base, $url, $api_key) {
|
11 |
+
$this->version = $version;
|
12 |
+
$this->url_base = $url_base;
|
13 |
+
$this->url = $url;
|
14 |
+
$this->api_key = $api_key;
|
15 |
+
}
|
16 |
+
|
17 |
+
function edit($params, $post_data) {
|
18 |
+
$request_url = "{$this->url}&api_action=settings_edit&api_output={$this->output}";
|
19 |
+
$response = $this->curl($request_url, $post_data);
|
20 |
+
return $response;
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Tag.class.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Tag extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $version;
|
6 |
+
public $url_base;
|
7 |
+
public $url;
|
8 |
+
public $api_key;
|
9 |
+
|
10 |
+
function __construct($version, $url_base, $url, $api_key) {
|
11 |
+
$this->version = $version;
|
12 |
+
$this->url_base = $url_base;
|
13 |
+
$this->url = $url;
|
14 |
+
$this->api_key = $api_key;
|
15 |
+
}
|
16 |
+
|
17 |
+
function list_($params) {
|
18 |
+
$request_url = "{$this->url}&api_action=tags_list&api_output={$this->output}&{$params}";
|
19 |
+
$response = $this->curl($request_url);
|
20 |
+
return $response;
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Tracking.class.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Tracking extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $version;
|
6 |
+
public $url_base;
|
7 |
+
public $url;
|
8 |
+
public $api_key;
|
9 |
+
|
10 |
+
function __construct($version, $url_base, $url, $api_key) {
|
11 |
+
$this->version = $version;
|
12 |
+
$this->url_base = $url_base;
|
13 |
+
$this->url = $url;
|
14 |
+
$this->api_key = $api_key;
|
15 |
+
}
|
16 |
+
|
17 |
+
/*
|
18 |
+
* Update the status (enabled or disabled) for site tracking.
|
19 |
+
*/
|
20 |
+
function site_status($params, $post_data) {
|
21 |
+
// version 2 only.
|
22 |
+
$request_url = "{$this->url_base}/track/site";
|
23 |
+
$response = $this->curl($request_url, $post_data, "POST", "tracking_site_status");
|
24 |
+
return $response;
|
25 |
+
}
|
26 |
+
|
27 |
+
/*
|
28 |
+
* Update the status (enabled or disabled) for event tracking.
|
29 |
+
*/
|
30 |
+
function event_status($params, $post_data) {
|
31 |
+
// version 2 only.
|
32 |
+
$request_url = "{$this->url_base}/track/event";
|
33 |
+
$response = $this->curl($request_url, $post_data, "POST", "tracking_event_status");
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
/*
|
38 |
+
* Returns existing whitelisted domains.
|
39 |
+
*/
|
40 |
+
function site_list($params) {
|
41 |
+
if ($this->version == 1) {
|
42 |
+
// not supported currently.
|
43 |
+
//$request_url = "{$this->url}&api_action=contact_delete_list&api_output={$this->output}&{$params}";
|
44 |
+
} elseif ($this->version == 2) {
|
45 |
+
$request_url = "{$this->url_base}/track/site";
|
46 |
+
}
|
47 |
+
$response = $this->curl($request_url, array(), "GET", "tracking_site_list");
|
48 |
+
return $response;
|
49 |
+
}
|
50 |
+
|
51 |
+
/*
|
52 |
+
* Returns existing tracked events.
|
53 |
+
*/
|
54 |
+
function event_list($params) {
|
55 |
+
if ($this->version == 1) {
|
56 |
+
// not supported currently.
|
57 |
+
//$request_url = "{$this->url}&api_action=contact_delete_list&api_output={$this->output}&{$params}";
|
58 |
+
} elseif ($this->version == 2) {
|
59 |
+
$request_url = "{$this->url_base}/track/event";
|
60 |
+
}
|
61 |
+
$response = $this->curl($request_url, array(), "GET", "tracking_event_list");
|
62 |
+
return $response;
|
63 |
+
}
|
64 |
+
|
65 |
+
/*
|
66 |
+
* Adds a domain to the site tracking whitelist.
|
67 |
+
*/
|
68 |
+
function whitelist($params, $post_data) {
|
69 |
+
// version 2 only.
|
70 |
+
$request_url = "{$this->url_base}/track/site";
|
71 |
+
$response = $this->curl($request_url, $post_data, "PUT", "tracking_whitelist");
|
72 |
+
return $response;
|
73 |
+
}
|
74 |
+
|
75 |
+
/*
|
76 |
+
* Removes a domain from the site tracking whitelist.
|
77 |
+
*/
|
78 |
+
function whitelist_remove($params, $post_data) {
|
79 |
+
// version 2 only.
|
80 |
+
$request_url = "{$this->url_base}/track/site";
|
81 |
+
$response = $this->curl($request_url, $post_data, "DELETE", "tracking_whitelist");
|
82 |
+
return $response;
|
83 |
+
}
|
84 |
+
|
85 |
+
/*
|
86 |
+
* Removes an event.
|
87 |
+
*/
|
88 |
+
function event_remove($params, $post_data) {
|
89 |
+
// version 2 only.
|
90 |
+
$request_url = "{$this->url_base}/track/event";
|
91 |
+
$response = $this->curl($request_url, $post_data, "DELETE", "tracking_event_remove");
|
92 |
+
return $response;
|
93 |
+
}
|
94 |
+
|
95 |
+
/*
|
96 |
+
* Adds a new event.
|
97 |
+
*/
|
98 |
+
function log($params, $post_data) {
|
99 |
+
$request_url = "https://trackcmp.net/event";
|
100 |
+
$post_data["actid"] = $this->track_actid;
|
101 |
+
$post_data["key"] = $this->track_key;
|
102 |
+
$visit_data = array();
|
103 |
+
if ($this->track_email) {
|
104 |
+
$visit_data["email"] = $this->track_email;
|
105 |
+
}
|
106 |
+
if (isset($post_data["visit"])) {
|
107 |
+
$visit_data = array_merge($visit_data, $post_data["visit"]);
|
108 |
+
}
|
109 |
+
if ($visit_data) {
|
110 |
+
$post_data["visit"] = json_encode($visit_data);
|
111 |
+
}
|
112 |
+
$response = $this->curl($request_url, $post_data, "POST", "tracking_log");
|
113 |
+
return $response;
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ActiveCampaign_Subscriptions</name>
|
4 |
-
<version>1.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://www.activecampaign.com/hosted/terms.php">Commercial/Free</license>
|
7 |
<channel>community</channel>
|
@@ -14,11 +14,11 @@
|
|
14 |
3. Have existing customer account newsletter modifications updated in ActiveCampaign.
|
15 |

|
16 |
4. Bulk export/sync all current newsletter contacts to ActiveCampaign in just two clicks!</description>
|
17 |
-
<notes>Supplied missing API wrapper
|
18 |
<authors><author><name>ActiveCampaign, Inc.</name><user>activecampaign</user><email>help@activecampaign.com</email></author></authors>
|
19 |
-
<date>2017-01-
|
20 |
-
<time>
|
21 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="subscriptions.xml" hash="825b33cd139c693c88047584959f49ed"/></dir><dir name="template"><dir name="subscriptions"><file name="grid.phtml" hash="8a554b9d7eb83ade35f7a51b1bd4f840"/><file name="list.phtml" hash="70c40a80ee43596da6ae899f14191e91"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="subscriptions.xml" hash="d0a96f68db976ce1919a664228184e9c"/></dir><dir name="template"><dir name="subscriptions"><file name="subscriptions.phtml" hash="2025758bce03d7b9cfe99029050c7be4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ActiveCampaign_Subscriptions.xml" hash="14eb3a0c9c06bc847b4e8c6ff691c07d"/></dir></target><target name="magecommunity"><dir name="ActiveCampaign"><dir name="Subscriptions"><dir name="activecampaign-api-php"><file name="Account.class.php" hash="b6426c518978bbfb4ae032cb6ddcc29c"/><file name="ActiveCampaign.class.php" hash="
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><extension><name>curl</name><min>7.19.7</min><max>7.28.0</max></extension></required></dependencies>
|
24 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ActiveCampaign_Subscriptions</name>
|
4 |
+
<version>1.5.8</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://www.activecampaign.com/hosted/terms.php">Commercial/Free</license>
|
7 |
<channel>community</channel>
|
14 |
3. Have existing customer account newsletter modifications updated in ActiveCampaign.
|
15 |

|
16 |
4. Bulk export/sync all current newsletter contacts to ActiveCampaign in just two clicks!</description>
|
17 |
+
<notes>Supplied missing API wrapper files</notes>
|
18 |
<authors><author><name>ActiveCampaign, Inc.</name><user>activecampaign</user><email>help@activecampaign.com</email></author></authors>
|
19 |
+
<date>2017-01-24</date>
|
20 |
+
<time>19:17:46</time>
|
21 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="subscriptions.xml" hash="825b33cd139c693c88047584959f49ed"/></dir><dir name="template"><dir name="subscriptions"><file name="grid.phtml" hash="8a554b9d7eb83ade35f7a51b1bd4f840"/><file name="list.phtml" hash="70c40a80ee43596da6ae899f14191e91"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="subscriptions.xml" hash="d0a96f68db976ce1919a664228184e9c"/></dir><dir name="template"><dir name="subscriptions"><file name="subscriptions.phtml" hash="2025758bce03d7b9cfe99029050c7be4"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ActiveCampaign_Subscriptions.xml" hash="14eb3a0c9c06bc847b4e8c6ff691c07d"/></dir></target><target name="magecommunity"><dir name="ActiveCampaign"><dir name="Subscriptions"><dir name="activecampaign-api-php"><file name="Account.class.php" hash="b6426c518978bbfb4ae032cb6ddcc29c"/><file name="ActiveCampaign.class.php" hash="705e067066e3248a96bc275ed8607951"/><file name="Auth.class.php" hash="affc478ccf1622400409d8b623230183"/><file name="Campaign.class.php" hash="229ec1cb98add26450f38aa283f40e5f"/><file name="Connector.class.php" hash="552cfdc0d24c514e7b95a1067381a3f5"/><file name="Design.class.php" hash="53104c2ee4f4d54577f385188ba8c9af"/><file name="Form.class.php" hash="a25adcd9ee9f559ce04bc5ff5445b63f"/><file name="Group.class.php" hash="4712367081b6099bc88440c7ac4c35d0"/><file name="List.class.php" hash="c451709386aaebabeef2d85422e3cf3f"/><file name="Message.class.php" hash="8c072e28994283d0ff7b950df55a6655"/><file name="Contact.class.php" hash="de675e3c692f1b48c871e4af819351d5"/><file name="User.class.php" hash="5a213c94cc6d2a9545856982a38ad26b"/><file name="Webhook.class.php" hash="2933f75823679abd5d178774c8d61682"/><dir name="exceptions"><file name="RequestException.php" hash="0969f54cfa094966cc62744c37b78926"/></dir><file name="Automation.class.php" hash="f58d2c9ed16fce6c838c50160484363e"/><file name="Deal.class.php" hash="39b1cacc347584517d4fb145d060082f"/><file name="Segment.class.php" hash="54a2fbab8de15b87878308ff8efe57f2"/><file name="Settings.class.php" hash="85a2ffea84086486f5fb9f4325fe701d"/><file name="Tag.class.php" hash="5b9ce279313620f71895aab39a9efc53"/><file name="Tracking.class.php" hash="f84aa5361c44203f90ef14bb08d90a9e"/></dir><dir name="Block"><file name="Subscriptions.php" hash="79b032b024a0593188258d4fef3fa733"/><dir name="Adminhtml"><file name="Subscriptions.php" hash="7f9fdec5858ef7a30c1fcd129f13fe67"/><dir name="Subscriptions"><file name="Edit.php" hash="3c464d71d1ad78ae035f810a1248f918"/><file name="Grid.php" hash="b51fc9698c21224488c41826489a8177"/><dir name="Edit"><file name="Form.php" hash="b1eda088b2adf03d69bc1aa3cfb2a00a"/><file name="Tabs.php" hash="4c94ebd27bb6bb0a572131d441afa945"/><dir name="Tab"><file name="Connection.php" hash="230d5a8f70b5de930864b25821290efb"/><file name="Export.php" hash="f65aa906629d6a1b4a17f16014488017"/><file name="List.php" hash="4f2cd4ca088cca5bb2ad1b598c9bc486"/><file name="Form.php" hash="8bf394482cf60f311b8610521888b0d8"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="f6e27a764745bdb55f17fdca49a7fa81"/><dir name="Adminhtml"><file name="SubscriptionsController.php" hash="d551aa4f14c0394168d177f7922de4f6"/></dir></dir><dir name="etc"><file name="config.xml" hash="40947886dd3611ebeb717de55ef8c240"/></dir><dir name="Helper"><file name="Data.php" hash="4b35d91431328ee595132df575a60a2a"/></dir><dir name="Model"><file name="Observer.php" hash="91aead63e3b6e7d4674b20eb5c2efe96"/><file name="Status.php" hash="c35feda8164009341d289074be5612c0"/><file name="Subscriptions.php" hash="76818326ecfd635e574f704003184300"/><dir name="Mysql4"><file name="Subscriptions.php" hash="d112b3f1194a8bb7f329dacb34161941"/><dir name="Subscriptions"><file name="Collection.php" hash="457890390bd29e72dda81d3088ef5a50"/></dir></dir></dir><dir name="sql"><dir name="subscriptions_setup"><file name="mysql4-install-0.1.0.php" hash="9f756eb38486cc878134f07f22f661c0"/></dir></dir></dir></dir></target></contents>
|
22 |
<compatible/>
|
23 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><extension><name>curl</name><min>7.19.7</min><max>7.28.0</max></extension></required></dependencies>
|
24 |
</package>
|