Version Notes
- Automatic synchronization between your Magento email subscriber list and one of your Mailigen email lists. When users subscribe to the newsletter in Magento, they will be added to the selected Mailigen contact list.
- Two-way synchronization when it comes to subscriber status change. When users unsubscribe from your Magento list, they will be removed also from your Mailigen list. And vice versa, users will be removed from your Magento list when unsubscribed from your Mailigen list.
Download this release
Release Info
Developer | Thomas Nelson |
Extension | Mailigen_Synchronizer |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Mailigen/Synchronizer/Block/Newsletter/Subscriber/Grid.php +37 -0
- app/code/community/Mailigen/Synchronizer/Helper/Data.php +3 -0
- app/code/community/Mailigen/Synchronizer/Model/List.php +34 -0
- app/code/community/Mailigen/Synchronizer/Model/Mailigen.php +39 -0
- app/code/community/Mailigen/Synchronizer/Model/Newsletter/Subscriber.php +175 -0
- app/code/community/Mailigen/Synchronizer/Model/Observer.php +148 -0
- app/code/community/Mailigen/Synchronizer/api/MGAPI.class.php +1627 -0
- app/code/community/Mailigen/Synchronizer/controllers/Adminhtml/MailigenController.php +13 -0
- app/code/community/Mailigen/Synchronizer/etc/config.xml +97 -0
- app/code/community/Mailigen/Synchronizer/etc/system.xml +90 -0
- app/etc/modules/Mailigen_Synchronizer.xml +9 -0
- package.xml +28 -0
app/code/community/Mailigen/Synchronizer/Block/Newsletter/Subscriber/Grid.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Block_Newsletter_Subscriber_Grid extends Mage_Adminhtml_Block_Newsletter_Subscriber_Grid
|
4 |
+
{
|
5 |
+
protected function _prepareLayout()
|
6 |
+
{
|
7 |
+
|
8 |
+
$this->setChild('sync_button',
|
9 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
10 |
+
->setData(array(
|
11 |
+
'label' => Mage::helper('adminhtml')->__('Bulk synchronize with Mailigen'),
|
12 |
+
'onclick' => "setLocation('{$this->getUrl('*/mailigen/sync')}')",
|
13 |
+
'class' => 'task'
|
14 |
+
))
|
15 |
+
);
|
16 |
+
|
17 |
+
return parent::_prepareLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
public function getSyncButtonHtml()
|
21 |
+
{
|
22 |
+
return $this->getChildHtml('sync_button');
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getMainButtonsHtml()
|
26 |
+
{
|
27 |
+
$html = parent::getMainButtonsHtml();
|
28 |
+
|
29 |
+
$enabled = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_status');
|
30 |
+
|
31 |
+
if( $enabled ) {
|
32 |
+
$html.= $this->getSyncButtonHtml();
|
33 |
+
}
|
34 |
+
|
35 |
+
return $html;
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Mailigen/Synchronizer/Helper/Data.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Helper_Data extends Mage_Core_Helper_Abstract {}
|
app/code/community/Mailigen/Synchronizer/Model/List.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mailigen_Synchronizer_Model_List extends Mage_Core_Model_Abstract {
|
3 |
+
|
4 |
+
public function _construct()
|
5 |
+
{
|
6 |
+
parent::_construct();
|
7 |
+
$this->_init('mailigen_synchronizer/list');
|
8 |
+
}
|
9 |
+
|
10 |
+
public function toOptionArray()
|
11 |
+
{
|
12 |
+
|
13 |
+
$mgapi = Mage::getModuleDir('','Mailigen_Synchronizer') . DS . 'api' . DS . 'MGAPI.class.php';
|
14 |
+
$apikey = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_api_key');
|
15 |
+
require_once( $mgapi );
|
16 |
+
|
17 |
+
$api = new MGAPI($apikey);
|
18 |
+
|
19 |
+
$lists = $api->lists();
|
20 |
+
|
21 |
+
//print_r($lists);
|
22 |
+
|
23 |
+
if( !$api->errorCode && $lists){
|
24 |
+
$array[] = array('label' => '--Create a new list--','value'=>'');
|
25 |
+
foreach($lists as $list){
|
26 |
+
$array[] = array('label'=>$list['name'],'value'=>$list['id']);
|
27 |
+
}
|
28 |
+
return $array;
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Mailigen/Synchronizer/Model/Mailigen.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Model_Mailigen extends Mage_Core_Model_Abstract {
|
4 |
+
|
5 |
+
public function sync(){
|
6 |
+
$mgapi = Mage::getModuleDir('','Mailigen_Synchronizer') . DS . 'api' . DS . 'MGAPI.class.php';
|
7 |
+
$apikey = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_api_key');
|
8 |
+
$listid = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_list');
|
9 |
+
|
10 |
+
require_once( $mgapi );
|
11 |
+
$api = new MGAPI($apikey);
|
12 |
+
|
13 |
+
$collection = Mage::getResourceSingleton('newsletter/subscriber_collection');
|
14 |
+
$collection->showCustomerInfo(true)->addSubscriberTypeField()->showStoreInfo();
|
15 |
+
|
16 |
+
$batch = array();
|
17 |
+
foreach($collection as $subscriber){
|
18 |
+
|
19 |
+
$batch[] = array(
|
20 |
+
'EMAIL'=>$subscriber->getSubscriberEmail(),
|
21 |
+
'FNAME'=>$subscriber->getCustomerFirstname(),
|
22 |
+
'LNAME'=>$subscriber->getCustomerLastname()
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
$double_optin = false;
|
27 |
+
$update_existing = true;
|
28 |
+
$retval = $api->listBatchSubscribe($listid, $batch, $double_optin, $update_existing);
|
29 |
+
|
30 |
+
if ($api->errorCode){
|
31 |
+
Mage::getSingleton('adminhtml/session')->addError( "Something went wrong" );
|
32 |
+
Mage::log( "Mailigen API Error: " . "Code=".$api->errorCode. " Msg=".$api->errorMessage );
|
33 |
+
} else{
|
34 |
+
Mage::getSingleton('adminhtml/session')->addSuccess( "Your contacts have been syncronized" );
|
35 |
+
Mage::log("Returned: ".$retval);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
app/code/community/Mailigen/Synchronizer/Model/Newsletter/Subscriber.php
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Model_Newsletter_Subscriber extends Mage_Newsletter_Model_Subscriber {
|
4 |
+
|
5 |
+
public function subscribe($email) {
|
6 |
+
$this->loadByEmail($email);
|
7 |
+
$customerSession = Mage::getSingleton('customer/session');
|
8 |
+
|
9 |
+
if(!$this->getId()) {
|
10 |
+
$this->setSubscriberConfirmCode($this->randomSequence());
|
11 |
+
}
|
12 |
+
|
13 |
+
$isConfirmNeed = (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
|
14 |
+
$isOwnSubscribes = false;
|
15 |
+
$ownerId = Mage::getModel('customer/customer')
|
16 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
17 |
+
->loadByEmail($email)
|
18 |
+
->getId();
|
19 |
+
$isSubscribeOwnEmail = $customerSession->isLoggedIn() && $ownerId == $customerSession->getId();
|
20 |
+
|
21 |
+
if (!$this->getId() || $this->getStatus() == self::STATUS_UNSUBSCRIBED
|
22 |
+
|| $this->getStatus() == self::STATUS_NOT_ACTIVE
|
23 |
+
) {
|
24 |
+
if ($isConfirmNeed === true) {
|
25 |
+
// if user subscribes own login email - confirmation is not needed
|
26 |
+
$isOwnSubscribes = $isSubscribeOwnEmail;
|
27 |
+
if ($isOwnSubscribes == true){
|
28 |
+
$this->setStatus(self::STATUS_SUBSCRIBED);
|
29 |
+
} else {
|
30 |
+
$this->setStatus(self::STATUS_NOT_ACTIVE);
|
31 |
+
}
|
32 |
+
} else {
|
33 |
+
$this->setStatus(self::STATUS_SUBSCRIBED);
|
34 |
+
}
|
35 |
+
$this->setSubscriberEmail($email);
|
36 |
+
}
|
37 |
+
|
38 |
+
if ($isSubscribeOwnEmail) {
|
39 |
+
$this->setStoreId($customerSession->getCustomer()->getStoreId());
|
40 |
+
$this->setCustomerId($customerSession->getCustomerId());
|
41 |
+
} else {
|
42 |
+
$this->setStoreId(Mage::app()->getStore()->getId());
|
43 |
+
$this->setCustomerId(0);
|
44 |
+
}
|
45 |
+
|
46 |
+
$this->setIsStatusChanged(true);
|
47 |
+
|
48 |
+
try {
|
49 |
+
$this->save();
|
50 |
+
|
51 |
+
|
52 |
+
$send_flag = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_default_emails');
|
53 |
+
if ( !$send_flag ) {
|
54 |
+
if ($isConfirmNeed === true
|
55 |
+
&& $isOwnSubscribes === false
|
56 |
+
) {
|
57 |
+
$this->sendConfirmationRequestEmail();
|
58 |
+
} else {
|
59 |
+
$this->sendConfirmationSuccessEmail();
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
return $this->getStatus();
|
65 |
+
} catch (Exception $e) {
|
66 |
+
throw new Exception($e->getMessage());
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Unsubscribes loaded subscription
|
72 |
+
*
|
73 |
+
*/
|
74 |
+
public function unsubscribe()
|
75 |
+
{
|
76 |
+
if ($this->hasCheckCode() && $this->getCode() != $this->getCheckCode()) {
|
77 |
+
Mage::throwException(Mage::helper('newsletter')->__('Invalid subscription confirmation code.'));
|
78 |
+
}
|
79 |
+
|
80 |
+
$this->setSubscriberStatus(self::STATUS_UNSUBSCRIBED)
|
81 |
+
->save();
|
82 |
+
|
83 |
+
$send_flag = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_default_emails');
|
84 |
+
if ( !$send_flag ) {
|
85 |
+
$this->sendUnsubscriptionEmail();
|
86 |
+
}
|
87 |
+
|
88 |
+
return $this;
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Saving customer subscription status
|
93 |
+
*
|
94 |
+
* @param Mage_Customer_Model_Customer $customer
|
95 |
+
* @return Mage_Newsletter_Model_Subscriber
|
96 |
+
*/
|
97 |
+
public function subscribeCustomer($customer)
|
98 |
+
{
|
99 |
+
$this->loadByCustomer($customer);
|
100 |
+
|
101 |
+
if ($customer->getImportMode()) {
|
102 |
+
$this->setImportMode(true);
|
103 |
+
}
|
104 |
+
|
105 |
+
if (!$customer->getIsSubscribed() && !$this->getId()) {
|
106 |
+
// If subscription flag not set or customer is not a subscriber
|
107 |
+
// and no subscribe below
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
if(!$this->getId()) {
|
112 |
+
$this->setSubscriberConfirmCode($this->randomSequence());
|
113 |
+
}
|
114 |
+
|
115 |
+
/*
|
116 |
+
* Logical mismatch between customer registration confirmation code and customer password confirmation
|
117 |
+
*/
|
118 |
+
$confirmation = null;
|
119 |
+
if ($customer->isConfirmationRequired() && ($customer->getConfirmation() != $customer->getPassword())) {
|
120 |
+
$confirmation = $customer->getConfirmation();
|
121 |
+
}
|
122 |
+
|
123 |
+
$sendInformationEmail = false;
|
124 |
+
if ($customer->hasIsSubscribed()) {
|
125 |
+
$status = $customer->getIsSubscribed()
|
126 |
+
? (!is_null($confirmation) ? self::STATUS_UNCONFIRMED : self::STATUS_SUBSCRIBED)
|
127 |
+
: self::STATUS_UNSUBSCRIBED;
|
128 |
+
/**
|
129 |
+
* If subscription status has been changed then send email to the customer
|
130 |
+
*/
|
131 |
+
if ($status != self::STATUS_UNCONFIRMED && $status != $this->getStatus()) {
|
132 |
+
$sendInformationEmail = true;
|
133 |
+
}
|
134 |
+
} elseif (($this->getStatus() == self::STATUS_UNCONFIRMED) && (is_null($confirmation))) {
|
135 |
+
$status = self::STATUS_SUBSCRIBED;
|
136 |
+
$sendInformationEmail = true;
|
137 |
+
} else {
|
138 |
+
$status = ($this->getStatus() == self::STATUS_NOT_ACTIVE ? self::STATUS_UNSUBSCRIBED : $this->getStatus());
|
139 |
+
}
|
140 |
+
|
141 |
+
if($status != $this->getStatus()) {
|
142 |
+
$this->setIsStatusChanged(true);
|
143 |
+
}
|
144 |
+
|
145 |
+
$this->setStatus($status);
|
146 |
+
|
147 |
+
if(!$this->getId()) {
|
148 |
+
$storeId = $customer->getStoreId();
|
149 |
+
if ($customer->getStoreId() == 0) {
|
150 |
+
$storeId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
|
151 |
+
}
|
152 |
+
$this->setStoreId($storeId)
|
153 |
+
->setCustomerId($customer->getId())
|
154 |
+
->setEmail($customer->getEmail());
|
155 |
+
} else {
|
156 |
+
$this->setStoreId($customer->getStoreId())
|
157 |
+
->setEmail($customer->getEmail());
|
158 |
+
}
|
159 |
+
|
160 |
+
$this->save();
|
161 |
+
$sendSubscription = $customer->getData('sendSubscription') || $sendInformationEmail;
|
162 |
+
if (is_null($sendSubscription) xor $sendSubscription) {
|
163 |
+
|
164 |
+
$send_flag = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_default_emails');
|
165 |
+
if ( !$send_flag ) {
|
166 |
+
if ($this->getIsStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
|
167 |
+
$this->sendUnsubscriptionEmail();
|
168 |
+
} elseif ($this->getIsStatusChanged() && $status == self::STATUS_SUBSCRIBED) {
|
169 |
+
$this->sendConfirmationSuccessEmail();
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
return $this;
|
174 |
+
}
|
175 |
+
}
|
app/code/community/Mailigen/Synchronizer/Model/Observer.php
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Model_Observer {
|
4 |
+
|
5 |
+
public function newsletter_subscriber_create_after( Varien_Event_Observer $observer ){
|
6 |
+
|
7 |
+
$enabled = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_status');
|
8 |
+
$delete_on_unsubscribe = Mage::getStoreConfig('mailigen_settings/mailigen_unsubscribe_group/mailigen_unsubscribe_delete');
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
$subscriber = $observer->getDataObject();
|
13 |
+
$data = $subscriber->getData();
|
14 |
+
$statusChange = $subscriber->getIsStatusChanged();
|
15 |
+
|
16 |
+
if( $enabled && $statusChange == true ) {
|
17 |
+
|
18 |
+
$mgapi = Mage::getModuleDir('','Mailigen_Synchronizer') . DS . 'api' . DS . 'MGAPI.class.php';
|
19 |
+
$apikey = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_api_key');
|
20 |
+
$listid = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_list');
|
21 |
+
|
22 |
+
require_once( $mgapi );
|
23 |
+
$api = new MGAPI($apikey);
|
24 |
+
|
25 |
+
$email_address = $observer['subscriber']->getSubscriberEmail();
|
26 |
+
$merge_vars = array('EMAIL'=>$email_address); // or $merge_vars = array();
|
27 |
+
$email_type = 'html';
|
28 |
+
$double_optin = false;
|
29 |
+
$update_existing = true;
|
30 |
+
|
31 |
+
|
32 |
+
//If mailigen transational emails are set from admin.
|
33 |
+
$send_flag = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_default_emails');
|
34 |
+
|
35 |
+
if( $send_flag ){
|
36 |
+
$send_welcome = true;
|
37 |
+
$send_goodbye = true;
|
38 |
+
}else{
|
39 |
+
$send_welcome = false;
|
40 |
+
$send_goodbye = false;
|
41 |
+
}
|
42 |
+
|
43 |
+
//if is a customer we also grab firstname and lastname
|
44 |
+
if( $observer['subscriber']->getCustomerId() ){
|
45 |
+
$customer = Mage::getModel("customer/customer");
|
46 |
+
$customer->load( $observer['subscriber']->getCustomerId() );
|
47 |
+
|
48 |
+
$merge_vars['FNAME'] = $customer->getFirstname();
|
49 |
+
$merge_vars['LNAME'] = $customer->getLastname();
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
Mage::log( "Subscribe: " . $send_flag );
|
54 |
+
|
55 |
+
if ($data['subscriber_status'] === 1) {
|
56 |
+
$retval = $api->listSubscribe($listid, $email_address, $merge_vars, $email_type, $double_optin, $update_existing, $send_welcome);
|
57 |
+
}else{
|
58 |
+
$retval = $api->listUnsubscribe($listid, $email_address, $delete_member, $send_goodbye, $send_notify);
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
if ($api->errorCode){
|
64 |
+
Mage::log( "Mailigen API Error: " . "Code=".$api->errorCode. " Msg=".$api->errorMessage );
|
65 |
+
} else{
|
66 |
+
Mage::log("Returned: ".$retval);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return $observer;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function daily_sync( Varien_Event_Observer $observer ){
|
74 |
+
$autosync = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_default_emails');
|
75 |
+
if( $autosync == 'yes' ) {
|
76 |
+
$mailigen = Mage::getModel('mailigen_synchronizer/mailigen');
|
77 |
+
$mailigen->sync();
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
public function admin_system_config_changed_section_mailigen_settings ( Varien_Event_Observer $observer ){
|
82 |
+
|
83 |
+
$new_list_name = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_new_list');
|
84 |
+
$notify_to = Mage::getStoreConfig('trans_email/ident_general/email');
|
85 |
+
|
86 |
+
if( $new_list_name ) {
|
87 |
+
|
88 |
+
//Get the list with current lists
|
89 |
+
$lists = Mage::getModel('mailigen_synchronizer/list')->toOptionArray();
|
90 |
+
|
91 |
+
//We need this later on
|
92 |
+
$config_model = new Mage_Core_Model_Config();
|
93 |
+
|
94 |
+
//Check if a similar list name doesn't exists already.
|
95 |
+
$continue = true;
|
96 |
+
foreach($lists as $list){
|
97 |
+
if($list['label'] == $new_list_name){
|
98 |
+
$continue = false;
|
99 |
+
Mage::getSingleton('adminhtml/session')->addError( "A list with a simiar name already exists" );
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
//Only if a list with a similar name is not doesn't exists we move further.
|
105 |
+
if( $continue ) {
|
106 |
+
|
107 |
+
$options = array(
|
108 |
+
'permission_reminder' => ' ',
|
109 |
+
'notify_to' => $notify_to,
|
110 |
+
'subscription_notify' => true,
|
111 |
+
'unsubscription_notify' => true,
|
112 |
+
'has_email_type_option' => true
|
113 |
+
);
|
114 |
+
|
115 |
+
$mgapi = Mage::getModuleDir('','Mailigen_Synchronizer') . DS . 'api' . DS . 'MGAPI.class.php';
|
116 |
+
$apikey = Mage::getStoreConfig('mailigen_settings/mailigen_general_group/mailigen_general_api_key');
|
117 |
+
require_once( $mgapi );
|
118 |
+
$api = new MGAPI($apikey);
|
119 |
+
|
120 |
+
$retval = $api->listCreate($new_list_name, $options);
|
121 |
+
|
122 |
+
if ($api->errorCode){
|
123 |
+
Mage::log( "Mailigen API Error: " . "Code=".$api->errorCode. " Msg=".$api->errorMessage );
|
124 |
+
} else{
|
125 |
+
Mage::log("Returned: ".$retval);
|
126 |
+
}
|
127 |
+
|
128 |
+
//We grab the list one more time
|
129 |
+
$lists = Mage::getModel('mailigen_synchronizer/list')->toOptionArray();
|
130 |
+
foreach($lists as $list){
|
131 |
+
if($list['label'] == $new_list_name){
|
132 |
+
//We make the new submitted list default
|
133 |
+
$config_model ->saveConfig('mailigen_settings/mailigen_general_group/mailigen_general_list', $list['value'], 'default', 0);
|
134 |
+
continue;
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
$config_model ->saveConfig('mailigen_settings/mailigen_general_group/mailigen_general_new_list', "", 'default', 0);
|
140 |
+
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
}
|
app/code/community/Mailigen/Synchronizer/api/MGAPI.class.php
ADDED
@@ -0,0 +1,1627 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class MGAPI {
|
4 |
+
var $version = "1.5";
|
5 |
+
var $errorMessage;
|
6 |
+
var $errorCode;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* API server adrese
|
10 |
+
*/
|
11 |
+
var $apiUrl;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Default to a 300 second timeout on server calls
|
15 |
+
*/
|
16 |
+
var $timeout = 300;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Default to a 8K chunk size
|
20 |
+
*/
|
21 |
+
var $chunkSize = 8192;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Lietotaja API atslega
|
25 |
+
*/
|
26 |
+
var $api_key;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Izmantot ssl: false - ne, true - ja
|
30 |
+
*/
|
31 |
+
var $secure = false;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Pieslegties pie MailiGen API
|
35 |
+
*
|
36 |
+
* @param string $apikey Jusu MailiGen API atslega
|
37 |
+
* @param string $secure Izmantot vai neizmantot ssl piesleganos
|
38 |
+
*/
|
39 |
+
function MGAPI($apikey, $secure = false) {
|
40 |
+
$this->secure = $secure;
|
41 |
+
$this->apiUrl = parse_url("http://api.mailigen.com/" . $this->version . "/?output=php");
|
42 |
+
if ( isset($GLOBALS["mg_api_key"]) && $GLOBALS["mg_api_key"]!="" ){
|
43 |
+
$this->api_key = $GLOBALS["mg_api_key"];
|
44 |
+
} else {
|
45 |
+
$this->api_key = $GLOBALS["mg_api_key"] = $apikey;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
function setTimeout($seconds){
|
49 |
+
if (is_int($seconds)){
|
50 |
+
$this->timeout = $seconds;
|
51 |
+
return true;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
function getTimeout(){
|
55 |
+
return $this->timeout;
|
56 |
+
}
|
57 |
+
function useSecure($val){
|
58 |
+
if ($val === true){
|
59 |
+
$this->secure = true;
|
60 |
+
} else {
|
61 |
+
$this->secure = false;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Noņemam nost statusu, kas lika kampaņu izsūtīt kaut kad nākotnē
|
67 |
+
*
|
68 |
+
* @example mgapi_campaignUnschedule.php
|
69 |
+
* @example xml-rpc_campaignUnschedule.php
|
70 |
+
*
|
71 |
+
* @param string $cid Kampaņas, kurai vajag noņemt izsūtīšanas laiku kaut kad nākotnē, ID
|
72 |
+
* @return boolean true ja ir veiksmīgi
|
73 |
+
*/
|
74 |
+
function campaignUnschedule($cid) {
|
75 |
+
$params = array();
|
76 |
+
$params["cid"] = $cid;
|
77 |
+
return $this->callServer("campaignUnschedule", $params);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Iestādam laiku, kad izsūtīt kampaņu
|
82 |
+
*
|
83 |
+
* @example mgapi_campaignSchedule.php
|
84 |
+
* @example xml-rpc_campaignSchedule.php
|
85 |
+
*
|
86 |
+
* @param string $cid Kampaņas, kurai vajag iestādīt izsūtīšanas laiku, ID
|
87 |
+
* @param string $schedule_time Laiks, kad izsūtīt. Laiku jānorāda šādā formātā YYYY-MM-DD HH:II:SS pēc <strong>GMT</strong>
|
88 |
+
* @return boolean true ja ir veiksmīgi
|
89 |
+
*/
|
90 |
+
function campaignSchedule($cid, $schedule_time) {
|
91 |
+
$params = array();
|
92 |
+
$params["cid"] = $cid;
|
93 |
+
$params["schedule_time"] = $schedule_time;
|
94 |
+
return $this->callServer("campaignSchedule", $params);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Atjaunojam auto atbildētāja izsūtīšanu
|
99 |
+
*
|
100 |
+
* @example mgapi_campaignResume.php
|
101 |
+
* @example xml-rpc_campaignResume.php
|
102 |
+
*
|
103 |
+
* @param string $cid Kampaņas, kuru vajag atsākt, ID
|
104 |
+
* @return boolean true ja ir veiksmīgi
|
105 |
+
*/
|
106 |
+
function campaignResume($cid) {
|
107 |
+
$params = array();
|
108 |
+
$params["cid"] = $cid;
|
109 |
+
return $this->callServer("campaignResume", $params);
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Apstādinam uz laiku autoatbildētāju
|
114 |
+
*
|
115 |
+
* @example mgapi_campaignPause.php
|
116 |
+
* @example xml-rpc_campaignPause.php
|
117 |
+
*
|
118 |
+
* @param string $cid Kampaņas, kuru vajag apstādināt, ID
|
119 |
+
* @return boolean true ja ir veiksmīgi
|
120 |
+
*/
|
121 |
+
function campaignPause($cid) {
|
122 |
+
$params = array();
|
123 |
+
$params["cid"] = $cid;
|
124 |
+
return $this->callServer("campaignPause", $params);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Nosūtīt kampaņu nekavējoties
|
129 |
+
*
|
130 |
+
* @example mgapi_campaignSendNow.php
|
131 |
+
* @example xml-rpc_campaignSendNow.php
|
132 |
+
*
|
133 |
+
* @param string $cid Kampaņas, kuru vajag nosūtīt, ID
|
134 |
+
* @return boolean true ja ir veiksmīgi
|
135 |
+
*/
|
136 |
+
function campaignSendNow($cid) {
|
137 |
+
$params = array();
|
138 |
+
$params["cid"] = $cid;
|
139 |
+
return $this->callServer("campaignSendNow", $params);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Nosūtam testa vēstuli uz norādītajiem epastiem
|
144 |
+
*
|
145 |
+
* @example mgapi_campaignSendTest.php
|
146 |
+
* @example xml-rpc_campaignSendTest.php
|
147 |
+
*
|
148 |
+
* @param string $cid Kampaņas, kur vēlamies notestēt, ID
|
149 |
+
* @param array $test_emails Masīvs, kas satur epastus, uz kuriem nosūtīt vēstuli
|
150 |
+
* @param string $send_type Nav obligāts. Ja vēlaties nosūtīt abus formātus, norādiet "html", ja tikai teksta, tad "plain"
|
151 |
+
* @return boolean true ja veiksmīgi
|
152 |
+
*/
|
153 |
+
function campaignSendTest($cid, $test_emails = array(), $send_type = NULL) {
|
154 |
+
$params = array();
|
155 |
+
$params["cid"] = $cid;
|
156 |
+
$params["test_emails"] = $test_emails;
|
157 |
+
$params["send_type"] = $send_type;
|
158 |
+
return $this->callServer("campaignSendTest", $params);
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Atrodam visus lietotāja šablonus
|
163 |
+
*
|
164 |
+
* @example mgapi_campaignTemplates.php
|
165 |
+
* @example xml-rpc_campaignTemplates.php
|
166 |
+
*
|
167 |
+
* @return array Masīvs, kas satur šablonus
|
168 |
+
* @returnf integer id Šablona ID
|
169 |
+
* @returnf string name Šablona nosaukums
|
170 |
+
* @returnf string layout Šablona izkārtojums - "basic", "left_column", "right_column" vai "postcard"
|
171 |
+
* @returnf string preview_image URL adrese līdz priekšskatījuma attēlam
|
172 |
+
* @returnf array source Šablona HTML kods
|
173 |
+
*/
|
174 |
+
function campaignTemplates() {
|
175 |
+
$params = array();
|
176 |
+
return $this->callServer("campaignTemplates", $params);
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Izveidojam jaunu kampaņu
|
181 |
+
*
|
182 |
+
* @example mgapi_campaignCreate.php
|
183 |
+
* @example xml-rpc_campaignCreate.php
|
184 |
+
*
|
185 |
+
* @param string $type Kampaņas veids: "html", "plain", "auto"
|
186 |
+
* @param array $options Masīvs ar kampaņas parametriem
|
187 |
+
string/array list_id Saraksta id, to var atrast r lists()
|
188 |
+
string subject Vēstules virsraksts
|
189 |
+
string from_email Epasts, uz kuru varēs nosūtīt atbildes epastu
|
190 |
+
string from_name Vārds, kas parādīsies pie nosūtītāja
|
191 |
+
string to_email Merge vērtība, kas parādīsies pie To: lauka (tas nav epasts)
|
192 |
+
array tracking Nav obligāts. Statistikas parametru masīvs, tiek izmantotas šādas atslēgas: "opens", "html_clicks" un "text_clicks". Pēc noklusējuma tiek skaitīta atvēršana un HTML klikšķi
|
193 |
+
string title Nav obligāts. Kampaņas nosaukums. Pēc noklusējuma tiek izmantots vēstules virsraksts
|
194 |
+
array analytics Nav obligāts. Masīvs ar skaitītāju informāciju. Google gadījumā ir šāds pielietojums "google"=>"jūsu_google_analytics_atslēga". "jūsu_google_analytics_atslēga" tiks pievienota visiem linkiem, statistiku varēs apskatīties klienta Google Analytics kontā
|
195 |
+
boolean generate_text Nav obligāts. Ja nav norādīts plain teksts, tiks ģenerēts tekst no HTML. Pēc noklusējuma ir false
|
196 |
+
boolean auto_footer Nav obligāts. Iekļaut vai neiekļaut automātisko kājeni vēstules saturā. Šis ir pieejams lietotājie ar Pro paku. Pēc noklusējuma ir false
|
197 |
+
boolean authenticate Nav obligāts. Ieslēgt epastu autentifikāciju. Šis strādās, ja ir pievienoti un aktivizēti autentificēti domēni sistēmā. Pēc noklusējuma ir false
|
198 |
+
string sender Nav obligāts. Epasta adrese. Tiek izmantots, lai norādītu citu sūtītāja informāciju. Ir pieejams lietotājiem ar Pro paku.
|
199 |
+
integer/array segment_id Nav obligāts. Satur segmenta ID, kuriem izsūtīt kampaņu
|
200 |
+
boolean inline_img Nav obligāts. Izmantot vai nē inline bildes. Šis ir pieejams ar atbilstošu addonu. Pēc noklusējuma ir false
|
201 |
+
string ln Nav obligāts. Nosaka, kādā valodā būs kājene un galvene. Iespējamās vērtības: cn, dk, en, ee, fi, fr, de, it, jp, lv, lt, no, pl, pt, ru, es, se
|
202 |
+
|
203 |
+
* @param array $content Masīvs, kas satur vēstules saturu. Struktūra:
|
204 |
+
"html" HTML saturs
|
205 |
+
"plain" saturs plain vēstulei
|
206 |
+
"url" Adrese, no kuras importēt HTML tekstu. Ja netiek norādīts plain teksts, tad vajag ieslēgt generate_text, lai tiktu ģenerēts plain teksta vēstules saturs. Ja tiek norādīta šī vērtība, tad tiek pārrakstītas augstāk minētās vērtības
|
207 |
+
"archive" Ar Base64 kodēts arhīva fails. Ja tiek norādīta šī vērtība, tad tiek pārrakstītas augstāk minētās vērtības
|
208 |
+
"archive_type" Nav obligāts. Pieļaujamie arhīva formāti: zip, tar.gz, tar.bz2, tar, tgz, tbz . Ja nav norādīts, tad pēc noklusējuma tiks izmantots zip
|
209 |
+
integer template_id Nav obligāts. Lietotāja šablona id, nu kura tiks ģenerēts HTML saturs
|
210 |
+
|
211 |
+
* @param array $type_opts Nav obligāts -
|
212 |
+
|
213 |
+
Autoatbildētāja kampaņa, šis masīvs satur šādu informāciju:
|
214 |
+
string offset-units Kāda vērtība no "day", "week", "month", "year". Obligāti jānorāda
|
215 |
+
string offset-time Vērtība, kas ir lielāka par 0. Obligāti jānorāda
|
216 |
+
string offset-dir Viena vērtība no "before" vai "after". Pēc noklusējuma "after"
|
217 |
+
string event Nav obligāts. Izsūtīt pēc "signup" (parakstīšanās, pēc noklusējuma), "date" (datuma) vai "annual" (ikgadējs)
|
218 |
+
string event-datemerge Nav obligāts. Merge lauks, kurš tiek ņemts vērā, kad izsūtīt. Šis ir nepieciešams, ja event ir norādīt "date" vai "annual"
|
219 |
+
|
220 |
+
*
|
221 |
+
* @return string Atgriež jaunās kampaņas ID
|
222 |
+
*/
|
223 |
+
function campaignCreate($type, $options, $content, $type_opts = NULL) {
|
224 |
+
$params = array();
|
225 |
+
$params["type"] = $type;
|
226 |
+
$params["options"] = $options;
|
227 |
+
$params["content"] = $content;
|
228 |
+
$params["type_opts"] = $type_opts;
|
229 |
+
return $this->callServer("campaignCreate", $params);
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Atjaunojam kampaņas, kura vēl nav nosūtīta, parametrus
|
234 |
+
*
|
235 |
+
*
|
236 |
+
* Uzmanību:<br/><ul>
|
237 |
+
* <li>Ja Jūs izmantojat list_id, visi iepriekšējie saraksti tiks izdzēsti.</li>
|
238 |
+
* <li>Ja Jūs izmantojat template_id, tiks pārrakstīts HTML saturs ar šablona saturu</li>
|
239 |
+
*
|
240 |
+
* @example mgapi_campaignUpdate.php
|
241 |
+
* @example xml-rpc_campaignUpdate.php
|
242 |
+
*
|
243 |
+
* @param string $cid Kampaņas, kuru vajag labot, ID
|
244 |
+
* @param string $name Parametra nosaukums (skatīties pie campaignCreate() options lauku ). Iespējamie parametri: subject, from_email, utt. Papildus parametri ir content. Gadījumā, ja vajag mainīt "type_opts", kā "name" vajag norādīt, piemēram, "auto".
|
245 |
+
* @param mixed $value Iespējamās vērtības parametram ( skatīties campaignCreate() options lauku )
|
246 |
+
* @return boolean true, ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
247 |
+
*/
|
248 |
+
function campaignUpdate($cid, $name, $value) {
|
249 |
+
$params = array();
|
250 |
+
$params["cid"] = $cid;
|
251 |
+
$params["name"] = $name;
|
252 |
+
$params["value"] = $value;
|
253 |
+
return $this->callServer("campaignUpdate", $params);
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Kopējam kampaņu
|
258 |
+
*
|
259 |
+
* @example mgapi_campaignReplicate.php
|
260 |
+
* @example xml-rpc_campaignReplicate.php
|
261 |
+
*
|
262 |
+
* @param string $cid Kampaņas, kuru vajag kopēt, ID
|
263 |
+
* @return string Atgriežam jaunās kampaņas ID
|
264 |
+
*/
|
265 |
+
function campaignReplicate($cid) {
|
266 |
+
$params = array();
|
267 |
+
$params["cid"] = $cid;
|
268 |
+
return $this->callServer("campaignReplicate", $params);
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Tiek dzēsta neatgriezensiki kampaņa. Esiet uzmanīgi!
|
273 |
+
*
|
274 |
+
* @example mgapi_campaignDelete.php
|
275 |
+
* @example xml-rpc_campaignDelete.php
|
276 |
+
*
|
277 |
+
* @param string $cid Kampaņas, kuru vajag dzēst, ID
|
278 |
+
* @return boolean true ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
279 |
+
*/
|
280 |
+
function campaignDelete($cid) {
|
281 |
+
$params = array();
|
282 |
+
$params["cid"] = $cid;
|
283 |
+
return $this->callServer("campaignDelete", $params);
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Atgriežam kampaņu sarakstu. Var pielietot filtru, lai detalizēt atlasītu
|
288 |
+
*
|
289 |
+
* @example mgapi_campaigns.php
|
290 |
+
* @example xml-rpc_campaigns.php
|
291 |
+
*
|
292 |
+
* @param array $filters Nav obligāts. Masīvs ar parametriem:
|
293 |
+
string campaign_id Nav obligāts, kampaņas id
|
294 |
+
string list_id Nav obligāts, saraksta id. To var atrast ar lists()
|
295 |
+
string status Nav obligāts. Var atrast kampaņu pēc statusa: sent, draft, paused, sending
|
296 |
+
string type Nav obligāts. Kampaņas tips: plain, html
|
297 |
+
string from_name Nav obligāts. Atlasa kampānu pēc nosūtītāja vārda
|
298 |
+
string from_email Nav obligāts. Atlasa kampaņas pēc "Reply-to" epasta
|
299 |
+
string title Nav obligāts. Atlasa pēc kampaņas nosaukuma
|
300 |
+
string subject Nav obligāts. Atlasa pēc vēstules virsraksta ("Subject")
|
301 |
+
string sendtime_start Nav obligāts. Atlasa vēstules, kas izsūtītas pēc šī datuma/laika. Formāts - YYYY-MM-DD HH:mm:ss (24hr)
|
302 |
+
string sendtime_end Nav obligāts. Atlasa vēstules, kas izsūtītas pirms šī datuma/laika. Formāts - YYYY-MM-DD HH:mm:ss (24hr)
|
303 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
304 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 25. Maksimālā vērtība ir 1000
|
305 |
+
* @return array Agriež masīvu ar kampaņu sarakstu
|
306 |
+
* @returnf string id Kampaņas id. To izmanto pārējām funkcijām
|
307 |
+
* @returnf integer web_id Kampaņas id, kas tiek izmanots web versijā
|
308 |
+
* @returnf string title Kampaņas virsraksts
|
309 |
+
* @returnf string type Kampaņas tips (html,plain,auto)
|
310 |
+
* @returnf date create_time Kampaņas izveidošanas datums
|
311 |
+
* @returnf date send_time Kampānas nosūtīšanas datums
|
312 |
+
* @returnf integer emails_sent Epastu skaits, uz kuriem nosūtīta kampaņa
|
313 |
+
* @returnf string status Kampaņas statuss (sent, draft, paused, sending)
|
314 |
+
* @returnf string from_name Vārds, kas parādās From laukā
|
315 |
+
* @returnf string from_email E-pasts, uz kuru saņēmējs var nosūtīt atbildi
|
316 |
+
* @returnf string subject Vēstules virsraksts
|
317 |
+
* @returnf boolean to_email Personalizēt "To:" lauku
|
318 |
+
* @returnf string archive_url Arhīva saite uz kampaņu
|
319 |
+
* @returnf boolean analytics Integrēt vai neitegrēt Google Analytics
|
320 |
+
* @returnf string analytcs_tag Google Analytics nosaukums kampaņai
|
321 |
+
* @returnf boolean track_clicks_text Skaitīt vai neskaitīt klikšķus plain vēstulē
|
322 |
+
* @returnf boolean track_clicks_html Skaitīt vai neskaitīt klikšķus HTML vēstulē
|
323 |
+
* @returnf boolean track_opens Skaitīt vai neskaitīt atvēršanu
|
324 |
+
*/
|
325 |
+
function campaigns($filters = array(), $start = 0, $limit = 25) {
|
326 |
+
$params = array();
|
327 |
+
$params["filters"] = $filters;
|
328 |
+
$params["start"] = $start;
|
329 |
+
$params["limit"] = $limit;
|
330 |
+
return $this->callServer("campaigns", $params);
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Given a list and a campaign, get all the relevant campaign statistics (opens, bounces, clicks, etc.)
|
335 |
+
*
|
336 |
+
* @example mgapi_campaignStats.php
|
337 |
+
* @example xml-rpc_campaignStats.php
|
338 |
+
*
|
339 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
340 |
+
* @return array Masīvs, kas satur kampaņas statistiku
|
341 |
+
* @returnf integer hard_bounces Nepiegādāto/nepareizo epastu skaits
|
342 |
+
* @returnf integer soft_bounces Pagaidu nepiegādāto
|
343 |
+
* @returnf integer blocked_bounces Bloķēto skaits
|
344 |
+
* @returnf integer temporary_bounces Īslaicīgi atgriezto skaits
|
345 |
+
* @returnf integer generic_bounces Nepareizo epastu skaits
|
346 |
+
* @returnf integer unsubscribes Epastu skaits, kas atrakstījās no kampaņas
|
347 |
+
* @returnf integer forwards Skaits, cik reizes vēstule ir pārsūtīta
|
348 |
+
* @returnf integer opens Skaits, cik reizes atvērts
|
349 |
+
* @returnf date last_open Datums, kad pēdējo reizi atvērts
|
350 |
+
* @returnf integer unique_opens Unikālo atvēršanu skait
|
351 |
+
* @returnf integer clicks Skaits, cik daudz ir spiests uz linkiem
|
352 |
+
* @returnf integer unique_clicks Unikālie klikšķi uz saitēm
|
353 |
+
* @returnf date last_click Datums, kad pēdējo reizi spiests uz linkiem
|
354 |
+
* @returnf integer users_who_clicked Lietotāju skaits, kas spieduši uz saitēm
|
355 |
+
* @returnf integer emails_sent Kopējais skaits, cik vēstules ir izsūtītas
|
356 |
+
*/
|
357 |
+
function campaignStats($cid) {
|
358 |
+
$params = array();
|
359 |
+
$params["cid"] = $cid;
|
360 |
+
return $this->callServer("campaignStats", $params);
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Atrodam kampaņas visus linkus
|
365 |
+
*
|
366 |
+
* @example mgapi_campaignClickStats.php
|
367 |
+
* @example xml-rpc_campaignClickStats.php
|
368 |
+
*
|
369 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
370 |
+
* @return struct urls Saišu masīvs, kur atslēga ir saite
|
371 |
+
* @returnf integer clicks Kopējais klikšķu skaits
|
372 |
+
* @returnf integer unique Unikālo klikšķu skaits
|
373 |
+
*/
|
374 |
+
function campaignClickStats($cid) {
|
375 |
+
$params = array();
|
376 |
+
$params["cid"] = $cid;
|
377 |
+
return $this->callServer("campaignClickStats", $params);
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Atrodam šīs kampaņas epastu domēnu statistiku
|
382 |
+
*
|
383 |
+
* @example mgapi_campaignEmailDomainPerformance.php
|
384 |
+
* @example xml-rpc_campaignEmailDomainPerformance.php
|
385 |
+
*
|
386 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
387 |
+
* @return array Masīvs ar epasta domēniem
|
388 |
+
* @returnf string domain Domēna vārds
|
389 |
+
* @returnf integer total_sent Kopā nosūtīto epastu skaits kampaņai (visi epasti)
|
390 |
+
* @returnf integer emails Uz šo domēnu nosūtīto epstu skaits
|
391 |
+
* @returnf integer bounces Neaizgājušo epastu skaits
|
392 |
+
* @returnf integer opens Unikālo atvēršanu skaits
|
393 |
+
* @returnf integer clicks Unikālo klikšķu skaits
|
394 |
+
* @returnf integer unsubs Skaits, cik atrakstījušies
|
395 |
+
* @returnf integer delivered Piegādāto vēstuļu skaits
|
396 |
+
* @returnf integer emails_pct Skaits, cik epastu procentuāli ir ar šo domēnu
|
397 |
+
* @returnf integer bounces_pct Skaits, cik procentuāli no kopēja skaita nav piegādāts ar šo domēnu
|
398 |
+
* @returnf integer opens_pct Skaits, cik procentuāli ir atvērts ar šo domēnu
|
399 |
+
* @returnf integer clicks_pct Skaits, cik procentuāli no šī domēna ir spieduši
|
400 |
+
* @returnf integer unsubs_pct Procentuāli, cik daudz no šī domēna ir atrakstījušies
|
401 |
+
*/
|
402 |
+
function campaignEmailDomainPerformance($cid) {
|
403 |
+
$params = array();
|
404 |
+
$params["cid"] = $cid;
|
405 |
+
return $this->callServer("campaignEmailDomainPerformance", $params);
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Atrodam neeksistējošos/nepareizos epastus (hard bounces)
|
410 |
+
*
|
411 |
+
* @example mgapi_campaignHardBounces.php
|
412 |
+
* @example xml-rpc_campaignHardBounces.php
|
413 |
+
*
|
414 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
415 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
416 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 1000. Maksimālā vērtība ir 15000
|
417 |
+
* @return array Epastu saraksts
|
418 |
+
*/
|
419 |
+
function campaignHardBounces($cid, $start = 0, $limit = 1000) {
|
420 |
+
$params = array();
|
421 |
+
$params["cid"] = $cid;
|
422 |
+
$params["start"] = $start;
|
423 |
+
$params["limit"] = $limit;
|
424 |
+
return $this->callServer("campaignHardBounces", $params);
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Atrodam pagaidu atgrieztos epastus (soft bounces)
|
429 |
+
*
|
430 |
+
* @example mgapi_campaignSoftBounces.php
|
431 |
+
* @example xml-rpc_campaignSoftBounces.php
|
432 |
+
*
|
433 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
434 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
435 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 1000. Maksimālā vērtība ir 15000
|
436 |
+
* @return array Epastu saraksts
|
437 |
+
*/
|
438 |
+
function campaignSoftBounces($cid, $start = 0, $limit = 1000) {
|
439 |
+
$params = array();
|
440 |
+
$params["cid"] = $cid;
|
441 |
+
$params["start"] = $start;
|
442 |
+
$params["limit"] = $limit;
|
443 |
+
return $this->callServer("campaignSoftBounces", $params);
|
444 |
+
}
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Atrodam atgrieztos epastus (blocked bounces)
|
448 |
+
*
|
449 |
+
* @example mgapi_campaignBlockedBounces.php
|
450 |
+
* @example xml-rpc_campaignBlockedBounces.php
|
451 |
+
*
|
452 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
453 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
454 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 1000. Maksimālā vērtība ir 15000
|
455 |
+
* @return array Epastu saraksts
|
456 |
+
*/
|
457 |
+
function campaignBlockedBounces($cid, $start = 0, $limit = 1000) {
|
458 |
+
$params = array();
|
459 |
+
$params["cid"] = $cid;
|
460 |
+
$params["start"] = $start;
|
461 |
+
$params["limit"] = $limit;
|
462 |
+
return $this->callServer("campaignBlockedBounces", $params);
|
463 |
+
}
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Atrodam atgrieztos epastus (temporary bounces)
|
467 |
+
*
|
468 |
+
* @example mgapi_campaignTemporaryBounces.php
|
469 |
+
* @example xml-rpc_campaignTemporaryBounces.php
|
470 |
+
*
|
471 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
472 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
473 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 1000. Maksimālā vērtība ir 15000
|
474 |
+
* @return array Epastu saraksts
|
475 |
+
*/
|
476 |
+
function campaignTemporaryBounces($cid, $start = 0, $limit = 1000) {
|
477 |
+
$params = array();
|
478 |
+
$params["cid"] = $cid;
|
479 |
+
$params["start"] = $start;
|
480 |
+
$params["limit"] = $limit;
|
481 |
+
return $this->callServer("campaignTemporaryBounces", $params);
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* Atrodam atgrieztos epastus (generic bounces)
|
486 |
+
*
|
487 |
+
* @example mgapi_campaignGenericBounces.php
|
488 |
+
* @example xml-rpc_campaignGenericBounces.php
|
489 |
+
*
|
490 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
491 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
492 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 1000. Maksimālā vērtība ir 15000
|
493 |
+
* @return array Epastu saraksts
|
494 |
+
*/
|
495 |
+
function campaignGenericBounces($cid, $start = 0, $limit = 1000) {
|
496 |
+
$params = array();
|
497 |
+
$params["cid"] = $cid;
|
498 |
+
$params["start"] = $start;
|
499 |
+
$params["limit"] = $limit;
|
500 |
+
return $this->callServer("campaignGenericBounces", $params);
|
501 |
+
}
|
502 |
+
|
503 |
+
/**
|
504 |
+
* Atrodam visus e-pastus, kas ir atrakstījušies no šīs kampaņas
|
505 |
+
*
|
506 |
+
* @example mgapi_campaignUnsubscribes.php
|
507 |
+
* @example xml-rpc_campaignUnsubscribes.php
|
508 |
+
*
|
509 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
510 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
511 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 1000. Maksimālā vērtība ir 15000
|
512 |
+
* @return array Epastu saraksts
|
513 |
+
*/
|
514 |
+
function campaignUnsubscribes($cid, $start = 0, $limit = 1000) {
|
515 |
+
$params = array();
|
516 |
+
$params["cid"] = $cid;
|
517 |
+
$params["start"] = $start;
|
518 |
+
$params["limit"] = $limit;
|
519 |
+
return $this->callServer("campaignUnsubscribes", $params);
|
520 |
+
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* Atgriež valstu sarakstu, no kurām ir atvērtas vēstules un cik daudz
|
524 |
+
*
|
525 |
+
* @example mgapi_campaignGeoOpens.php
|
526 |
+
* @example xml-rpc_campaignGeoOpens.php
|
527 |
+
*
|
528 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
529 |
+
* @return array countries Masīvs ar valstu sarakstu
|
530 |
+
* @returnf string code Valsts kods ISO3166 formātā, satur 2 simbolus
|
531 |
+
* @returnf string name Valsts nosaukums
|
532 |
+
* @returnf int opens Skaits, cik daudz atvērts
|
533 |
+
*/
|
534 |
+
function campaignGeoOpens($cid) {
|
535 |
+
$params = array();
|
536 |
+
$params["cid"] = $cid;
|
537 |
+
return $this->callServer("campaignGeoOpens", $params);
|
538 |
+
}
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Atrodam pārsūtīšanas statistiku
|
542 |
+
*
|
543 |
+
* @example mgapi_campaignForwardStats.php
|
544 |
+
* @example xml-rpc_campaignForwardStats.php
|
545 |
+
*
|
546 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
547 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
548 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 1000. Maksimālā vērtība ir 15000
|
549 |
+
* @return array Epastu saraksts
|
550 |
+
*/
|
551 |
+
function campaignForwardStats($cid, $start = 0, $limit = 1000) {
|
552 |
+
$params = array();
|
553 |
+
$params["cid"] = $cid;
|
554 |
+
$params["start"] = $start;
|
555 |
+
$params["limit"] = $limit;
|
556 |
+
return $this->callServer("campaignForwardStats", $params);
|
557 |
+
}
|
558 |
+
|
559 |
+
/**
|
560 |
+
* Atgriež kampaņas atmesto vēstuļu tekstus, kuras nav vecākas par 30 dienām
|
561 |
+
*
|
562 |
+
* @example mgapi_campaignBounceMessages.php
|
563 |
+
* @example xml-rpc_campaignBounceMessages.php
|
564 |
+
*
|
565 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
566 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
567 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 25. Maksimālā vērtība ir 50
|
568 |
+
* @return array bounces Masīvs, kas satur atsviesto epastu saturu
|
569 |
+
* @returnf string date Laiks, kad vēstule saņemta
|
570 |
+
* @returnf string email Epasta arese, uz kuru neizdevās nosūtīt
|
571 |
+
* @returnf string message Atsviestēs vēstules saturs
|
572 |
+
*/
|
573 |
+
function campaignBounceMessages($cid, $start = 0, $limit = 25) {
|
574 |
+
$params = array();
|
575 |
+
$params["cid"] = $cid;
|
576 |
+
$params["start"] = $start;
|
577 |
+
$params["limit"] = $limit;
|
578 |
+
return $this->callServer("campaignBounceMessages", $params);
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Atgriež epastu sarakstu, kas atvēruši kampaņu
|
583 |
+
*
|
584 |
+
* @example mgapi_campaignOpened.php
|
585 |
+
*
|
586 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
587 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
588 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 25. Maksimālā vērtība ir 50
|
589 |
+
* @return struct Masīvs, kas satur datus
|
590 |
+
* @returnf integer total Kopējais skaits
|
591 |
+
* @returnf array data Saraksts ar datiem
|
592 |
+
struct data
|
593 |
+
string email Epasta adrese
|
594 |
+
integer count Cik reizes atvēra
|
595 |
+
*/
|
596 |
+
function campaignOpened($cid, $start = 0, $limit = 25) {
|
597 |
+
$params = array();
|
598 |
+
$params["cid"] = $cid;
|
599 |
+
$params["start"] = $start;
|
600 |
+
$params["limit"] = $limit;
|
601 |
+
return $this->callServer("campaignOpened", $params);
|
602 |
+
}
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Atgriež epastu sarakstu, kas nav atvēruši kampaņu
|
606 |
+
*
|
607 |
+
* @example mgapi_campaignNotOpened.php
|
608 |
+
*
|
609 |
+
* @param string $cid Kampaņas id. To var atrast ar campaigns()
|
610 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
611 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 25. Maksimālā vērtība ir 50
|
612 |
+
* @return struct Masīvs, kas satur datus
|
613 |
+
* @returnf integer total Kopējais skaits
|
614 |
+
* @returnf array data Epastu saraksts
|
615 |
+
string email Epasta adrese
|
616 |
+
*/
|
617 |
+
function campaignNotOpened($cid, $start = 0, $limit = 25) {
|
618 |
+
$params = array();
|
619 |
+
$params["cid"] = $cid;
|
620 |
+
$params["start"] = $start;
|
621 |
+
$params["limit"] = $limit;
|
622 |
+
return $this->callServer("campaignNotOpened", $params);
|
623 |
+
}
|
624 |
+
|
625 |
+
/**
|
626 |
+
* Izveidojam jaunu sarakstu
|
627 |
+
*
|
628 |
+
* @example mgapi_listCreate.php
|
629 |
+
* @example xml-rpc_listCreate.php
|
630 |
+
*
|
631 |
+
* @param string $title Saraksta nosaukums
|
632 |
+
* @param array $options Masīvs ar kampaņas parametriem
|
633 |
+
string permission_reminder Atgādinājums lietotājiem, kā tie nokļuva sarakstā
|
634 |
+
string notify_to Epasta adrese, uz kuru sūtīt paziņojumus
|
635 |
+
bool subscription_notify Sūtīt paziņojumus par to, ka ir jauns lietotājs pierakstījies
|
636 |
+
bool unsubscription_notify Sūtīt paziņojumus par to, ka ir jauns lietotājs atrakstījies
|
637 |
+
bool has_email_type_option Ļaut izvēlēties epasta formātu
|
638 |
+
|
639 |
+
*
|
640 |
+
* @return string Atgriež jaunā saraksta ID
|
641 |
+
*/
|
642 |
+
function listCreate($title, $options = NULL) {
|
643 |
+
$params = array();
|
644 |
+
$params["title"] = $title;
|
645 |
+
$params["options"] = $options;
|
646 |
+
return $this->callServer("listCreate", $params);
|
647 |
+
}
|
648 |
+
|
649 |
+
/**
|
650 |
+
* Atjaunojam saraksta parametrus
|
651 |
+
*
|
652 |
+
* @example mgapi_listUpdate.php
|
653 |
+
* @example xml-rpc_listUpdate.php
|
654 |
+
*
|
655 |
+
* @param string $id Saraksta, kuru vajag labot, ID
|
656 |
+
* @param string $name Parametra nosaukums (skatīties pie listCreate() options lauku ). Iespējamie parametri: title, permission_reminder, notify_to, utt.
|
657 |
+
* @return boolean true, ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
658 |
+
*/
|
659 |
+
function listUpdate($id, $name, $value) {
|
660 |
+
$params = array();
|
661 |
+
$params["id"] = $id;
|
662 |
+
$params["name"] = $name;
|
663 |
+
$params["value"] = $value;
|
664 |
+
return $this->callServer("listUpdate", $params);
|
665 |
+
}
|
666 |
+
|
667 |
+
/**
|
668 |
+
* Tiek dzēsts neatgriezensiki saraksts. Esiet uzmanīgi!
|
669 |
+
*
|
670 |
+
* @example mgapi_listDelete.php
|
671 |
+
* @example xml-rpc_listDelete.php
|
672 |
+
*
|
673 |
+
* @param string $id Saraksta, kuru vajag labot, ID
|
674 |
+
* @return boolean true ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
675 |
+
*/
|
676 |
+
function listDelete($id) {
|
677 |
+
$params = array();
|
678 |
+
$params["id"] = $id;
|
679 |
+
return $this->callServer("listDelete", $params);
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Atrodam visus sarakstus
|
684 |
+
*
|
685 |
+
* @example mgapi_lists.php
|
686 |
+
* @example xml-rpc_lists.php
|
687 |
+
*
|
688 |
+
* @return array Masīvs ar sarakstiem
|
689 |
+
* @returnf string id Saraksta id. Šī vērtība tiek izmantota cītās funkcijās, kas strādā ar sarakstiem.
|
690 |
+
* @returnf integer web_id Saraksta id, kas tiek izmantots web administrācijas lapā
|
691 |
+
* @returnf string name Saraksta nosaukums
|
692 |
+
* @returnf date date_created Saraksta izveidošanas datums.
|
693 |
+
* @returnf integer member_count Lietotāju skaits sarakstā
|
694 |
+
* @returnf integer unsubscribe_count Lietotāju skaits, cik atrakstījušies no saraksta
|
695 |
+
* @returnf string default_from_name Noklusējuma vērtība From Name priekš kampaņām, kas izmanto šo sarakstu
|
696 |
+
* @returnf string default_from_email Noklusējuma vērtība From Email priekš kampaņām, kas izmanto šo sarakstu
|
697 |
+
* @returnf string default_subject Noklusējuma vērtība Subject priekš kampaņām, kas izmanto šo sarakstu
|
698 |
+
* @returnf string default_language Noklusēja valoda saraksta formām
|
699 |
+
*/
|
700 |
+
function lists($start = 0, $limit = 1000) {
|
701 |
+
$params = array();
|
702 |
+
$params["start"] = $start;
|
703 |
+
$params["limit"] = $limit;
|
704 |
+
return $this->callServer("lists", $params);
|
705 |
+
}
|
706 |
+
|
707 |
+
/**
|
708 |
+
* Atrodam merge tagus sarakstam
|
709 |
+
*
|
710 |
+
* @example mgapi_listMergeVarUpdate.php
|
711 |
+
* @example xml-rpc_listMergeVars.php
|
712 |
+
*
|
713 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
714 |
+
* @return array Merge tagu saraksts
|
715 |
+
* @returnf string name Merge taga nosaukums
|
716 |
+
* @returnf bool req Vai šis lauks ir obligāti aizpildāms (true) vai nē (false)
|
717 |
+
* @returnf string field_type Merge tada datu tips. Ir pieļaujamas šādas vērtības: email, text, number, date, address, phone, website, image
|
718 |
+
* @returnf bool show Norāda, vai rādīt šo lauku lietotāju sarakstā.
|
719 |
+
* @returnf string order Kārtas numurs
|
720 |
+
* @returnf string default Vērtība pēc noklusējuma
|
721 |
+
* @returnf string tag Merge tags, kas tiek izmantots formās, listSubscribe() un listUpdateMember()
|
722 |
+
*/
|
723 |
+
function listMergeVars($id) {
|
724 |
+
$params = array();
|
725 |
+
$params["id"] = $id;
|
726 |
+
return $this->callServer("listMergeVars", $params);
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* Pievienojam jaunu merge tagu sarakstam
|
731 |
+
*
|
732 |
+
* @example mgapi_listMergeVarUpdate.php
|
733 |
+
* @example xml-rpc_listMergeVarAdd.php
|
734 |
+
*
|
735 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
736 |
+
* @param string $tag Merge tags, kuru vajag pievienot, piemēram, FNAME
|
737 |
+
* @param string $name Garāks nosaukum, kas tiks rādīts lietotājiem
|
738 |
+
* @param array $options Nav obligāts. Dažādi parametri merge tagam.
|
739 |
+
string field_type Nav obligāts. Kāda vērtība no: text, number, date, address, phone, website, image. Pēc noklusējuma ir text
|
740 |
+
boolean req Nav obligāts. Norāda, vai lauks ir obligāti aizpildāms. Pēc noklusējuma, false
|
741 |
+
boolean show Nav obligāts. Norāda, vai rādīt šo lauku lietotāju sarakstā. Pēc noklusējuma, true
|
742 |
+
string default_value Nav obligāts. Vērtība pēc noklusējuma
|
743 |
+
|
744 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
745 |
+
*/
|
746 |
+
function listMergeVarAdd($id, $tag, $name, $options = array()) {
|
747 |
+
$params = array();
|
748 |
+
$params["id"] = $id;
|
749 |
+
$params["tag"] = $tag;
|
750 |
+
$params["name"] = $name;
|
751 |
+
$params["options"] = $options;
|
752 |
+
return $this->callServer("listMergeVarAdd", $params);
|
753 |
+
}
|
754 |
+
|
755 |
+
/**
|
756 |
+
* Atjaunojam merge taga parametrus sarakstā. Merge taga tipu nevar nomainīt
|
757 |
+
*
|
758 |
+
* @example mgapi_listMergeVarUpdate.php
|
759 |
+
* @example xml-rpc_listMergeVarUpdate.php
|
760 |
+
*
|
761 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
762 |
+
* @param string $tag Merge tags, kuru vajag atjaunot
|
763 |
+
* @param array $options Parametri merge taga atjaunošanai. Pareizus parametrus skatīties pie metodes listMergeVarAdd()
|
764 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
765 |
+
*/
|
766 |
+
function listMergeVarUpdate($id, $tag, $options) {
|
767 |
+
$params = array();
|
768 |
+
$params["id"] = $id;
|
769 |
+
$params["tag"] = $tag;
|
770 |
+
$params["options"] = $options;
|
771 |
+
return $this->callServer("listMergeVarUpdate", $params);
|
772 |
+
}
|
773 |
+
|
774 |
+
/**
|
775 |
+
* Tiek izdzēsts merge tags no saraksta un vērtība visiem saraksta lietotājiem. Dati tie izdzēsti neatgriezeniski
|
776 |
+
*
|
777 |
+
* @example mgapi_listMergeVarDel.php
|
778 |
+
* @example xml-rpc_listMergeVarDel.php
|
779 |
+
*
|
780 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
781 |
+
* @param string $tag Merge tags, kuru vajag izdzēst
|
782 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
783 |
+
*/
|
784 |
+
function listMergeVarDel($id, $tag) {
|
785 |
+
$params = array();
|
786 |
+
$params["id"] = $id;
|
787 |
+
$params["tag"] = $tag;
|
788 |
+
return $this->callServer("listMergeVarDel", $params);
|
789 |
+
}
|
790 |
+
|
791 |
+
/**
|
792 |
+
* Pievienojam sarakstam jaunu lietotaju
|
793 |
+
*
|
794 |
+
* @example mgapi_listSubscribe.php
|
795 |
+
* @example xml-rpc_listSubscribe.php
|
796 |
+
*
|
797 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
798 |
+
* @param string $email_address Epasta adrese, ko japievieno sarakstam
|
799 |
+
* @param array $merge_vars Masivs, kas satur MERGE lauku vertibas (FNAME, LNAME, etc.) Maksimalais izmers 255
|
800 |
+
* @param string $email_type Nav obligats. Epasta tips: html vai plain. Pec noklusejuma html
|
801 |
+
* @param boolean $double_optin Vai sutit apstiprinajuma vestuli. Pec noklusejuma true
|
802 |
+
* @param boolean $update_existing Vai atjaunot eksistejoos epastus. Pec noklusejuma false (atgriezis kludas pazinojumu)
|
803 |
+
* @param boolean $send_welcome - Nav obligats. Sutit vai nesutit paldies vestuli. Pec noklusejuma false
|
804 |
+
|
805 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
806 |
+
*/
|
807 |
+
function listSubscribe($id, $email_address, $merge_vars, $email_type = 'html', $double_optin = true, $update_existing = false, $send_welcome = false) {
|
808 |
+
$params = array();
|
809 |
+
$params["id"] = $id;
|
810 |
+
$params["email_address"] = $email_address;
|
811 |
+
$params["merge_vars"] = $merge_vars;
|
812 |
+
$params["email_type"] = $email_type;
|
813 |
+
$params["double_optin"] = $double_optin;
|
814 |
+
$params["update_existing"] = $update_existing;
|
815 |
+
$params["send_welcome"] = $send_welcome;
|
816 |
+
return $this->callServer("listSubscribe", $params);
|
817 |
+
}
|
818 |
+
|
819 |
+
/**
|
820 |
+
* Pievienojam sarakstam jaunu lietotaju
|
821 |
+
*
|
822 |
+
* @example mgapi_listSubscribe.php
|
823 |
+
* @example xml-rpc_listSubscribe.php
|
824 |
+
*
|
825 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
826 |
+
* @param string $phone Tālrunis, ko japievieno sarakstam
|
827 |
+
* @param array $merge_vars Masivs, kas satur MERGE lauku vertibas (FNAME, LNAME, etc.) Maksimalais izmers 255
|
828 |
+
* @param boolean $update_existing Vai atjaunot eksistejoos epastus. Pec noklusejuma false (atgriezis kludas pazinojumu)
|
829 |
+
|
830 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
831 |
+
*/
|
832 |
+
function listSubscribeSMS($id, $phone, $merge_vars, $update_existing = false) {
|
833 |
+
$params = array();
|
834 |
+
$params["id"] = $id;
|
835 |
+
$params["phone"] = $phone;
|
836 |
+
$params["merge_vars"] = $merge_vars;
|
837 |
+
$params["update_existing"] = $update_existing;
|
838 |
+
return $this->callServer("listSubscribeSMS", $params);
|
839 |
+
}
|
840 |
+
|
841 |
+
/**
|
842 |
+
* Iznemam no saraksta epasta adresi
|
843 |
+
*
|
844 |
+
* @example mgapi_listUnsubscribe.php
|
845 |
+
* @example xml-rpc_listUnsubscribe.php
|
846 |
+
*
|
847 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
848 |
+
* @param string $email_address Epasta adrese vai "id", ko var atrast ar "listMemberInfo" metodi
|
849 |
+
* @param boolean $delete_member Dzest vai nedzest lietotaju no saraksta. Pec noklusejuma false
|
850 |
+
* @param boolean $send_goodbye Nosutit vai nesutit pazinojumu epasta lietotajam. Pec noklusejuma true
|
851 |
+
* @param boolean $send_notify Nosutit vai nesutit pazinojumu uz epastu, kas noradits saraksta opcijas. Pec noklusejuma false
|
852 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
853 |
+
*/
|
854 |
+
function listUnsubscribe($id, $email_address, $delete_member = false, $send_goodbye = true, $send_notify = true) {
|
855 |
+
$params = array();
|
856 |
+
$params["id"] = $id;
|
857 |
+
$params["email_address"] = $email_address;
|
858 |
+
$params["delete_member"] = $delete_member;
|
859 |
+
$params["send_goodbye"] = $send_goodbye;
|
860 |
+
$params["send_notify"] = $send_notify;
|
861 |
+
return $this->callServer("listUnsubscribe", $params);
|
862 |
+
}
|
863 |
+
|
864 |
+
/**
|
865 |
+
* Iznemam no saraksta epasta adresi
|
866 |
+
*
|
867 |
+
* @example mgapi_listUnsubscribe.php
|
868 |
+
* @example xml-rpc_listUnsubscribe.php
|
869 |
+
*
|
870 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
871 |
+
* @param string $phone Phone vai "id", ko var atrast ar "listMemberInfo" metodi
|
872 |
+
* @param boolean $delete_member Dzest vai nedzest lietotaju no saraksta. Pec noklusejuma false
|
873 |
+
* @param boolean $send_notify Nosutit vai nesutit pazinojumu uz epastu, kas noradits saraksta opcijas. Pec noklusejuma false
|
874 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
875 |
+
*/
|
876 |
+
function listUnsubscribeSMS($id, $phone, $delete_member = false, $send_notify = true) {
|
877 |
+
$params = array();
|
878 |
+
$params["id"] = $id;
|
879 |
+
$params["phone"] = $phone;
|
880 |
+
$params["delete_member"] = $delete_member;
|
881 |
+
$params["send_notify"] = $send_notify;
|
882 |
+
return $this->callServer("listUnsubscribeSMS", $params);
|
883 |
+
}
|
884 |
+
|
885 |
+
/**
|
886 |
+
* Labo epasta adresi, MERGE laukus saraksta lietotajam
|
887 |
+
*
|
888 |
+
* @example mgapi_listUpdateMember.php
|
889 |
+
* @example xml-rpc_listUpdateMember.php
|
890 |
+
*
|
891 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
892 |
+
* @param string $email_address Epasta adrese vai "id", ko var atrast ar "listMemberInfo" metodi
|
893 |
+
* @param array $merge_vars Masivs ar MERGE laukiem. MERGE laukus var apskatities pie metodes "listSubscribe"
|
894 |
+
* @param string $email_type Epasta tips: "html" vai "plain". Nav obligats
|
895 |
+
* @return boolean true ja ir izdevies, false ja nav izdevies
|
896 |
+
*/
|
897 |
+
function listUpdateMember($id, $email_address, $merge_vars, $email_type = '') {
|
898 |
+
$params = array();
|
899 |
+
$params["id"] = $id;
|
900 |
+
$params["email_address"] = $email_address;
|
901 |
+
$params["merge_vars"] = $merge_vars;
|
902 |
+
$params["email_type"] = $email_type;
|
903 |
+
return $this->callServer("listUpdateMember", $params);
|
904 |
+
}
|
905 |
+
|
906 |
+
/**
|
907 |
+
* Pievienojam sarakstam vairakus epastus
|
908 |
+
*
|
909 |
+
* @example mgapi_listBatchSubscribe.php
|
910 |
+
* @example xml-rpc_listBatchSubscribe.php
|
911 |
+
*
|
912 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
913 |
+
* @param array $batch Masivs, kas satur epastu datus. Epasta dati ir masivs ar ada atslegam: "EMAIL" epasta adresei, "EMAIL_TYPE" epasta tips (html vai plain)
|
914 |
+
* @param boolean $double_optin Vai sutit apstiprinajuma vestuli. Pec noklusejuma true
|
915 |
+
* @param boolean $update_existing Vai atjaunot eksistejoos epastus. Pec noklusejuma false (atgriezis kludas pazinojumu)
|
916 |
+
* @return struct Masivs, kas satur skaitu, cik izevies iznemt un kludu pazinojumus
|
917 |
+
* @returnf integer success_count Skaits, cik izdevas
|
918 |
+
* @returnf integer error_count Skaits, cik neizdevas
|
919 |
+
* @returnf array errors Masivs ar kludas pazinojumiem. Satur "code", "message", un "email"
|
920 |
+
*/
|
921 |
+
function listBatchSubscribe($id, $batch, $double_optin = true, $update_existing = false) {
|
922 |
+
$params = array();
|
923 |
+
$params["id"] = $id;
|
924 |
+
$params["batch"] = $batch;
|
925 |
+
$params["double_optin"] = $double_optin;
|
926 |
+
$params["update_existing"] = $update_existing;
|
927 |
+
return $this->callServer("listBatchSubscribe", $params);
|
928 |
+
}
|
929 |
+
|
930 |
+
/**
|
931 |
+
* Pievienojam sarakstam vairakus epastus
|
932 |
+
*
|
933 |
+
* @example mgapi_listBatchSubscribe.php
|
934 |
+
* @example xml-rpc_listBatchSubscribe.php
|
935 |
+
*
|
936 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
937 |
+
* @param array $batch Masivs, kas satur epastu datus. Epasta dati ir masivs ar ada atslegam: "SMS" epasta adresei
|
938 |
+
* @param boolean $update_existing Vai atjaunot eksistejoos epastus. Pec noklusejuma false (atgriezis kludas pazinojumu)
|
939 |
+
* @return struct Masivs, kas satur skaitu, cik izevies iznemt un kludu pazinojumus
|
940 |
+
* @returnf integer success_count Skaits, cik izdevas
|
941 |
+
* @returnf integer error_count Skaits, cik neizdevas
|
942 |
+
* @returnf array errors Masivs ar kludas pazinojumiem. Satur "code", "message", un "phone"
|
943 |
+
*/
|
944 |
+
function listBatchSubscribeSMS($id, $batch, $update_existing = false) {
|
945 |
+
$params = array();
|
946 |
+
$params["id"] = $id;
|
947 |
+
$params["batch"] = $batch;
|
948 |
+
$params["double_optin"] = $double_optin;
|
949 |
+
$params["update_existing"] = $update_existing;
|
950 |
+
return $this->callServer("listBatchSubscribeSMS", $params);
|
951 |
+
}
|
952 |
+
|
953 |
+
/**
|
954 |
+
* Iznemam no saraksta vairakus epastus
|
955 |
+
*
|
956 |
+
* @example mgapi_listBatchUnsubscribe.php
|
957 |
+
* @example xml-rpc_listBatchUnsubscribe.php
|
958 |
+
*
|
959 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
960 |
+
* @param array $emails Epastu masivs
|
961 |
+
* @param boolean $delete_member Dzest vai nedzest lietotaju no saraksta. Pec noklusejuma false
|
962 |
+
* @param boolean $send_goodbye Nosutit vai nesutit pazinojumu epasta lietotajam. Pec noklusejuma true
|
963 |
+
* @param boolean $send_notify Nosutit vai nesutit pazinojumu uz epastu, kas noradits saraksta opcijas. Pec noklusejuma false
|
964 |
+
* @return struct Masivs, kas satur skaitu, cik izevies iznemt un kludu pazinojumus
|
965 |
+
* @returnf integer success_count Skaits, cik izdevas
|
966 |
+
* @returnf integer error_count Skaits, cik neizdevas
|
967 |
+
* @returnf array errors Masivs ar kludas pazinojumiem. Satur "code", "message", un "email"
|
968 |
+
*/
|
969 |
+
function listBatchUnsubscribe($id, $emails, $delete_member = false, $send_goodbye = true, $send_notify = false) {
|
970 |
+
$params = array();
|
971 |
+
$params["id"] = $id;
|
972 |
+
$params["emails"] = $emails;
|
973 |
+
$params["delete_member"] = $delete_member;
|
974 |
+
$params["send_goodbye"] = $send_goodbye;
|
975 |
+
$params["send_notify"] = $send_notify;
|
976 |
+
return $this->callServer("listBatchUnsubscribe", $params);
|
977 |
+
}
|
978 |
+
|
979 |
+
/**
|
980 |
+
* Iznemam no saraksta vairakus epastus
|
981 |
+
*
|
982 |
+
* @example mgapi_listBatchUnsubscribe.php
|
983 |
+
* @example xml-rpc_listBatchUnsubscribe.php
|
984 |
+
*
|
985 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
986 |
+
* @param array $phones Tālruņu masivs
|
987 |
+
* @param boolean $delete_member Dzest vai nedzest lietotaju no saraksta. Pec noklusejuma false
|
988 |
+
* @param boolean $send_goodbye Nosutit vai nesutit pazinojumu epasta lietotajam. Pec noklusejuma true
|
989 |
+
* @param boolean $send_notify Nosutit vai nesutit pazinojumu uz epastu, kas noradits saraksta opcijas. Pec noklusejuma false
|
990 |
+
* @return struct Masivs, kas satur skaitu, cik izevies iznemt un kludu pazinojumus
|
991 |
+
* @returnf integer success_count Skaits, cik izdevas
|
992 |
+
* @returnf integer error_count Skaits, cik neizdevas
|
993 |
+
* @returnf array errors Masivs ar kludas pazinojumiem. Satur "code", "message", un "email"
|
994 |
+
*/
|
995 |
+
function listBatchUnsubscribeSMS($id, $phones, $delete_member = false, $send_notify = false) {
|
996 |
+
$params = array();
|
997 |
+
$params["id"] = $id;
|
998 |
+
$params["phones"] = $phones;
|
999 |
+
$params["delete_member"] = $delete_member;
|
1000 |
+
$params["send_notify"] = $send_notify;
|
1001 |
+
return $this->callServer("listBatchUnsubscribeSMS", $params);
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
/**
|
1005 |
+
* Atrodam epasta info sarkaksta
|
1006 |
+
*
|
1007 |
+
* @example mgapi_listMembers.php
|
1008 |
+
* @example xml-rpc_listMembers.php
|
1009 |
+
*
|
1010 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
1011 |
+
* @param string $status Epasta statuss (subscribed, unsubscribed, inactive, bounced), pec noklusejuma subscribed
|
1012 |
+
* @param integer $start Nav obligats. Nepiecieams lielam sarakstam. Lapas numurs, no kuras sakt. Pirmajai lapai atbilst numurs 0
|
1013 |
+
* @param integer $limit Nav obligats. Nepiecieams lielam sarakstam. Skaits, cik daudz atgriezt epastus. Pec noklusejuma 100, maksimalais ir 15000
|
1014 |
+
* @return array Masivs ar lietotaju sarakstu
|
1015 |
+
* @returnf string email Lietotaja epasts
|
1016 |
+
* @returnf date timestamp Peivienoanas datums
|
1017 |
+
*/
|
1018 |
+
function listMembers($id, $status = 'subscribed', $start = 0, $limit = 100) {
|
1019 |
+
$params = array();
|
1020 |
+
$params["id"] = $id;
|
1021 |
+
$params["status"] = $status;
|
1022 |
+
$params["start"] = $start;
|
1023 |
+
$params["limit"] = $limit;
|
1024 |
+
return $this->callServer("listMembers", $params);
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
/**
|
1028 |
+
* Atrodam epasta info sarkaksta
|
1029 |
+
*
|
1030 |
+
* @example mgapi_listMemberInfo.php
|
1031 |
+
* @example xml-rpc_listMemberInfo.php
|
1032 |
+
*
|
1033 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
1034 |
+
* @param string $email_address Epasta adrese vai epasta ID saraksta
|
1035 |
+
* @return array Masivs, kas satur epasta informaciju
|
1036 |
+
* @returnf string id Unikals epasta id
|
1037 |
+
* @returnf string email Epasta adrese
|
1038 |
+
* @returnf string email_type Epasta tips: html vai plain
|
1039 |
+
* @returnf array merges Masivs ar papildus laukiem
|
1040 |
+
* @returnf string status Epasta status: inactive, subscribed, unsubscribed, bounced
|
1041 |
+
* @returnf string ip_opt IP adrese, no kuras tika apstiprinats epasts
|
1042 |
+
* @returnf string ip_signup IP adrese, no kuras tika aizpildita forma
|
1043 |
+
* @returnf date timestamp Laiks, kad tika pievienots sarakstam
|
1044 |
+
*/
|
1045 |
+
function listMemberInfo($id, $email_address) {
|
1046 |
+
$params = array();
|
1047 |
+
$params["id"] = $id;
|
1048 |
+
$params["email_address"] = $email_address;
|
1049 |
+
return $this->callServer("listMemberInfo", $params);
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
/**
|
1053 |
+
* Saraksta pieauguma informacija pa meneiem
|
1054 |
+
*
|
1055 |
+
* @example mgapi_listGrowthHistory.php
|
1056 |
+
* @example xml-rpc_listGrowthHistory.php
|
1057 |
+
*
|
1058 |
+
* @param string $id Saraksta ID. Saraksta ID var atrast ar lists() metodi
|
1059 |
+
* @return array Masivs pa meneiem
|
1060 |
+
* @returnf string month Gads un menesis YYYY-MM formata
|
1061 |
+
* @returnf integer existing Skaits, cik bija lietotaju menea sakuma
|
1062 |
+
* @returnf integer imports Skaits, cik daudz tekoaja menesi tika pievienoti lietotaji
|
1063 |
+
*/
|
1064 |
+
function listGrowthHistory($id) {
|
1065 |
+
$params = array();
|
1066 |
+
$params["id"] = $id;
|
1067 |
+
return $this->callServer("listGrowthHistory", $params);
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
/**
|
1071 |
+
* Atrodam visus saraksta segmentus
|
1072 |
+
*
|
1073 |
+
* @example mgapi_listSegments.php
|
1074 |
+
* @example xml-rpc_listSegments.php
|
1075 |
+
*
|
1076 |
+
* @return array Masīvs ar saraksta segmentiem
|
1077 |
+
* @returnf string id Saraksta segmenta id.
|
1078 |
+
* @returnf integer web_id Saraksta segmenta id, kas tiek izmantots web administrācijas lapā
|
1079 |
+
* @returnf string name Saraksta segmenta nosaukums
|
1080 |
+
* @returnf date date_created Saraksta izveidošanas datums.
|
1081 |
+
* @returnf integer member_count Lietotāju skaits sarakstā
|
1082 |
+
*/
|
1083 |
+
function listSegments($id) {
|
1084 |
+
$params = array();
|
1085 |
+
$params["id"] = $id;
|
1086 |
+
return $this->callServer("listSegments", $params);
|
1087 |
+
}
|
1088 |
+
|
1089 |
+
/**
|
1090 |
+
* Izveidojam jaunu segmentu
|
1091 |
+
*
|
1092 |
+
* @example mgapi_listSegmentCreate.php
|
1093 |
+
*
|
1094 |
+
* @param string $list Saraksta ID
|
1095 |
+
* @param string $title Segmenta nosaukums
|
1096 |
+
* @param string $match Sakritības tips
|
1097 |
+
* @param array $filter Masīvs ar nosacījumu masīviem
|
1098 |
+
string field Merge lauks
|
1099 |
+
string condition Nosacījumi: is, not, isany, contains, notcontain, starts, ends, greater, less
|
1100 |
+
string value Vērtība, priekš condition
|
1101 |
+
|
1102 |
+
*
|
1103 |
+
* @return string Atgriež jaunā segmenta ID
|
1104 |
+
*/
|
1105 |
+
function listSegmentCreate($list, $title, $match, $filter) {
|
1106 |
+
$params = array();
|
1107 |
+
$params["list"] = $list;
|
1108 |
+
$params["title"] = $title;
|
1109 |
+
$params["match"] = $match;
|
1110 |
+
$params["filter"] = $filter;
|
1111 |
+
return $this->callServer("listSegmentCreate", $params);
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
/**
|
1115 |
+
* Atjaunojam segmenta parametrus
|
1116 |
+
*
|
1117 |
+
* @example mgapi_listSegmentUpdate.php
|
1118 |
+
*
|
1119 |
+
* @param string $sid Segmenta, kuru vajag labot, ID
|
1120 |
+
* @param string $name Parametra nosaukums (skatīties pie listSegmentCreate() options lauku ). Iespējamie parametri: title, match, filter
|
1121 |
+
* @return boolean true, ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
1122 |
+
*/
|
1123 |
+
function listSegmentUpdate($sid, $name, $value) {
|
1124 |
+
$params = array();
|
1125 |
+
$params["sid"] = $sid;
|
1126 |
+
$params["name"] = $name;
|
1127 |
+
$params["value"] = $value;
|
1128 |
+
return $this->callServer("listSegmentUpdate", $params);
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
/**
|
1132 |
+
* Tiek dzēsts neatgriezensiki segments. Esiet uzmanīgi!
|
1133 |
+
*
|
1134 |
+
* @example mgapi_listSegmentDelete.php
|
1135 |
+
*
|
1136 |
+
* @param string $sid Segmenta, kuru vajag dzēst, ID
|
1137 |
+
* @return boolean true ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
1138 |
+
*/
|
1139 |
+
function listSegmentDelete($sid) {
|
1140 |
+
$params = array();
|
1141 |
+
$params["sid"] = $sid;
|
1142 |
+
return $this->callServer("listSegmentDelete", $params);
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
/**
|
1146 |
+
* Noņemam nost statusu, kas lika SMS kampaņu izsūtīt kaut kad nākotnē
|
1147 |
+
*
|
1148 |
+
* @example mgapi_smsCampaignUnschedule.php
|
1149 |
+
*
|
1150 |
+
* @param string $cid SMS kampaņa, kurai vajag noņemt izsūtīšanas laiku kaut kad nākotnē, ID
|
1151 |
+
* @return boolean true ja ir veiksmīgi
|
1152 |
+
*/
|
1153 |
+
function smsCampaignUnschedule($cid) {
|
1154 |
+
$params = array();
|
1155 |
+
$params["cid"] = $cid;
|
1156 |
+
return $this->callServer("smsCampaignUnschedule", $params);
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
/**
|
1160 |
+
* Iestādam laiku, kad izsūtīt SMS kampaņu
|
1161 |
+
*
|
1162 |
+
* @example mgapi_smsCampaignSchedule.php
|
1163 |
+
*
|
1164 |
+
* @param string $cid SMS kampaņa, kurai vajag iestādīt izsūtīšanas laiku, ID
|
1165 |
+
* @param string $schedule_time Laiks, kad izsūtīt. Laiku jānorāda šādā formātā YYYY-MM-DD HH:II:SS pēc <strong>GMT</strong>
|
1166 |
+
* @return boolean true ja ir veiksmīgi
|
1167 |
+
*/
|
1168 |
+
function smsCampaignSchedule($cid, $schedule_time) {
|
1169 |
+
$params = array();
|
1170 |
+
$params["cid"] = $cid;
|
1171 |
+
$params["schedule_time"] = $schedule_time;
|
1172 |
+
return $this->callServer("smsCampaignSchedule", $params);
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
/**
|
1176 |
+
* Nosūtīt SMS kampaņu nekavējoties
|
1177 |
+
*
|
1178 |
+
* @example mgapi_smsCampaignSendNow.php
|
1179 |
+
*
|
1180 |
+
* @param string $cid SMS kampaņa, kuru vajag nosūtīt, ID
|
1181 |
+
* @return boolean true ja ir veiksmīgi
|
1182 |
+
*/
|
1183 |
+
function smsCampaignSendNow($cid) {
|
1184 |
+
$params = array();
|
1185 |
+
$params["cid"] = $cid;
|
1186 |
+
return $this->callServer("smsCampaignSendNow", $params);
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
/**
|
1190 |
+
* Atrodam visus lietotāja SMS šablonus
|
1191 |
+
*
|
1192 |
+
* @example mgapi_smsCampaignTemplates.php
|
1193 |
+
*
|
1194 |
+
* @return array Masīvs, kas satur SMS šablonus
|
1195 |
+
* @returnf integer id Šablona ID
|
1196 |
+
* @returnf string source Šablona teksts
|
1197 |
+
*/
|
1198 |
+
function smsCampaignTemplates() {
|
1199 |
+
$params = array();
|
1200 |
+
return $this->callServer("smsCampaignTemplates", $params);
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
/**
|
1204 |
+
* Izveidojam jaunu SMS kampaņu
|
1205 |
+
*
|
1206 |
+
* @example mgapi_smsCampaignCreate.php
|
1207 |
+
*
|
1208 |
+
* @param array $options Masīvs ar SMS kampaņas parametriem
|
1209 |
+
string sender Vārds, no kā tiks nosūtīta SMS. To nepieciešams piereģistrēt ar funkciju smsSenderIdRegister()
|
1210 |
+
struct recipients
|
1211 |
+
string list_id Saraksta id, to var atrast ar lists()
|
1212 |
+
integer segment_id Nav obligāts. Segmenta ID, to var atrast ar segments()
|
1213 |
+
string merge SMS lauka nosaukums, piemēram, MERGE10, SMS
|
1214 |
+
array tracking Nav obligāts. Statistikas parametru masīvs, tiek izmantotas šādas atslēgas: "clicks".
|
1215 |
+
string title Nav obligāts. Kampaņas nosaukums.
|
1216 |
+
array analytics Nav obligāts. Masīvs ar skaitītāju informāciju. Google gadījumā ir šāds pielietojums "google"=>"jūsu_google_analytics_atslēga". "jūsu_google_analytics_atslēga" tiks pievienota visiem linkiem, statistiku varēs apskatīties klienta Google Analytics kontā
|
1217 |
+
boolean unicode Nav obligāts. Nosaka, vai izsūtīt kampaņu unikodā. Lai speciālie simboli un burit rādītos SMS kampaņa, šim ir jābūt true. Pēc noklusējuma ir false
|
1218 |
+
boolean concatenate Nav obligāts. Nosaka, vai izsūtīt vairākas īsziņas, ja teksts ir par garu. Pēc noklusējuma ir false
|
1219 |
+
|
1220 |
+
* @param array $content Masīvs, kas satur vēstules saturu. Struktūra:
|
1221 |
+
text saturs Nav obligāts, ja ir norādīts template_id. SMS kampaņas saturs
|
1222 |
+
integer template_id Nav obligāts. Lietotāja SMS šablona id, nu kura tiks paņemts SMS saturs. Var atrast ar smsCampaignTemplates()
|
1223 |
+
|
1224 |
+
*
|
1225 |
+
* @return string Atgriež jaunās SMS kampaņas ID
|
1226 |
+
*/
|
1227 |
+
function smsCampaignCreate($options, $content) {
|
1228 |
+
$params = array();
|
1229 |
+
$params["options"] = $options;
|
1230 |
+
$params["content"] = $content;
|
1231 |
+
return $this->callServer("smsCampaignCreate", $params);
|
1232 |
+
}
|
1233 |
+
|
1234 |
+
/**
|
1235 |
+
* Atjaunojam kampaņas, kura vēl nav nosūtīta, parametrus
|
1236 |
+
*
|
1237 |
+
*
|
1238 |
+
* Uzmanību:<br/><ul>
|
1239 |
+
* <li>Ja Jūs izmantojat list_id, visi iepriekšējie saraksti tiks izdzēsti.</li>
|
1240 |
+
* <li>Ja Jūs izmantojat template_id, tiks pārrakstīts saturs ar šablona saturu</li>
|
1241 |
+
*
|
1242 |
+
* @example mgapi_smsCampaignUpdate.php
|
1243 |
+
*
|
1244 |
+
* @param string $cid Kampaņas, kuru vajag labot, ID
|
1245 |
+
* @param string $name Parametra nosaukums (skatīties pie smsCampaignCreate() options lauku ). Iespējamie parametri: sender, recipients, utt. Papildus parametri ir content.
|
1246 |
+
* @param mixed $value Iespējamās vērtības parametram ( skatīties campaignCreate() options lauku )
|
1247 |
+
* @return boolean true, ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
1248 |
+
*/
|
1249 |
+
function smsCampaignUpdate($cid, $name, $value) {
|
1250 |
+
$params = array();
|
1251 |
+
$params["cid"] = $cid;
|
1252 |
+
$params["name"] = $name;
|
1253 |
+
$params["value"] = $value;
|
1254 |
+
return $this->callServer("smsCampaignUpdate", $params);
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
/**
|
1258 |
+
* Kopējam kampaņu
|
1259 |
+
*
|
1260 |
+
* @example mgapi_smsCampaignReplicate.php
|
1261 |
+
*
|
1262 |
+
* @param string $cid SMS kampaņa, kuru vajag kopēt, ID
|
1263 |
+
* @return string Atgriežam jaunās SMS kampaņas ID
|
1264 |
+
*/
|
1265 |
+
function smsCampaignReplicate($cid) {
|
1266 |
+
$params = array();
|
1267 |
+
$params["cid"] = $cid;
|
1268 |
+
return $this->callServer("smsCampaignReplicate", $params);
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
/**
|
1272 |
+
* Tiek dzēsta neatgriezensiki SMS kampaņa. Esiet uzmanīgi!
|
1273 |
+
*
|
1274 |
+
* @example mgapi_smsCampaignDelete.php
|
1275 |
+
*
|
1276 |
+
* @param string $cid SMS kampaņa, kuru vajag dzēst, ID
|
1277 |
+
* @return boolean true ja ir veiksmīgi, pretējā gadījumā atgriež kļūdas paziņojumu
|
1278 |
+
*/
|
1279 |
+
function smsCampaignDelete($cid) {
|
1280 |
+
$params = array();
|
1281 |
+
$params["cid"] = $cid;
|
1282 |
+
return $this->callServer("smsCampaignDelete", $params);
|
1283 |
+
}
|
1284 |
+
|
1285 |
+
/**
|
1286 |
+
* Atgriežam SMS kampaņu sarakstu. Var pielietot filtru, lai detalizēt atlasītu
|
1287 |
+
*
|
1288 |
+
* @example mgapi_smsCampaigns.php
|
1289 |
+
*
|
1290 |
+
* @param array $filters Nav obligāts. Masīvs ar parametriem:
|
1291 |
+
string campaign_id Nav obligāts, kampaņas id
|
1292 |
+
string recipients Nav obligāts, saraksta id. To var atrast ar lists()
|
1293 |
+
string status Nav obligāts. Var atrast kampaņu pēc statusa: sent, draft, sending
|
1294 |
+
string sender Nav obligāts. Atlasa kampānu pēc sūtītāja vārda
|
1295 |
+
string title Nav obligāts. Atlasa pēc kampaņas nosaukuma
|
1296 |
+
string sendtime_start Nav obligāts. Atlasa vēstules, kas izsūtītas pēc šī datuma/laika. Formāts - YYYY-MM-DD HH:mm:ss (24hr)
|
1297 |
+
string sendtime_end Nav obligāts. Atlasa vēstules, kas izsūtītas pirms šī datuma/laika. Formāts - YYYY-MM-DD HH:mm:ss (24hr)
|
1298 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
1299 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 25. Maksimālā vērtība ir 1000
|
1300 |
+
* @return array Agriež masīvu ar SMS kampaņu sarakstu
|
1301 |
+
* @returnf string id SMS kampaņas id. To izmanto pārējām funkcijām
|
1302 |
+
* @returnf integer web_id SMS kampaņas id, kas tiek izmanots web versijā
|
1303 |
+
* @returnf string title SMS kampaņas virsraksts
|
1304 |
+
* @returnf date create_time SMS kampaņas izveidošanas datums
|
1305 |
+
* @returnf date send_time SMS kampānas nosūtīšanas datums
|
1306 |
+
* @returnf integer sms_sent Nosūtīto SMS skaits
|
1307 |
+
* @returnf string status Kampaņas statuss (sent, draft, paused, sending)
|
1308 |
+
* @returnf string sender SMS sūtītāja vārds
|
1309 |
+
* @returnf boolean analytics Integrēt vai neitegrēt Google Analytics
|
1310 |
+
* @returnf string analytcs_tag Google Analytics nosaukums kampaņai
|
1311 |
+
* @returnf boolean track_clicks Skaitīt vai neskaitīt klikšķus
|
1312 |
+
* @returnf boolean unicode Izmantot vai neizmantot unikodu
|
1313 |
+
* @returnf boolean concatenate Sadalīt vai nesadalīt vairākās īsziņās garāku īsziņu
|
1314 |
+
*/
|
1315 |
+
function smsCampaigns($filters = array(), $start = 0, $limit = 25) {
|
1316 |
+
$params = array();
|
1317 |
+
$params["filters"] = $filters;
|
1318 |
+
$params["start"] = $start;
|
1319 |
+
$params["limit"] = $limit;
|
1320 |
+
return $this->callServer("smsCampaigns", $params);
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
/**
|
1324 |
+
* Atgriež SMS kampaņas statistiku
|
1325 |
+
*
|
1326 |
+
* @example mgapi_smsCampaignStats.php
|
1327 |
+
*
|
1328 |
+
* @param string $cid SMS kampaņas id. To var atrast ar smsCampaigns()
|
1329 |
+
* @return array Masīvs, kas satur SMS kampaņas statistiku
|
1330 |
+
* @returnf integer delivered Piegādāto SMS skaits
|
1331 |
+
* @returnf integer sent Nosūtīto SMS skaits. Vēl nav saņemts gala apstiprinājums par veiksmi vai neveiksmi
|
1332 |
+
* @returnf integer queued SMS skats, kas stāv vēl izsūtīšanas rindā
|
1333 |
+
* @returnf integer undelivered Nepiegādāto SMS skaits
|
1334 |
+
* @returnf integer error Nepiegādāto SMS skaits, kuriem ir bijusi kāda tehniska kļūda piegādes procesā
|
1335 |
+
* @returnf integer other SMS ar citu piegādes statusu
|
1336 |
+
* @returnf integer clicks Skaits, cik daudz ir spiests uz linkiem
|
1337 |
+
* @returnf integer unique_clicks Unikālie klikšķi uz saitēm
|
1338 |
+
* @returnf date last_click Datums, kad pēdējo reizi spiests uz linkiem
|
1339 |
+
* @returnf integer users_who_clicked Lietotāju skaits, kas spieduši uz saitēm
|
1340 |
+
* @returnf integer sms_sent Kopējais skaits, cik vēstules ir izsūtītas
|
1341 |
+
*/
|
1342 |
+
function smsCampaignStats($cid) {
|
1343 |
+
$params = array();
|
1344 |
+
$params["cid"] = $cid;
|
1345 |
+
return $this->callServer("smsCampaignStats", $params);
|
1346 |
+
}
|
1347 |
+
|
1348 |
+
/**
|
1349 |
+
* Atrodam SMS kampaņas visus linkus
|
1350 |
+
*
|
1351 |
+
* @example mgapi_smsCampaignClickStats.php
|
1352 |
+
*
|
1353 |
+
* @param string $cid SMS kampaņas id. To var atrast ar smsCampaigns()
|
1354 |
+
* @return struct urls Saišu masīvs, kur atslēga ir saite
|
1355 |
+
* @returnf integer clicks Kopējais klikšķu skaits
|
1356 |
+
* @returnf integer unique Unikālo klikšķu skaits
|
1357 |
+
*/
|
1358 |
+
function smsCampaignClickStats($cid) {
|
1359 |
+
$params = array();
|
1360 |
+
$params["cid"] = $cid;
|
1361 |
+
return $this->callServer("smsCampaignClickStats", $params);
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
/**
|
1365 |
+
* Atgriež SMS kampaņas nepiegādāto īsziņu statusus
|
1366 |
+
*
|
1367 |
+
* @example mgapi_smsCampaignBounces.php
|
1368 |
+
*
|
1369 |
+
* @param string $cid SMS kampaņas id. To var atrast ar smsCampaigns()
|
1370 |
+
* @param integer $start Nav obligāts. Lapa, no kuras izvadīt datus. Pēc noklusējuma ir 0, kas atbilst pirmajai lapai
|
1371 |
+
* @param integer $limit Nav obligāts. Rezultātu skaits lapā. Pēc noklusējuma 25. Maksimālā vērtība ir 50
|
1372 |
+
* @return array bounces Masīvs, kas satur nepiegādātās SMS
|
1373 |
+
* @returnf string phone Tālruņa numurs, uz kuru neizdevās nosūtīt
|
1374 |
+
* @returnf string reason Iemesls, kāpēc netika piegādāts
|
1375 |
+
*/
|
1376 |
+
function smsCampaignBounces($cid, $start = 0, $limit = 25) {
|
1377 |
+
$params = array();
|
1378 |
+
$params["cid"] = $cid;
|
1379 |
+
$params["start"] = $start;
|
1380 |
+
$params["limit"] = $limit;
|
1381 |
+
return $this->callServer("smsCampaignBounces", $params);
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
/**
|
1385 |
+
* Nosūtam pieprasījumu reģistrēt SMS sūtītāja vārdu
|
1386 |
+
*
|
1387 |
+
* @example mgapi_smsSenderIdRegister.php
|
1388 |
+
*
|
1389 |
+
* @param string $sender Vēlamais SMS sūtītāja vārds
|
1390 |
+
* @param string $phone Rezerves mobilā tālr. numurs
|
1391 |
+
* @param string $company Uzņēmuma nosaukums
|
1392 |
+
* @param string $fullname Kontaktpersonas vārds, uzvārds
|
1393 |
+
* @param string $companyposition Pozīcija uzņēmumā
|
1394 |
+
* @param string $comments Papildus komentāri
|
1395 |
+
* @returnf boolean Vai ir pieņemts izskatīšanai
|
1396 |
+
*/
|
1397 |
+
function smsSenderIdRegister($sender, $phone, $company, $fullname, $companyposition, $comments = '') {
|
1398 |
+
$params = array();
|
1399 |
+
$params["sender"] = $sender;
|
1400 |
+
$params["phone"] = $phone;
|
1401 |
+
$params["company"] = $company;
|
1402 |
+
$params["fullname"] = $fullname;
|
1403 |
+
$params["companyposition"] = $companyposition;
|
1404 |
+
$params["comments"] = $comments;
|
1405 |
+
return $this->callServer("smsSenderIdRegister", $params);
|
1406 |
+
}
|
1407 |
+
|
1408 |
+
/**
|
1409 |
+
* Atgriež dažādu informaciju par lietotaju kontu
|
1410 |
+
*
|
1411 |
+
* @example mgapi_getAccountDetails.php
|
1412 |
+
* @example xml-rpc_getAccountDetails.php
|
1413 |
+
*
|
1414 |
+
* @return array Masivs, kas satur da˛adu informaciju par is API atlsegas lietotaja kontu
|
1415 |
+
* @returnf string user_id Lietotaja unikalais ID, tas tiek izmantots buvejot da˛adas saites
|
1416 |
+
* @returnf string username Lietotaja lietotajvards
|
1417 |
+
* @returnf bool is_trial Vai lietotajs ir trial
|
1418 |
+
* @returnf int emails_left Skaits, cik daudz epastus var nosutit
|
1419 |
+
* @returnf datetime first_payment Pirma maksajuma datums
|
1420 |
+
* @returnf datetime last_payment Pedeja maksajuma datums
|
1421 |
+
* @returnf int times_logged_in Skaits, cik daudz reizes lietotajs caur web ir ielogojies
|
1422 |
+
* @returnf datetime last_login Datums, kad pedejo reizi bija ielogojies caur web
|
1423 |
+
* @returnf array contact Masivs, kas satur kontkatinformaciju: Vards, uzvards, epasts, uznemuma nosaukums, adrese, majas lapas adrese, telefons, fakss
|
1424 |
+
* @returnf array orders Masivs, kas satur informaciju par samaksatajiem rekiniem: rekina numurs, plans, cena, valuta, izrakstianas datums, pakas deriguma termin
|
1425 |
+
*/
|
1426 |
+
function getAccountDetails() {
|
1427 |
+
$params = array();
|
1428 |
+
return $this->callServer("getAccountDetails", $params);
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
/**
|
1432 |
+
* Atrodam visu sarakstu ID, kuros ir šis epasts
|
1433 |
+
*
|
1434 |
+
* @example mgapi_listsForEmail.php
|
1435 |
+
* @example xml-rpc_listsForEmail.php
|
1436 |
+
*
|
1437 |
+
* @param string $email_address epasta adrese
|
1438 |
+
* @return array an array Masivs, kas satur sarakstu ID
|
1439 |
+
*/
|
1440 |
+
function listsForEmail($email_address) {
|
1441 |
+
$params = array();
|
1442 |
+
$params["email_address"] = $email_address;
|
1443 |
+
return $this->callServer("listsForEmail", $params);
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
/**
|
1447 |
+
* Atrodam visas API atslegas
|
1448 |
+
*
|
1449 |
+
* @example mgapi_apikeys.php
|
1450 |
+
* @example xml-rpc_apikeys.php
|
1451 |
+
*
|
1452 |
+
* @param string $username lietotaja vards
|
1453 |
+
* @param string $password lietotaja parole
|
1454 |
+
* @param boolean $expired nav obligats - radit vai neradit atslegas, kuras vairs nav derigas. Pec noklusejuma ir false
|
1455 |
+
* @return array API atslegu masivs, kas satur:
|
1456 |
+
* @returnf string apikey o atslegu var izmantot, lai pieslegtos API
|
1457 |
+
* @returnf string created_at Datums, kad atslega ir izveidota
|
1458 |
+
* @returnf string expired_at Datums, kad ta tika atzimeta, ka neaktiva
|
1459 |
+
*/
|
1460 |
+
function apikeys($username, $password, $expired = false) {
|
1461 |
+
$params = array();
|
1462 |
+
$params["username"] = $username;
|
1463 |
+
$params["password"] = $password;
|
1464 |
+
$params["expired"] = $expired;
|
1465 |
+
return $this->callServer("apikeys", $params);
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
/**
|
1469 |
+
* Izveidojam jaunu API atslegu
|
1470 |
+
*
|
1471 |
+
* @example mgapi_apikeyAdd.php
|
1472 |
+
* @example xml-rpc_apikeyAdd.php
|
1473 |
+
*
|
1474 |
+
* @param string $username lietotaja vards
|
1475 |
+
* @param string $password lietotaja parole
|
1476 |
+
* @return string atgrie˛ jaunu API atslegu
|
1477 |
+
*/
|
1478 |
+
function apikeyAdd($username, $password) {
|
1479 |
+
$params = array();
|
1480 |
+
$params["username"] = $username;
|
1481 |
+
$params["password"] = $password;
|
1482 |
+
return $this->callServer("apikeyAdd", $params);
|
1483 |
+
}
|
1484 |
+
|
1485 |
+
/**
|
1486 |
+
* Atzimejam ka neaktivu API atslegu
|
1487 |
+
*
|
1488 |
+
* @example mgapi_apikeyExpire.php
|
1489 |
+
* @example xml-rpc_apikeyExpire.php
|
1490 |
+
*
|
1491 |
+
* @param string $username lietotaja vards
|
1492 |
+
* @param string $password lietotaja parole
|
1493 |
+
* @return boolean true, ja izdevas nomainit statusu
|
1494 |
+
*/
|
1495 |
+
function apikeyExpire($username, $password) {
|
1496 |
+
$params = array();
|
1497 |
+
$params["username"] = $username;
|
1498 |
+
$params["password"] = $password;
|
1499 |
+
return $this->callServer("apikeyExpire", $params);
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
/**
|
1503 |
+
* Atrodam API atslegu
|
1504 |
+
*
|
1505 |
+
* @example mgapi_login.php
|
1506 |
+
* @example xml-rpc_login.php
|
1507 |
+
*
|
1508 |
+
* @param string $username lietotaja vards
|
1509 |
+
* @param string $password lietotaja parole
|
1510 |
+
* @return string tiek atgriezta API atslega, ja tadas vel nav, tad tiek izveidota
|
1511 |
+
*/
|
1512 |
+
function login($username, $password) {
|
1513 |
+
$params = array();
|
1514 |
+
$params["username"] = $username;
|
1515 |
+
$params["password"] = $password;
|
1516 |
+
return $this->callServer("login", $params);
|
1517 |
+
}
|
1518 |
+
|
1519 |
+
/**
|
1520 |
+
* "ping" - vienkar veids, ka parbaudit, vai viss ir kartiba. Ja ir kadas problemas, tiks atgriezts par to pazinojums.
|
1521 |
+
*
|
1522 |
+
* @example mgapi_ping.php
|
1523 |
+
* @example xml-rpc_ping.php
|
1524 |
+
*
|
1525 |
+
* @return string tiek atgriezts teksts "Everything's Ok!", ja viss ir kartiba, ja nav, tad atgrie˛ kludas pazinojumu
|
1526 |
+
*/
|
1527 |
+
function ping() {
|
1528 |
+
$params = array();
|
1529 |
+
return $this->callServer("ping", $params);
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
/**
|
1533 |
+
* Piesledzas pie servera uz izsauc nepiecieamo metodi un atgrie˛ rezultatu
|
1534 |
+
* o funkciju nav nepiecieams izsaukt manuali
|
1535 |
+
*/
|
1536 |
+
function callServer($method, $params) {
|
1537 |
+
$host = $this->apiUrl["host"];
|
1538 |
+
$params["apikey"] = $this->api_key;
|
1539 |
+
|
1540 |
+
$this->errorMessage = "";
|
1541 |
+
$this->errorCode = "";
|
1542 |
+
$post_vars = $this->httpBuildQuery($params);
|
1543 |
+
|
1544 |
+
$payload = "POST " . $this->apiUrl["path"] . "?" . $this->apiUrl["query"] . "&method=" . $method . " HTTP/1.0\r\n";
|
1545 |
+
$payload .= "Host: " . $host . "\r\n";
|
1546 |
+
$payload .= "User-Agent: MGAPI/" . $this->version ."\r\n";
|
1547 |
+
$payload .= "Content-type: application/x-www-form-urlencoded\r\n";
|
1548 |
+
$payload .= "Content-length: " . strlen($post_vars) . "\r\n";
|
1549 |
+
$payload .= "Connection: close \r\n\r\n";
|
1550 |
+
$payload .= $post_vars;
|
1551 |
+
|
1552 |
+
ob_start();
|
1553 |
+
if ($this->secure){
|
1554 |
+
$sock = fsockopen("ssl://".$host, 443, $errno, $errstr, 30);
|
1555 |
+
} else {
|
1556 |
+
$sock = fsockopen($host, 80, $errno, $errstr, 30);
|
1557 |
+
}
|
1558 |
+
if(!$sock) {
|
1559 |
+
$this->errorMessage = "Could not connect (ERR $errno: $errstr)";
|
1560 |
+
$this->errorCode = "-99";
|
1561 |
+
ob_end_clean();
|
1562 |
+
return false;
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
$response = "";
|
1566 |
+
fwrite($sock, $payload);
|
1567 |
+
stream_set_timeout($sock, $this->timeout);
|
1568 |
+
$info = stream_get_meta_data($sock);
|
1569 |
+
while ((!feof($sock)) && (!$info["timed_out"])) {
|
1570 |
+
$response .= fread($sock, $this->chunkSize);
|
1571 |
+
$info = stream_get_meta_data($sock);
|
1572 |
+
}
|
1573 |
+
if ($info["timed_out"]) {
|
1574 |
+
$this->errorMessage = "Could not read response (timed out)";
|
1575 |
+
$this->errorCode = -98;
|
1576 |
+
}
|
1577 |
+
fclose($sock);
|
1578 |
+
ob_end_clean();
|
1579 |
+
if ($info["timed_out"]) return false;
|
1580 |
+
|
1581 |
+
list($throw, $response) = explode("\r\n\r\n", $response, 2);
|
1582 |
+
|
1583 |
+
if(ini_get("magic_quotes_runtime")) $response = stripslashes($response);
|
1584 |
+
|
1585 |
+
$serial = unserialize($response);
|
1586 |
+
if($response && $serial === false) {
|
1587 |
+
$response = array("error" => "Bad Response. Got This: " . $response, "code" => "-99");
|
1588 |
+
} else {
|
1589 |
+
$response = $serial;
|
1590 |
+
}
|
1591 |
+
if(is_array($response) && isset($response["error"])) {
|
1592 |
+
$this->errorMessage = $response["error"];
|
1593 |
+
$this->errorCode = $response["code"];
|
1594 |
+
return false;
|
1595 |
+
}
|
1596 |
+
|
1597 |
+
return $response;
|
1598 |
+
}
|
1599 |
+
|
1600 |
+
/**
|
1601 |
+
* Definejam funkciju, kas aizstaj http_build_query sistemam, kuras tas nav
|
1602 |
+
*/
|
1603 |
+
function httpBuildQuery($params, $key = NULL) {
|
1604 |
+
if(!function_exists('http_build_query')) {
|
1605 |
+
$ret = array();
|
1606 |
+
|
1607 |
+
foreach((array) $params as $name => $val) {
|
1608 |
+
$name = urlencode($name);
|
1609 |
+
if($key !== null) {
|
1610 |
+
$name = $key . "[" . $name . "]";
|
1611 |
+
}
|
1612 |
+
|
1613 |
+
if(is_array($val) || is_object($val)) {
|
1614 |
+
$ret[] = $this->httpBuildQuery($val, $name);
|
1615 |
+
} elseif($val !== null) {
|
1616 |
+
$ret[] = $name . "=" . urlencode($val);
|
1617 |
+
}
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
return implode("&", $ret);
|
1621 |
+
} else {
|
1622 |
+
return http_build_query((array)$params, $key);
|
1623 |
+
}
|
1624 |
+
}
|
1625 |
+
}
|
1626 |
+
|
1627 |
+
?>
|
app/code/community/Mailigen/Synchronizer/controllers/Adminhtml/MailigenController.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Adminhtml_MailigenController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
public function syncAction(){
|
6 |
+
|
7 |
+
$mailigen = Mage::getModel('mailigen_synchronizer/mailigen');
|
8 |
+
$mailigen->sync();
|
9 |
+
|
10 |
+
$this->_redirect('*/newsletter_subscriber/index');
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
app/code/community/Mailigen/Synchronizer/etc/config.xml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mailigen_Synchronizer>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Mailigen_Synchronizer>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<Mailigen_Synchronizer>
|
11 |
+
<class>Mailigen_Synchronizer_Helper</class>
|
12 |
+
</Mailigen_Synchronizer>
|
13 |
+
</helpers>
|
14 |
+
<models>
|
15 |
+
<mailigen_synchronizer>
|
16 |
+
<class>Mailigen_Synchronizer_Model</class>
|
17 |
+
</mailigen_synchronizer>
|
18 |
+
<!-- we rewrite Newsletter Module -->
|
19 |
+
<newsletter>
|
20 |
+
<rewrite>
|
21 |
+
<subscriber>Mailigen_Synchronizer_Model_Newsletter_Subscriber</subscriber>
|
22 |
+
</rewrite>
|
23 |
+
</newsletter>
|
24 |
+
</models>
|
25 |
+
<blocks>
|
26 |
+
<adminhtml>
|
27 |
+
<rewrite>
|
28 |
+
<newsletter_subscriber_grid>Mailigen_Synchronizer_Block_Newsletter_Subscriber_Grid</newsletter_subscriber_grid>
|
29 |
+
</rewrite>
|
30 |
+
</adminhtml>
|
31 |
+
</blocks>
|
32 |
+
<events>
|
33 |
+
<newsletter_subscriber_save_commit_after>
|
34 |
+
<observers>
|
35 |
+
<newsletter_subscriber_newsletter_subscriber_create_after>
|
36 |
+
<type>singleton</type>
|
37 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
38 |
+
<method>newsletter_subscriber_create_after</method>
|
39 |
+
</newsletter_subscriber_newsletter_subscriber_create_after>
|
40 |
+
</observers>
|
41 |
+
</newsletter_subscriber_save_commit_after>
|
42 |
+
<admin_system_config_changed_section_mailigen_settings>
|
43 |
+
<observers>
|
44 |
+
<newsletter_subscriber_admin_system_config_changed_section_mailigen_settings>
|
45 |
+
<type>singleton</type>
|
46 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
47 |
+
<method>admin_system_config_changed_section_mailigen_settings</method>
|
48 |
+
</newsletter_subscriber_admin_system_config_changed_section_mailigen_settings>
|
49 |
+
</observers>
|
50 |
+
</admin_system_config_changed_section_mailigen_settings>
|
51 |
+
</events>
|
52 |
+
</global>
|
53 |
+
<admin>
|
54 |
+
<routers>
|
55 |
+
<adminhtml>
|
56 |
+
<args>
|
57 |
+
<modules>
|
58 |
+
<newsletter_subscriber before="Mage_Adminhtml">Mailigen_Synchronizer_Adminhtml</newsletter_subscriber>
|
59 |
+
</modules>
|
60 |
+
</args>
|
61 |
+
</adminhtml>
|
62 |
+
</routers>
|
63 |
+
</admin>
|
64 |
+
<adminhtml>
|
65 |
+
<acl>
|
66 |
+
<resources>
|
67 |
+
<all>
|
68 |
+
<title>Allow Everything</title>
|
69 |
+
</all>
|
70 |
+
<admin>
|
71 |
+
<children>
|
72 |
+
<system>
|
73 |
+
<children>
|
74 |
+
<config>
|
75 |
+
<children>
|
76 |
+
<mailigen_settings>
|
77 |
+
<title>Mailigen - Settings</title>
|
78 |
+
</mailigen_settings>
|
79 |
+
</children>
|
80 |
+
</config>
|
81 |
+
</children>
|
82 |
+
</system>
|
83 |
+
</children>
|
84 |
+
</admin>
|
85 |
+
</resources>
|
86 |
+
</acl>
|
87 |
+
</adminhtml>
|
88 |
+
<crontab>
|
89 |
+
<jobs>
|
90 |
+
<Mailigen_Synchronizer>
|
91 |
+
<schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
|
92 |
+
<run><model>newsletter_subscriber/observer::daily_sync</model></run>
|
93 |
+
</Mailigen_Synchronizer>
|
94 |
+
</jobs>
|
95 |
+
</crontab>
|
96 |
+
</config>
|
97 |
+
|
app/code/community/Mailigen/Synchronizer/etc/system.xml
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<mailigen_settings translate="label" module="Mailigen_Synchronizer">
|
5 |
+
<label>Mailigen Configuration</label>
|
6 |
+
<tab>customer</tab>
|
7 |
+
<sort_order>1000</sort_order>
|
8 |
+
<show_in_default>1</show_in_default>
|
9 |
+
<show_in_website>1</show_in_website>
|
10 |
+
<show_in_store>1</show_in_store>
|
11 |
+
<groups>
|
12 |
+
<mailigen_general_group translate="label" module="Mailigen_Synchronizer">
|
13 |
+
<label>General</label>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1000</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<fields>
|
20 |
+
<mailigen_general_status translate="label">
|
21 |
+
<label>Enabled</label>
|
22 |
+
<frontend_type>select</frontend_type>
|
23 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
</mailigen_general_status>
|
29 |
+
<mailigen_general_api_key translate="label">
|
30 |
+
<label>Api Key: </label>
|
31 |
+
<comment>API Key - see http://admin.mailigen.com/settings/api</comment>
|
32 |
+
<frontend_type>text</frontend_type>
|
33 |
+
<sort_order>2</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>1</show_in_website>
|
36 |
+
<show_in_store>1</show_in_store>
|
37 |
+
</mailigen_general_api_key>
|
38 |
+
<mailigen_general_list translate="label">
|
39 |
+
<label>Contact List</label>
|
40 |
+
<frontend_type>select</frontend_type>
|
41 |
+
<source_model>mailigen_synchronizer/list</source_model>
|
42 |
+
<sort_order>3</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<comment>By selecting a new list option you'll be able to create a new Mailigen list directly from this panel.</comment>
|
47 |
+
<!--
|
48 |
+
<depends>
|
49 |
+
<mailigen_general_api_key></mailigen_general_api_key>
|
50 |
+
</depends>
|
51 |
+
-->
|
52 |
+
</mailigen_general_list>
|
53 |
+
<mailigen_general_new_list translate="label">
|
54 |
+
<label>New List Title</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>4</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
<comment>Type the title of your new list. During the save, the list will be created and it will become the current contact list.</comment>
|
61 |
+
<depends>
|
62 |
+
<mailigen_general_list></mailigen_general_list>
|
63 |
+
</depends>
|
64 |
+
</mailigen_general_new_list>
|
65 |
+
<mailigen_autosync_list translate="label">
|
66 |
+
<label>Auto Sync List</label>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
69 |
+
<sort_order>5</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
<comment>If set to yes, this will perform batch syncronization of your list at 1:00 AM every night. You must have CRON setup on your store for this feature to work.</comment>
|
74 |
+
</mailigen_autosync_list>
|
75 |
+
<mailigen_default_emails translate="label">
|
76 |
+
<label>Enable Mailigen Emails</label>
|
77 |
+
<frontend_type>select</frontend_type>
|
78 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
79 |
+
<sort_order>6</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
<comment>If set to yes, this will disable the Magento "Subscription Success","Subscription Confirmation" and the "Unsubscription Confirmation" emails. Mailigen will send these emails for you</comment>
|
84 |
+
</mailigen_default_emails>
|
85 |
+
</fields>
|
86 |
+
</mailigen_general_group>
|
87 |
+
</groups>
|
88 |
+
</mailigen_settings>
|
89 |
+
</sections>
|
90 |
+
</config>
|
app/etc/modules/Mailigen_Synchronizer.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mailigen_Synchronizer>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Mailigen_Synchronizer>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Mailigen_Synchronizer</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GNU General Public License (GPL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Two-way sync between Magento email newsletter subscriber list and Mailigen email list</summary>
|
10 |
+
<description>"This extension enables a two-way synchronization between your Magento email newsletter subscriber list and your Mailigen email list. It is easy and quick to install and configure, no complex actions or knowledge of programming needed.
|
11 |
+

|
12 |
+
Feature-rich synchronization
|
13 |
+

|
14 |
+
- Automatic synchronization between your Magento email subscriber list and one of your Mailigen email lists. When users subscribe to the newsletter in Magento, they will be added to the selected Mailigen contact list.
|
15 |
+
- Two-way synchronization when it comes to subscriber status change. When users unsubscribe from your Magento list, they will be removed also from your Mailigen list. And vice versa, users will be removed from your Magento list when unsubscribed from your Mailigen list.
|
16 |
+

|
17 |
+
For more detailed information, instructions and usage of this extension, please visit Mailigen Integrations page or contact our support team.
|
18 |
+

|
19 |
+
Mailigen provides email and integrated marketing services covering full email automation. See a full integration list in Mailigen Integrations page."</description>
|
20 |
+
<notes>- Automatic synchronization between your Magento email subscriber list and one of your Mailigen email lists. When users subscribe to the newsletter in Magento, they will be added to the selected Mailigen contact list.
|
21 |
+
- Two-way synchronization when it comes to subscriber status change. When users unsubscribe from your Magento list, they will be removed also from your Mailigen list. And vice versa, users will be removed from your Magento list when unsubscribed from your Mailigen list.</notes>
|
22 |
+
<authors><author><name>Thomas Nelson</name><user>mailigen</user><email>info@mailigen.com</email></author></authors>
|
23 |
+
<date>2014-09-19</date>
|
24 |
+
<time>12:15:00</time>
|
25 |
+
<contents><target name="magecommunity"><dir name="Mailigen"><dir name="Synchronizer"><dir name="Block"><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="0806d62b81980578a09e5c6210530337"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="45ff744e45e50f035bfcc81534f96dad"/></dir><dir name="Model"><file name="List.php" hash="1f17c0f455adc4024140f22ebe5d6554"/><file name="Mailigen.php" hash="dd83acdfd3a428d2ba5efb1debfdba8d"/><dir name="Newsletter"><file name="Subscriber.php" hash="31cd322f6d00250b672b3e4929559e75"/></dir><file name="Observer.php" hash="fdeaaf4e3a6af3b632de65968e077a41"/></dir><dir name="api"><file name="MGAPI.class.php" hash="904de870b0896a4ffd5c5c144b76d6bb"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MailigenController.php" hash="2ecc61ae8c037d48a810cc9802b5a507"/></dir></dir><dir name="etc"><file name="config.xml" hash="c86211a929e6ec832a82197bf6d14ca4"/><file name="system.xml" hash="ba6c34ba2c4256e9cad3f34fe483beff"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mailigen_Synchronizer.xml" hash="6a07537f8d139cba241548e9e11c3e8b"/></dir></target></contents>
|
26 |
+
<compatible/>
|
27 |
+
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max>1.9</max></package></required></dependencies>
|
28 |
+
</package>
|