コード例 #1
0
ファイル: campaign.php プロジェクト: node-migrator-bot/cmx
<?php

// Returns the campaign content for Campaign Monitor's Servers
$campaignFileId = $_GET['cid'];
if (!is_numeric($campaignFileId)) {
    die;
}
$campaignFile = $campaignFileId . '.html';
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.core.php';
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
require_once MODX_CONNECTORS_PATH . 'index.php';
$corePath = $modx->getOption('cmx.core_path', null, $modx->getOption('core_path') . 'components/cmx/');
require_once $corePath . 'model/cmx/cmx.class.php';
$modx->cmx = new cmx($modx);
// CM Create Send Handler
if (!$modx->loadClass('CMHandler', $corePath . 'model/cmx/', true, true)) {
    $modx->log(modX::LOG_LEVEL_ERROR, '[CMx] Could not load CMHandler class.');
    return '';
}
$cm = new CMHandler($modx);
$content = $cm->getCampaignCache($campaignFile);
if (is_string($content)) {
    echo $content;
} else {
    echo '';
}
コード例 #2
0
ファイル: getlist.php プロジェクト: node-migrator-bot/cmx
<?php

$refresh = $modx->getOption('refresh', $_REQUEST, false);
$isLimit = !empty($_REQUEST['limit']);
$start = $modx->getOption('start', $_REQUEST, 0);
$limit = $modx->getOption('limit', $_REQUEST, 20);
$sort = $modx->getOption('sort', $_REQUEST, '');
$dir = $modx->getOption('dir', $_REQUEST, 'ASC');
$cm = new CMHandler($modx, $refresh);
$list = $cm->getScheduledCampaigns();
$list = $cm->searchResults($list, '');
$list = $cm->sortResults($list, $sort, $dir);
$list = array_slice($list, $start, $limit);
$count = $cm->getCount();
return $this->outputArray($list, $count);
コード例 #3
0
ファイル: load.php プロジェクト: node-migrator-bot/cmx
<?php

$campaignid = $modx->getOption('id', $_REQUEST, '0');
$cm = new CMHandler($modx);
return $cm->getCampaignCache($campaignid);
コード例 #4
0
ファイル: getlist.php プロジェクト: node-migrator-bot/cmx
<?php

$refresh = $modx->getOption('refresh', $_REQUEST, false);
FB::log($refresh);
$isLimit = !empty($_REQUEST['limit']);
$start = $modx->getOption('start', $_REQUEST, 0);
$limit = $modx->getOption('limit', $_REQUEST, 20);
$sort = $modx->getOption('sort', $_REQUEST, '');
$dir = $modx->getOption('dir', $_REQUEST, 'ASC');
$cm = new CMHandler($modx, $refresh);
$list = $cm->getDraftCampaigns();
$list = $cm->searchResults($list, '');
$list = $cm->sortResults($list, $sort, $dir);
$list = array_slice($list, $start, $limit);
$count = $cm->getCount();
return $this->outputArray($list, $count);
コード例 #5
0
<?php

