public function import(PerchMailChimp_List $List)
 {
     $Imports = new PerchMailChimp_Imports($this->api);
     $Import = $Imports->create(['importType' => 'webhooks', 'importSourceID' => $List->id(), 'importCount' => 100, 'importOffset' => 0]);
     if ($Import) {
         $Import->run();
     }
 }
 public function import()
 {
     $Imports = new PerchMailChimp_Imports($this->api);
     $Import = $Imports->create(['importType' => 'campaigns', 'importSourceID' => null, 'importCount' => 20, 'importOffset' => 0]);
     if ($Import) {
         $Import->run();
     }
 }
Exemplo n.º 3
0
<?php

$Form = $API->get('Form');
$Paging = $API->get('Paging');
$Paging->set_per_page(20);
$Lists = new PerchMailChimp_Lists($API);
$lists = $Lists->all();
$Subscribers = new PerchMailChimp_Subscribers($API);
// Run an import if there is one
$Imports = new PerchMailChimp_Imports($API);
$Import = $Imports->get_next_import('subscribers');
if (is_object($Import)) {
    $message = $HTML->warning_message('Subscribers are still updating.');
    $Import->run();
} else {
    if ($Form->submitted()) {
        foreach ($lists as $List) {
            $Subscribers->import($List);
        }
    }
}
$subscribers = $Subscribers->all_subscribed($Paging);
if (!PerchUtil::count($subscribers)) {
    foreach ($lists as $List) {
        $Subscribers->import($List);
    }
    $subscribers = $Subscribers->all_subscribed($Paging);
}
Exemplo n.º 4
0
<?php

$Form = $API->get('Form');
$Paging = $API->get('Paging');
$Paging->set_per_page(20);
$Campaigns = new PerchMailChimp_Campaigns($API);
// Run an import if there is one
$Imports = new PerchMailChimp_Imports($API);
$Import = $Imports->get_next_import('campaigns');
if (is_object($Import)) {
    $message = $HTML->warning_message('Campaigns are still updating.');
    $Import->run();
} else {
    if ($Form->submitted()) {
        $Campaigns->import();
        $campaigns = $Campaigns->all($Paging);
    }
}
$campaigns = $Campaigns->all($Paging);
if (!PerchUtil::count($campaigns)) {
    $Campaigns->import();
    $campaigns = $Campaigns->all($Paging);
}
Exemplo n.º 5
0
<?php

PerchScheduledTasks::register_task('perch_mailchimp', 'import_data', 1, function ($last_run) {
    $API = new PerchAPI(1.0, 'perch_mailchimp');
    $Imports = new PerchMailChimp_Imports($API);
    $result = $Imports->run_next_import();
    if ($result && $result['result'] == 'success') {
        return array('result' => 'OK', 'message' => $result['message']);
    } else {
        return array('result' => 'FAILED', 'message' => 'Unknown.');
    }
    return false;
});
Exemplo n.º 6
0
<?php

$Form = $API->get('Form');
$Paging = $API->get('Paging');
$Paging->set_per_page(20);
$Lists = new PerchMailChimp_Lists($API);
$lists = $Lists->all();
// Run an import if there is one
$Imports = new PerchMailChimp_Imports($API);
$Import = $Imports->get_next_import('webhooks');
$Webhooks = new PerchMailChimp_Webhooks($API);
if (is_object($Import)) {
    $message = $HTML->warning_message('Webhooks are still importing.');
    $Import->run();
} else {
    if ($Form->submitted()) {
        foreach ($lists as $List) {
            $Webhooks->import($List);
            $Webhooks->set_up($List);
        }
    }
}
$webhooks = $Webhooks->all($Paging);
if (!PerchUtil::count($webhooks)) {
    foreach ($lists as $List) {
        $Webhooks->import($List);
        $Webhooks->set_up($List);
    }
    $webhooks = $Webhooks->all($Paging);
}