Version Notes
First release
Download this release
Release Info
Developer | ActiveCampaign, Inc. |
Extension | ActiveCampaign_Subscriptions |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Form.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tab/Connection.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tab/Export.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tab/List.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tabs.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Grid.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Subscriptions.php +1 -1
- app/code/{local → community}/ActiveCampaign/Subscriptions/Helper/Data.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Mysql4/Subscriptions.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Mysql4/Subscriptions/Collection.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Observer.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Status.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Subscriptions.php +0 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Account.class.php +69 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/ActiveCampaign.class.php +89 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Auth.class.php +21 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Campaign.class.php +129 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Connector.class.php +134 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Design.class.php +27 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Form.class.php +27 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Group.class.php +51 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/List.class.php +81 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Message.class.php +99 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Subscriber.class.php +79 -0
- app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/User.class.php +67 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/controllers/Adminhtml/SubscriptionsController.php +1 -1
- app/code/{local → community}/ActiveCampaign/Subscriptions/controllers/IndexController.php +0 -0
- app/code/{local → community}/ActiveCampaign/Subscriptions/etc/config.xml +0 -0
- app/code/{local/ActiveCampaign/Subscriptions/sql/subscriptions_setup/mysql4-install-1.0.0.php → community/ActiveCampaign/Subscriptions/sql/subscriptions_setup/mysql4-install-0.1.0.php} +0 -0
- app/etc/modules/ActiveCampaign_Subscriptions.xml +17 -0
- package.xml +4 -4
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Form.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tab/Connection.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tab/Export.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tab/List.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Edit/Tabs.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Adminhtml/Subscriptions/Grid.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Block/Subscriptions.php
RENAMED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
define("ACTIVECAMPAIGN_URL", "");
|
4 |
define("ACTIVECAMPAIGN_API_KEY", "");
|
5 |
-
require_once(Mage::getBaseDir() . "/app/code/
|
6 |
|
7 |
class ActiveCampaign_Subscriptions_Block_Subscriptions extends Mage_Core_Block_Template
|
8 |
{
|
2 |
|
3 |
define("ACTIVECAMPAIGN_URL", "");
|
4 |
define("ACTIVECAMPAIGN_API_KEY", "");
|
5 |
+
require_once(Mage::getBaseDir() . "/app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/ActiveCampaign.class.php");
|
6 |
|
7 |
class ActiveCampaign_Subscriptions_Block_Subscriptions extends Mage_Core_Block_Template
|
8 |
{
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Helper/Data.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Mysql4/Subscriptions.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Mysql4/Subscriptions/Collection.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Observer.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Status.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/Model/Subscriptions.php
RENAMED
File without changes
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Account.class.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Account extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function add($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=account_add&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url, $post_data);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function cancel($params) {
|
20 |
+
$request_url = "{$this->url}&api_action=account_cancel&api_output={$this->output}&{$params}";
|
21 |
+
$response = $this->curl($request_url);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
function edit($params, $post_data) {
|
26 |
+
$request_url = "{$this->url}&api_action=account_edit&api_output={$this->output}";
|
27 |
+
$response = $this->curl($request_url, $post_data);
|
28 |
+
return $response;
|
29 |
+
}
|
30 |
+
|
31 |
+
function list_($params) {
|
32 |
+
$request_url = "{$this->url}&api_action=account_list&api_output={$this->output}&{$params}";
|
33 |
+
$response = $this->curl($request_url);
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
function name_check($params) {
|
38 |
+
$request_url = "{$this->url}&api_action=account_name_check&api_output={$this->output}&{$params}";
|
39 |
+
$response = $this->curl($request_url);
|
40 |
+
return $response;
|
41 |
+
}
|
42 |
+
|
43 |
+
function plans($params) {
|
44 |
+
$request_url = "{$this->url}&api_action=account_plans&api_output={$this->output}&{$params}";
|
45 |
+
$response = $this->curl($request_url);
|
46 |
+
return $response;
|
47 |
+
}
|
48 |
+
|
49 |
+
function status($params) {
|
50 |
+
$request_url = "{$this->url}&api_action=account_status&api_output={$this->output}&{$params}";
|
51 |
+
$response = $this->curl($request_url);
|
52 |
+
return $response;
|
53 |
+
}
|
54 |
+
|
55 |
+
function status_set($params) {
|
56 |
+
$request_url = "{$this->url}&api_action=account_status_set&api_output={$this->output}&{$params}";
|
57 |
+
$response = $this->curl($request_url);
|
58 |
+
return $response;
|
59 |
+
}
|
60 |
+
|
61 |
+
function view() {
|
62 |
+
$request_url = "{$this->url}&api_action=account_view&api_output={$this->output}";
|
63 |
+
$response = $this->curl($request_url);
|
64 |
+
return $response;
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/ActiveCampaign.class.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( !defined("ACTIVECAMPAIGN_URL") || !defined("ACTIVECAMPAIGN_API_KEY") ) {
|
4 |
+
include "config.php";
|
5 |
+
}
|
6 |
+
|
7 |
+
require_once("Connector.class.php");
|
8 |
+
|
9 |
+
class ActiveCampaign extends AC_Connector {
|
10 |
+
|
11 |
+
public $url;
|
12 |
+
public $api_key;
|
13 |
+
|
14 |
+
function __construct($url, $api_key, $api_user = "", $api_pass = "") {
|
15 |
+
$this->url = $url;
|
16 |
+
$this->api_key = $api_key;
|
17 |
+
AC_Connector::__construct($url, $api_key, $api_user, $api_pass);
|
18 |
+
}
|
19 |
+
|
20 |
+
function api($path, $post_data = array()) {
|
21 |
+
// IE: "subscriber/view"
|
22 |
+
$components = explode("/", $path);
|
23 |
+
$component = $components[0];
|
24 |
+
|
25 |
+
if (preg_match("/\?/", $components[1])) {
|
26 |
+
// query params appended to method
|
27 |
+
// IE: subscriber/edit?overwrite=0
|
28 |
+
$method_arr = explode("?", $components[1]);
|
29 |
+
$method = $method_arr[0];
|
30 |
+
$params = $method_arr[1];
|
31 |
+
}
|
32 |
+
else {
|
33 |
+
// just a method provided
|
34 |
+
// IE: "subscriber/view
|
35 |
+
if ( isset($components[1]) ) {
|
36 |
+
$method = $components[1];
|
37 |
+
$params = "";
|
38 |
+
}
|
39 |
+
else {
|
40 |
+
return "Invalid method.";
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
// adjustments
|
45 |
+
if ($component == "list") {
|
46 |
+
// reserved word
|
47 |
+
$component = "list_";
|
48 |
+
}
|
49 |
+
elseif ($component == "branding") {
|
50 |
+
$component = "design";
|
51 |
+
}
|
52 |
+
elseif ($component == "sync") {
|
53 |
+
$component = "subscriber";
|
54 |
+
$method = "sync";
|
55 |
+
}
|
56 |
+
elseif ($component == "singlesignon") {
|
57 |
+
$component = "auth";
|
58 |
+
}
|
59 |
+
|
60 |
+
$class = ucwords($component); // IE: "subscriber" becomes "Subscriber"
|
61 |
+
$class = "AC_" . $class;
|
62 |
+
// IE: new Subscriber();
|
63 |
+
|
64 |
+
$class = new $class($this->url, $this->api_key);
|
65 |
+
// IE: $subscriber->view();
|
66 |
+
|
67 |
+
if ($method == "list") {
|
68 |
+
// reserved word
|
69 |
+
$method = "list_";
|
70 |
+
}
|
71 |
+
|
72 |
+
$response = $class->$method($params, $post_data);
|
73 |
+
return $response;
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
require_once("Account.class.php");
|
79 |
+
require_once("Auth.class.php");
|
80 |
+
require_once("Campaign.class.php");
|
81 |
+
require_once("Design.class.php");
|
82 |
+
require_once("Form.class.php");
|
83 |
+
require_once("Group.class.php");
|
84 |
+
require_once("List.class.php");
|
85 |
+
require_once("Message.class.php");
|
86 |
+
require_once("Subscriber.class.php");
|
87 |
+
require_once("User.class.php");
|
88 |
+
|
89 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Auth.class.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Auth extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function singlesignon($params) {
|
14 |
+
$request_url = "{$this->url}&api_action=singlesignon&api_output={$this->output}&{$params}";
|
15 |
+
$response = $this->curl($request_url);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Campaign.class.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Campaign extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function create($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=campaign_create&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url, $post_data);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function delete_list($params) {
|
20 |
+
$request_url = "{$this->url}&api_action=campaign_delete_list&api_output={$this->output}&{$params}";
|
21 |
+
$response = $this->curl($request_url);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
function delete($params) {
|
26 |
+
$request_url = "{$this->url}&api_action=campaign_delete&api_output={$this->output}&{$params}";
|
27 |
+
$response = $this->curl($request_url);
|
28 |
+
return $response;
|
29 |
+
}
|
30 |
+
|
31 |
+
function list_($params) {
|
32 |
+
$request_url = "{$this->url}&api_action=campaign_list&api_output={$this->output}&{$params}";
|
33 |
+
$response = $this->curl($request_url);
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
function paginator($params) {
|
38 |
+
$request_url = "{$this->url}&api_action=campaign_paginator&api_output={$this->output}&{$params}";
|
39 |
+
$response = $this->curl($request_url);
|
40 |
+
return $response;
|
41 |
+
}
|
42 |
+
|
43 |
+
function report_bounce_list($params) {
|
44 |
+
$request_url = "{$this->url}&api_action=campaign_report_bounce_list&api_output={$this->output}&{$params}";
|
45 |
+
$response = $this->curl($request_url);
|
46 |
+
return $response;
|
47 |
+
}
|
48 |
+
|
49 |
+
function report_bounce_totals($params) {
|
50 |
+
$request_url = "{$this->url}&api_action=campaign_report_bounce_totals&api_output={$this->output}&{$params}";
|
51 |
+
$response = $this->curl($request_url);
|
52 |
+
return $response;
|
53 |
+
}
|
54 |
+
|
55 |
+
function report_forward_list($params) {
|
56 |
+
$request_url = "{$this->url}&api_action=campaign_report_forward_list&api_output={$this->output}&{$params}";
|
57 |
+
$response = $this->curl($request_url);
|
58 |
+
return $response;
|
59 |
+
}
|
60 |
+
|
61 |
+
function report_forward_totals($params) {
|
62 |
+
$request_url = "{$this->url}&api_action=campaign_report_forward_totals&api_output={$this->output}&{$params}";
|
63 |
+
$response = $this->curl($request_url);
|
64 |
+
return $response;
|
65 |
+
}
|
66 |
+
|
67 |
+
function report_link_list($params) {
|
68 |
+
$request_url = "{$this->url}&api_action=campaign_report_link_list&api_output={$this->output}&{$params}";
|
69 |
+
$response = $this->curl($request_url);
|
70 |
+
return $response;
|
71 |
+
}
|
72 |
+
|
73 |
+
function report_link_totals($params) {
|
74 |
+
$request_url = "{$this->url}&api_action=campaign_report_link_totals&api_output={$this->output}&{$params}";
|
75 |
+
$response = $this->curl($request_url);
|
76 |
+
return $response;
|
77 |
+
}
|
78 |
+
|
79 |
+
function report_open_list($params) {
|
80 |
+
$request_url = "{$this->url}&api_action=campaign_report_open_list&api_output={$this->output}&{$params}";
|
81 |
+
$response = $this->curl($request_url);
|
82 |
+
return $response;
|
83 |
+
}
|
84 |
+
|
85 |
+
function report_open_totals($params) {
|
86 |
+
$request_url = "{$this->url}&api_action=campaign_report_open_totals&api_output={$this->output}&{$params}";
|
87 |
+
$response = $this->curl($request_url);
|
88 |
+
return $response;
|
89 |
+
}
|
90 |
+
|
91 |
+
function report_totals($params) {
|
92 |
+
$request_url = "{$this->url}&api_action=campaign_report_totals&api_output={$this->output}&{$params}";
|
93 |
+
$response = $this->curl($request_url);
|
94 |
+
return $response;
|
95 |
+
}
|
96 |
+
|
97 |
+
function report_unopen_list($params) {
|
98 |
+
$request_url = "{$this->url}&api_action=campaign_report_unopen_list&api_output={$this->output}&{$params}";
|
99 |
+
$response = $this->curl($request_url);
|
100 |
+
return $response;
|
101 |
+
}
|
102 |
+
|
103 |
+
function report_unsubscription_list($params) {
|
104 |
+
$request_url = "{$this->url}&api_action=campaign_report_unsubscription_list&api_output={$this->output}&{$params}";
|
105 |
+
$response = $this->curl($request_url);
|
106 |
+
return $response;
|
107 |
+
}
|
108 |
+
|
109 |
+
function report_unsubscription_totals($params) {
|
110 |
+
$request_url = "{$this->url}&api_action=campaign_report_unsubscription_totals&api_output={$this->output}&{$params}";
|
111 |
+
$response = $this->curl($request_url);
|
112 |
+
return $response;
|
113 |
+
}
|
114 |
+
|
115 |
+
function send($params) {
|
116 |
+
$request_url = "{$this->url}&api_action=campaign_send&api_output={$this->output}&{$params}";
|
117 |
+
$response = $this->curl($request_url);
|
118 |
+
return $response;
|
119 |
+
}
|
120 |
+
|
121 |
+
function status($params) {
|
122 |
+
$request_url = "{$this->url}&api_action=campaign_status&api_output={$this->output}&{$params}";
|
123 |
+
$response = $this->curl($request_url);
|
124 |
+
return $response;
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Connector.class.php
ADDED
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Connector {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
public $output = "json";
|
8 |
+
|
9 |
+
function __construct($url, $api_key, $api_user = "", $api_pass = "") {
|
10 |
+
// $api_pass should be md5() already
|
11 |
+
$base = "";
|
12 |
+
if (!preg_match("/https:\/\/www.activecampaign.com/", $url)) {
|
13 |
+
// not a reseller
|
14 |
+
$base = "/admin";
|
15 |
+
}
|
16 |
+
if (preg_match("/\/$/", $url)) {
|
17 |
+
// remove trailing slash
|
18 |
+
$url = substr($url, 0, strlen($url) - 1);
|
19 |
+
}
|
20 |
+
if ($api_key) {
|
21 |
+
$this->url = "{$url}{$base}/api.php?api_key={$api_key}";
|
22 |
+
}
|
23 |
+
elseif ($api_user && $api_pass) {
|
24 |
+
$this->url = "{$url}{$base}/api.php?api_user={$api_user}&api_pass={$api_pass}";
|
25 |
+
}
|
26 |
+
$this->api_key = $api_key;
|
27 |
+
}
|
28 |
+
|
29 |
+
public function credentials_test() {
|
30 |
+
$test_url = "{$this->url}&api_action=group_view&api_output={$this->output}&id=3";
|
31 |
+
$r = $this->curl($test_url);
|
32 |
+
if (is_object($r) && (int)$r->result_code) {
|
33 |
+
// successful
|
34 |
+
$r = true;
|
35 |
+
}
|
36 |
+
else {
|
37 |
+
// failed
|
38 |
+
$r = false;
|
39 |
+
}
|
40 |
+
return $r;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function curl($url, $post_data = array()) {
|
44 |
+
// find the method from the URL
|
45 |
+
$method = preg_match("/api_action=[^&]*/i", $url, $matches);
|
46 |
+
$method = preg_match("/[^=]*$/i", $matches[0], $matches2);
|
47 |
+
$method = $matches2[0];
|
48 |
+
$request = curl_init();
|
49 |
+
curl_setopt($request, CURLOPT_URL, $url);
|
50 |
+
curl_setopt($request, CURLOPT_HEADER, 0);
|
51 |
+
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
52 |
+
if ($post_data) {
|
53 |
+
curl_setopt($request, CURLOPT_POST, 1);
|
54 |
+
$data = "";
|
55 |
+
|
56 |
+
if (is_array($post_data)) {
|
57 |
+
foreach($post_data as $key => $value) {
|
58 |
+
if (is_array($value)) {
|
59 |
+
|
60 |
+
if (is_int($key)) {
|
61 |
+
// array two levels deep
|
62 |
+
foreach ($value as $key_ => $value_) {
|
63 |
+
if (is_array($value_)) {
|
64 |
+
foreach ($value_ as $k => $v) {
|
65 |
+
$k = urlencode($k);
|
66 |
+
$data .= "{$key_}[{$key}][{$k}]=" . urlencode($v) . "&";
|
67 |
+
}
|
68 |
+
}
|
69 |
+
else {
|
70 |
+
$data .= "{$key_}[{$key}]=" . urlencode($value_) . "&";
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
else {
|
75 |
+
// IE: [group] => array(2 => 2, 3 => 3)
|
76 |
+
// normally we just want the key to be a string, IE: ["group[2]"] => 2
|
77 |
+
// but we want to allow passing both formats
|
78 |
+
foreach ($value as $k => $v) {
|
79 |
+
$k = urlencode($k);
|
80 |
+
$data .= "{$key}[{$k}]=" . urlencode($v) . "&";
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
85 |
+
else {
|
86 |
+
$data .= "{$key}=" . urlencode($value) . "&";
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
else {
|
91 |
+
// not an array - perhaps serialized or JSON string?
|
92 |
+
// just pass it as data
|
93 |
+
$data = "data={$post_data}";
|
94 |
+
}
|
95 |
+
|
96 |
+
$data = rtrim($data, "& ");
|
97 |
+
curl_setopt($request, CURLOPT_POSTFIELDS, $data);
|
98 |
+
}
|
99 |
+
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
|
100 |
+
curl_setopt($request, CURLOPT_SSL_VERIFYHOST, 0);
|
101 |
+
curl_setopt($request, CURLOPT_FOLLOWLOCATION, true);
|
102 |
+
$response = curl_exec($request);
|
103 |
+
//dbg($response);
|
104 |
+
$http_code = curl_getinfo($request, CURLINFO_HTTP_CODE);
|
105 |
+
curl_close($request);
|
106 |
+
$object = json_decode($response);
|
107 |
+
if ( !is_object($object) || (!isset($object->result_code) && !isset($object->succeeded)) ) {
|
108 |
+
// add methods that only return a string
|
109 |
+
$string_responses = array("form_html");
|
110 |
+
if (in_array($method, $string_responses)) {
|
111 |
+
return $response;
|
112 |
+
}
|
113 |
+
// something went wrong
|
114 |
+
return "There was an error with the API request (code {$http_code}).";
|
115 |
+
}
|
116 |
+
if (isset($object->result_code)) {
|
117 |
+
$object->success = $object->result_code;
|
118 |
+
if (!(int)$object->result_code) {
|
119 |
+
$object->error = $object->result_message;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
elseif (isset($object->succeeded)) {
|
123 |
+
// some calls return "succeeded" only
|
124 |
+
$object->success = $object->succeeded;
|
125 |
+
if (!(int)$object->succeeded) {
|
126 |
+
$object->error = $object->message;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
return $object;
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Design.class.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Design extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function edit($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=branding_edit&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url, $post_data);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function view($params, $post_data) {
|
20 |
+
$request_url = "{$this->url}&api_action=branding_view&api_output={$this->output}";
|
21 |
+
$response = $this->curl($request_url, $post_data);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Form.class.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Form extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function getforms($params) {
|
14 |
+
$request_url = "{$this->url}&api_action=form_getforms&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function html($params) {
|
20 |
+
$request_url = "{$this->url}&api_action=form_html&api_output={$this->output}&{$params}";
|
21 |
+
$response = $this->curl($request_url);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Group.class.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Group extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function add($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=group_add&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url, $post_data);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function delete_list($params) {
|
20 |
+
$request_url = "{$this->url}&api_action=group_delete_list&api_output={$this->output}&{$params}";
|
21 |
+
$response = $this->curl($request_url);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
function delete($params) {
|
26 |
+
$request_url = "{$this->url}&api_action=group_delete&api_output={$this->output}&{$params}";
|
27 |
+
$response = $this->curl($request_url);
|
28 |
+
return $response;
|
29 |
+
}
|
30 |
+
|
31 |
+
function edit($params, $post_data) {
|
32 |
+
$request_url = "{$this->url}&api_action=group_edit&api_output={$this->output}";
|
33 |
+
$response = $this->curl($request_url, $post_data);
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
function list_($params) {
|
38 |
+
$request_url = "{$this->url}&api_action=group_list&api_output={$this->output}&{$params}";
|
39 |
+
$response = $this->curl($request_url);
|
40 |
+
return $response;
|
41 |
+
}
|
42 |
+
|
43 |
+
function view($params) {
|
44 |
+
$request_url = "{$this->url}&api_action=group_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/List.class.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_List_ extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function add($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=list_add&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url, $post_data);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function delete_list($params) {
|
20 |
+
$request_url = "{$this->url}&api_action=list_delete_list&api_output={$this->output}&{$params}";
|
21 |
+
$response = $this->curl($request_url);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
function delete($params) {
|
26 |
+
$request_url = "{$this->url}&api_action=list_delete&api_output={$this->output}&{$params}";
|
27 |
+
$response = $this->curl($request_url);
|
28 |
+
return $response;
|
29 |
+
}
|
30 |
+
|
31 |
+
function edit($params, $post_data) {
|
32 |
+
$request_url = "{$this->url}&api_action=list_edit&api_output={$this->output}";
|
33 |
+
$response = $this->curl($request_url, $post_data);
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
function field_add($params, $post_data) {
|
38 |
+
$request_url = "{$this->url}&api_action=list_field_add&api_output={$this->output}";
|
39 |
+
$response = $this->curl($request_url, $post_data);
|
40 |
+
return $response;
|
41 |
+
}
|
42 |
+
|
43 |
+
function field_delete($params) {
|
44 |
+
$request_url = "{$this->url}&api_action=list_field_delete&api_output={$this->output}&{$params}";
|
45 |
+
$response = $this->curl($request_url);
|
46 |
+
return $response;
|
47 |
+
}
|
48 |
+
|
49 |
+
function field_edit($params, $post_data) {
|
50 |
+
$request_url = "{$this->url}&api_action=list_field_edit&api_output={$this->output}";
|
51 |
+
$response = $this->curl($request_url, $post_data);
|
52 |
+
return $response;
|
53 |
+
}
|
54 |
+
|
55 |
+
function field_view($params) {
|
56 |
+
$request_url = "{$this->url}&api_action=list_field_view&api_output={$this->output}&{$params}";
|
57 |
+
$response = $this->curl($request_url);
|
58 |
+
return $response;
|
59 |
+
}
|
60 |
+
|
61 |
+
function list_($params) {
|
62 |
+
$request_url = "{$this->url}&api_action=list_list&api_output={$this->output}&{$params}";
|
63 |
+
$response = $this->curl($request_url);
|
64 |
+
return $response;
|
65 |
+
}
|
66 |
+
|
67 |
+
function paginator($params) {
|
68 |
+
$request_url = "{$this->url}&api_action=list_paginator&api_output={$this->output}&{$params}";
|
69 |
+
$response = $this->curl($request_url);
|
70 |
+
return $response;
|
71 |
+
}
|
72 |
+
|
73 |
+
function view($params) {
|
74 |
+
$request_url = "{$this->url}&api_action=list_view&api_output={$this->output}&{$params}";
|
75 |
+
$response = $this->curl($request_url);
|
76 |
+
return $response;
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Message.class.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Message extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function add($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=message_add&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url, $post_data);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function delete_list($params) {
|
20 |
+
$request_url = "{$this->url}&api_action=message_delete_list&api_output={$this->output}&{$params}";
|
21 |
+
$response = $this->curl($request_url);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
function delete($params) {
|
26 |
+
$request_url = "{$this->url}&api_action=message_delete&api_output={$this->output}&{$params}";
|
27 |
+
$response = $this->curl($request_url);
|
28 |
+
return $response;
|
29 |
+
}
|
30 |
+
|
31 |
+
function edit($params, $post_data) {
|
32 |
+
$request_url = "{$this->url}&api_action=message_edit&api_output={$this->output}";
|
33 |
+
$response = $this->curl($request_url, $post_data);
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
function list_($params) {
|
38 |
+
$request_url = "{$this->url}&api_action=message_list&api_output={$this->output}&{$params}";
|
39 |
+
$response = $this->curl($request_url);
|
40 |
+
return $response;
|
41 |
+
}
|
42 |
+
|
43 |
+
function template_add($params, $post_data) {
|
44 |
+
$request_url = "{$this->url}&api_action=message_template_add&api_output={$this->output}";
|
45 |
+
$response = $this->curl($request_url, $post_data);
|
46 |
+
return $response;
|
47 |
+
}
|
48 |
+
|
49 |
+
function template_delete_list($params) {
|
50 |
+
$request_url = "{$this->url}&api_action=message_template_delete_list&api_output={$this->output}&{$params}";
|
51 |
+
$response = $this->curl($request_url);
|
52 |
+
return $response;
|
53 |
+
}
|
54 |
+
|
55 |
+
function template_delete($params) {
|
56 |
+
$request_url = "{$this->url}&api_action=message_template_delete&api_output={$this->output}&{$params}";
|
57 |
+
$response = $this->curl($request_url);
|
58 |
+
return $response;
|
59 |
+
}
|
60 |
+
|
61 |
+
function template_edit($params, $post_data) {
|
62 |
+
$request_url = "{$this->url}&api_action=message_template_edit&api_output={$this->output}";
|
63 |
+
$response = $this->curl($request_url, $post_data);
|
64 |
+
return $response;
|
65 |
+
}
|
66 |
+
|
67 |
+
function template_export($params) {
|
68 |
+
$request_url = "{$this->url}&api_action=message_template_export&api_output={$this->output}&{$params}";
|
69 |
+
$response = $this->curl($request_url);
|
70 |
+
return $response;
|
71 |
+
}
|
72 |
+
|
73 |
+
function template_import($params, $post_data) {
|
74 |
+
$request_url = "{$this->url}&api_action=message_template_import&api_output={$this->output}";
|
75 |
+
$response = $this->curl($request_url, $post_data);
|
76 |
+
return $response;
|
77 |
+
}
|
78 |
+
|
79 |
+
function template_list($params) {
|
80 |
+
$request_url = "{$this->url}&api_action=message_template_list&api_output={$this->output}&{$params}";
|
81 |
+
$response = $this->curl($request_url);
|
82 |
+
return $response;
|
83 |
+
}
|
84 |
+
|
85 |
+
function template_view($params) {
|
86 |
+
$request_url = "{$this->url}&api_action=message_template_view&api_output={$this->output}&{$params}";
|
87 |
+
$response = $this->curl($request_url);
|
88 |
+
return $response;
|
89 |
+
}
|
90 |
+
|
91 |
+
function view($params) {
|
92 |
+
$request_url = "{$this->url}&api_action=message_view&api_output={$this->output}&{$params}";
|
93 |
+
$response = $this->curl($request_url);
|
94 |
+
return $response;
|
95 |
+
}
|
96 |
+
|
97 |
+
}
|
98 |
+
|
99 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/Subscriber.class.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_Subscriber extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function add($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=subscriber_add&api_output={$this->output}";
|
15 |
+
if ($params) $request_url .= "&{$params}";
|
16 |
+
$response = $this->curl($request_url, $post_data);
|
17 |
+
return $response;
|
18 |
+
}
|
19 |
+
|
20 |
+
function delete_list($params) {
|
21 |
+
$request_url = "{$this->url}&api_action=subscriber_delete_list&api_output={$this->output}&{$params}";
|
22 |
+
$response = $this->curl($request_url);
|
23 |
+
return $response;
|
24 |
+
}
|
25 |
+
|
26 |
+
function delete($params) {
|
27 |
+
$request_url = "{$this->url}&api_action=subscriber_delete&api_output={$this->output}&{$params}";
|
28 |
+
$response = $this->curl($request_url);
|
29 |
+
return $response;
|
30 |
+
}
|
31 |
+
|
32 |
+
function edit($params, $post_data) {
|
33 |
+
$request_url = "{$this->url}&api_action=subscriber_edit&api_output={$this->output}&{$params}";
|
34 |
+
$response = $this->curl($request_url, $post_data);
|
35 |
+
return $response;
|
36 |
+
}
|
37 |
+
|
38 |
+
function list_($params) {
|
39 |
+
$request_url = "{$this->url}&api_action=subscriber_list&api_output={$this->output}&{$params}";
|
40 |
+
$response = $this->curl($request_url);
|
41 |
+
return $response;
|
42 |
+
}
|
43 |
+
|
44 |
+
function paginator($params) {
|
45 |
+
$request_url = "{$this->url}&api_action=subscriber_paginator&api_output={$this->output}&{$params}";
|
46 |
+
$response = $this->curl($request_url);
|
47 |
+
return $response;
|
48 |
+
}
|
49 |
+
|
50 |
+
function sync($params, $post_data) {
|
51 |
+
$request_url = "{$this->url}&api_action=subscriber_sync&api_output={$this->output}";
|
52 |
+
if ($params) $request_url .= "&{$params}";
|
53 |
+
$response = $this->curl($request_url, $post_data);
|
54 |
+
return $response;
|
55 |
+
}
|
56 |
+
|
57 |
+
function view($params) {
|
58 |
+
// can be a subscriber ID, email, or hash
|
59 |
+
if (preg_match("/^email=/", $params)) {
|
60 |
+
$action = "subscriber_view_email";
|
61 |
+
}
|
62 |
+
elseif (preg_match("/^hash=/", $params)) {
|
63 |
+
$action = "subscriber_view_hash";
|
64 |
+
}
|
65 |
+
elseif (preg_match("/^id=/", $params)) {
|
66 |
+
$action = "subscriber_view";
|
67 |
+
}
|
68 |
+
else {
|
69 |
+
// default
|
70 |
+
$action = "subscriber_view";
|
71 |
+
}
|
72 |
+
$request_url = "{$this->url}&api_action={$action}&api_output={$this->output}&{$params}";
|
73 |
+
$response = $this->curl($request_url);
|
74 |
+
return $response;
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
?>
|
app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/User.class.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AC_User extends ActiveCampaign {
|
4 |
+
|
5 |
+
public $url;
|
6 |
+
public $api_key;
|
7 |
+
|
8 |
+
function __construct($url, $api_key) {
|
9 |
+
$this->url = $url;
|
10 |
+
$this->api_key = $api_key;
|
11 |
+
}
|
12 |
+
|
13 |
+
function add($params, $post_data) {
|
14 |
+
$request_url = "{$this->url}&api_action=user_add&api_output={$this->output}";
|
15 |
+
$response = $this->curl($request_url, $post_data);
|
16 |
+
return $response;
|
17 |
+
}
|
18 |
+
|
19 |
+
function delete_list($params) {
|
20 |
+
$request_url = "{$this->url}&api_action=user_delete_list&api_output={$this->output}&{$params}";
|
21 |
+
$response = $this->curl($request_url);
|
22 |
+
return $response;
|
23 |
+
}
|
24 |
+
|
25 |
+
function delete($params) {
|
26 |
+
$request_url = "{$this->url}&api_action=user_delete&api_output={$this->output}&{$params}";
|
27 |
+
$response = $this->curl($request_url);
|
28 |
+
return $response;
|
29 |
+
}
|
30 |
+
|
31 |
+
function edit($params, $post_data) {
|
32 |
+
$request_url = "{$this->url}&api_action=user_edit&api_output={$this->output}";
|
33 |
+
$response = $this->curl($request_url, $post_data);
|
34 |
+
return $response;
|
35 |
+
}
|
36 |
+
|
37 |
+
function list_($params) {
|
38 |
+
$request_url = "{$this->url}&api_action=user_list&api_output={$this->output}&{$params}";
|
39 |
+
$response = $this->curl($request_url);
|
40 |
+
return $response;
|
41 |
+
}
|
42 |
+
|
43 |
+
function me() {
|
44 |
+
$request_url = "{$this->url}&api_action=user_me&api_output={$this->output}";
|
45 |
+
$response = $this->curl($request_url);
|
46 |
+
return $response;
|
47 |
+
}
|
48 |
+
|
49 |
+
function view($params) {
|
50 |
+
// can be a user ID, email, or username
|
51 |
+
if (preg_match("/^email=/", $params)) {
|
52 |
+
$action = "user_view_email";
|
53 |
+
}
|
54 |
+
elseif (preg_match("/^username=/", $params)) {
|
55 |
+
$action = "user_view_username";
|
56 |
+
}
|
57 |
+
elseif (preg_match("/^id=/", $params)) {
|
58 |
+
$action = "user_view";
|
59 |
+
}
|
60 |
+
$request_url = "{$this->url}&api_action={$action}&api_output={$this->output}&{$params}";
|
61 |
+
$response = $this->curl($request_url);
|
62 |
+
return $response;
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
?>
|
app/code/{local → community}/ActiveCampaign/Subscriptions/controllers/Adminhtml/SubscriptionsController.php
RENAMED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
define("ACTIVECAMPAIGN_URL", "");
|
4 |
define("ACTIVECAMPAIGN_API_KEY", "");
|
5 |
-
require_once(Mage::getBaseDir() . "/app/code/
|
6 |
|
7 |
class ActiveCampaign_Subscriptions_Adminhtml_SubscriptionsController extends Mage_Adminhtml_Controller_action
|
8 |
{
|
2 |
|
3 |
define("ACTIVECAMPAIGN_URL", "");
|
4 |
define("ACTIVECAMPAIGN_API_KEY", "");
|
5 |
+
require_once(Mage::getBaseDir() . "/app/code/community/ActiveCampaign/Subscriptions/activecampaign-api-php/ActiveCampaign.class.php");
|
6 |
|
7 |
class ActiveCampaign_Subscriptions_Adminhtml_SubscriptionsController extends Mage_Adminhtml_Controller_action
|
8 |
{
|
app/code/{local → community}/ActiveCampaign/Subscriptions/controllers/IndexController.php
RENAMED
File without changes
|
app/code/{local → community}/ActiveCampaign/Subscriptions/etc/config.xml
RENAMED
File without changes
|
app/code/{local/ActiveCampaign/Subscriptions/sql/subscriptions_setup/mysql4-install-1.0.0.php → community/ActiveCampaign/Subscriptions/sql/subscriptions_setup/mysql4-install-0.1.0.php}
RENAMED
File without changes
|
app/etc/modules/ActiveCampaign_Subscriptions.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category ActiveCampaign
|
5 |
+
* @package ActiveCampaign_Subscriptions
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<ActiveCampaign_Subscriptions>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
</ActiveCampaign_Subscriptions>
|
16 |
+
</modules>
|
17 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ActiveCampaign_Subscriptions</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://www.activecampaign.com/hosted/terms.php">Commercial/Free</license>
|
7 |
<channel>community</channel>
|
@@ -16,9 +16,9 @@
|
|
16 |
4. Bulk export/sync all current newsletter subscribers to ActiveCampaign in just two clicks!</description>
|
17 |
<notes>First release</notes>
|
18 |
<authors><author><name>ActiveCampaign, Inc.</name><user>activecampaign</user><email>matt@activecampaign.com</email></author></authors>
|
19 |
-
<date>2012-11-
|
20 |
-
<time>
|
21 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="subscriptions.xml" hash="18bfe6676477fc84b488277025d42568"/></dir><dir name="template"><dir name="subscriptions"><file name="grid.phtml" hash="5479475e2a96a006da97e35b31efeb02"/><file name="list.phtml" hash="d90e444079a30e2337df2cbcf10aa35f"/></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="
|
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.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://www.activecampaign.com/hosted/terms.php">Commercial/Free</license>
|
7 |
<channel>community</channel>
|
16 |
4. Bulk export/sync all current newsletter subscribers to ActiveCampaign in just two clicks!</description>
|
17 |
<notes>First release</notes>
|
18 |
<authors><author><name>ActiveCampaign, Inc.</name><user>activecampaign</user><email>matt@activecampaign.com</email></author></authors>
|
19 |
+
<date>2012-11-13</date>
|
20 |
+
<time>14:28:24</time>
|
21 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="subscriptions.xml" hash="18bfe6676477fc84b488277025d42568"/></dir><dir name="template"><dir name="subscriptions"><file name="grid.phtml" hash="5479475e2a96a006da97e35b31efeb02"/><file name="list.phtml" hash="d90e444079a30e2337df2cbcf10aa35f"/></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="magecommunity"><dir name="ActiveCampaign"><dir name="Subscriptions"><dir name="Block"><file name="Subscriptions.php" hash="ca3ca3be2fc80d23528010f2b6a5b2c9"/><dir name="Adminhtml"><file name="Subscriptions.php" hash="c26f6255fa14a3a5b81828425041ec2c"/><dir name="Subscriptions"><file name="Edit.php" hash="3dba9bad67c86cea8d6bb9e40898d5fb"/><file name="Grid.php" hash="b51fc9698c21224488c41826489a8177"/><dir name="Edit"><file name="Form.php" hash="b1eda088b2adf03d69bc1aa3cfb2a00a"/><file name="Tabs.php" hash="19d7771dca320416c7c27e0d8f6c9f36"/><dir name="Tab"><file name="Connection.php" hash="230d5a8f70b5de930864b25821290efb"/><file name="Export.php" hash="f65aa906629d6a1b4a17f16014488017"/><file name="List.php" hash="bcde9bfb9254caa3774e9b5d4aa85e14"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="f6e27a764745bdb55f17fdca49a7fa81"/><dir name="Adminhtml"><file name="SubscriptionsController.php" hash="9546c0b5f3ada863717e9eae7574d92c"/></dir></dir><dir name="etc"><file name="config.xml" hash="a3bacb007c725735eee61c9a2bae5475"/></dir><dir name="Helper"><file name="Data.php" hash="4b35d91431328ee595132df575a60a2a"/></dir><dir name="Model"><file name="Observer.php" hash="fce592221a9113aa5ae356da79b31a6e"/><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="11028fce8cd9cbf9cff09dd7575453dd"/></dir></dir><dir name="activecampaign-api-php"><file name="Account.class.php" hash="eb5d6e647e0c5d6db2e4291bd2e4c24a"/><file name="ActiveCampaign.class.php" hash="142e5af0a49a81e0d7650278419c14a2"/><file name="Auth.class.php" hash="6cf45573aaa8aa4b158f88d80bb9ac7d"/><file name="Campaign.class.php" hash="3db78bd78995f6d4c42d80d26300ebe3"/><file name="Connector.class.php" hash="4d7077303c4c72bf3356270247dfef8d"/><file name="Design.class.php" hash="113a72a83d979fbe80b5ef3acd085a86"/><file name="Form.class.php" hash="d487177b0d108106ad9c35d8583266d2"/><file name="Group.class.php" hash="ce0792f8032ec09b8ca6636ffd14cdc3"/><file name="List.class.php" hash="ad045005e67f7724421b98d44b3464bd"/><file name="Message.class.php" hash="da8e027327b10dcbbd18a94a1a9730b0"/><file name="Subscriber.class.php" hash="132a8edd2d571f5064855e467e916d48"/><file name="User.class.php" hash="4732c709aedb1cc0448acafd4c956c29"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ActiveCampaign_Subscriptions.xml" hash="14eb3a0c9c06bc847b4e8c6ff691c07d"/></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>
|