// // Save selected users
// $pnaelInformation['users'] = $modx->toJSON( $scriptProperties['users'] );
// // Get selected users as comma seperate list
// $pnaelInformation['users'] = implode(',',$pnaelInformation['users']);
// $results = array();
// $results[] = array('ListID'=>'1234','Name'=>'Cool List');
// $results[] = array('ListID'=>'5678','Name'=>'Rad List');
// $count = count($results);
// return $this->outputArray($results, $count);
$cm = new CMHandler($modx);
$list = $cm->getLists();
$count = $cm->getCount();
return $this->outputArray($list, $count);
コード例 #6
0
ファイル: save.php プロジェクト: node-migrator-bot/cmx
$campaign['ReplyTo'] = $modx->getOption('replyto', $_POST, '');
$listids = $modx->getOption('lists', $_POST, array(''));
$segmentids = $modx->getOption('segments', $_POST, array(''));
if ($listids[0] === '' && $segmentids[0] === '') {
    return $modx->error->failure('Select a list or segment for this campaign');
}
if ($listids[0] !== '') {
    $campaign['ListIDs'] = $listids;
}
if ($segmentids[0] !== '') {
    $campaign['SegmentIDs'] = $segmentids;
}
$content = $modx->getOption('content', $_POST, '');
$content = str_replace('<p> </p>', '<br/>', $content);
// CM doesn't like that non breaking space TinyMCE adds between the p tags
$cm = new CMHandler($modx);
$fileId = $cm->setCampaignFiles($content);
if (!$fileId) {
    return $modx->error->failure('Problem saving cache file');
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . $modx->getOption('cmx.assets_url') . 'cache/';
$campaign['TextUrl'] = $url . $fileId . '.txt';
$campaign['HtmlUrl'] = $url . $fileId . '.html';
FB::log($campaign);
$results = $cm->createCampaign($campaign);
$cm->removeCampaignFiles($fileId);
if ($results->http_status_code == 201) {
    // grab campaign ID
    $campaignID = $results->response;
    FB::log($campaignID);
    // save a copy of everything in cache since we can't get this through the API
コード例 #7
0
ファイル: info.php プロジェクト: node-migrator-bot/cmx
<?php

$cid = $_REQUEST['id'];
$cm = new CMHandler($modx);
$results = $cm->getCampaignSummary($cid);
foreach ($results as $label => $result) {
    $output[$label] = $result;
}
$count = $cm->getCount();
return $this->outputArray($output, 1);
コード例 #8
0
ファイル: remove.php プロジェクト: node-migrator-bot/cmx
<?php

$campaignID = $modx->getOption('id', $_REQUEST, '');
if (!empty($campaignID)) {
    $cm = new CMHandler($modx);
    $results = $cm->removeCampaign($campaignID);
    FB::log($results);
    if ($results->http_status_code == '200') {
        return $modx->error->success('', $results);
    } else {
        return $modx->error->failure('Problem deleting campaign: ' . $results->response->Message);
    }
} else {
    return $modx->error->failure('Invalid Campaign ID');
}
コード例 #9
0
ファイル: send_test.php プロジェクト: node-migrator-bot/cmx
<?php

$campaignId = $modx->getOption('id', $_REQUEST, null);
$recipients = $modx->getOption('recipients', $_REQUEST, null);
$recipients = explode(',', $recipients);
FB::log($campaignId);
FB::log($recipients);
$cm = new CMHandler($modx);
$response = $cm->sendPreview($campaignId, $recipients);
FB::log($response);
return $modx->error->success('Successfully sent', $success);
コード例 #10
0
<?php

$campaignid = $modx->getOption('id', $_REQUEST, '');
$cm = new CMHandler($modx);
$response = $cm->unschedule($campaignid);
FB::log($response);
if ($response->http_status_code == '200') {
    // success
    return $modx->error->success('', $response);
} else {
    return $modx->error->failure('' . $response);
}
コード例 #11
0
<?php

$campaignId = $modx->getOption('id', $_REQUEST, '');
$confirmationEmail = $modx->getOption('confirmation_email', $_REQUEST, '');
$publishAt = $modx->getOption('publish_at', $_REQUEST, '');
if ($publishAt === '') {
    $publishAt = 'Immediately';
} else {
    $publishAt = str_replace('T', ' ', $publishAt);
}
FB::log($_REQUEST);
// $confirmationEmail = '*****@*****.**';
$schedule = array('ConfirmationEmail' => $confirmationEmail, 'SendDate' => $publishAt);
FB::log($campaignId);
FB::log($schedule);
$cm = new CMHandler($modx);
$response = $cm->sendCampaign($campaignId, $schedule);
FB::log($response);
return $modx->error->success('', $response);
コード例 #12
0
<?php

// // Save selected users
// $pnaelInformation['users'] = $modx->toJSON( $scriptProperties['users'] );
// // Get selected users as comma seperate list
// $pnaelInformation['users'] = implode(',',$pnaelInformation['users']);
// $results = array();
// $results[] = array('ListID'=>'1234','Name'=>'Cool List');
// $results[] = array('ListID'=>'5678','Name'=>'Rad List');
// $count = count($results);
// return $this->outputArray($results, $count);
$cm = new CMHandler($modx);
$list = $cm->getSegments();
$count = $cm->getCount();
return $this->outputArray($list, $count);
コード例 #13
0
ファイル: bounces.php プロジェクト: node-migrator-bot/cmx
<?php

/**
 * Get a list of Bounces
 *
 * @package cmx
 * @subpackage processors
 */
$refresh = $modx->getOption('refresh', $_REQUEST, false);
$campaign_id = $modx->getOption('campaign_id', $_REQUEST, 0);
$sent_date = $modx->getOption('sent_date', $_REQUEST, 0);
$count = $modx->getOption('count', $_REQUEST, 0);
$isLimit = !empty($_REQUEST['limit']);
$start = (int) $modx->getOption('start', $_REQUEST, 0);
$limit = (int) $modx->getOption('limit', $_REQUEST, 20);
$sort = $modx->getOption('sort', $_REQUEST, null);
$dir = $modx->getOption('dir', $_REQUEST, null);
$page_number = (int) floor($start / $limit) + 1;
$cm = new CMHandler($modx);
$list = $cm->getCampaignBounces($campaign_id, $sent_date, 1, $limit, $sort, $dir);
return $this->outputArray($list, $count);