当前位置: 首页>>代码示例>>PHP>>正文


PHP MCAPI::campaignCreate方法代码示例

本文整理汇总了PHP中MCAPI::campaignCreate方法的典型用法代码示例。如果您正苦于以下问题:PHP MCAPI::campaignCreate方法的具体用法?PHP MCAPI::campaignCreate怎么用?PHP MCAPI::campaignCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MCAPI的用法示例。


在下文中一共展示了MCAPI::campaignCreate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: notify

 /**
  * Creates a new campaign and send it immediately.
  *
  * @since	3.7
  * @access	public
  */
 public function notify($emailTitle, $emailData, &$blog)
 {
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     $config = EasyBlogHelper::getConfig();
     if (!function_exists('curl_init')) {
         echo JText::_('COM_EASYBLOG_CURL_DOES_NOT_EXIST');
     }
     if (!$config->get('subscription_mailchimp')) {
         return;
     }
     $listId = $config->get('subscription_mailchimp_listid');
     if (!$listId) {
         return;
     }
     require_once EBLOG_CLASSES . '/MCAPI.class.php';
     $api = new MCAPI($this->key);
     $type = 'regular';
     $jConfig = EasyBlogHelper::getJConfig();
     $defaultEmailFrom = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? $jConfig->get('mailfrom') : $jConfig->get('mailfrom');
     $defaultFromName = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? $jConfig->get('fromname') : $jConfig->get('fromname');
     $fromEmail = $config->get('mailchimp_from_email', $defaultEmailFrom);
     $fromName = $config->get('mailchimp_from_name', $defaultFromName);
     $opts = array();
     $opts['list_id'] = $listId;
     $opts['from_email'] = $fromEmail;
     $opts['from_name'] = $fromName;
     $opts['subject'] = $emailTitle;
     $opts['tracking'] = array('opens' => true, 'html_clicks' => true, 'text_clicks' => false);
     $opts['authenticate'] = true;
     $opts['title'] = $blog->title;
     $content = array('html' => self::getTemplateContents('email.blog.new', $emailData, 'html'), 'text' => self::getTemplateContents('email.blog.new', $emailData, 'text'));
     $cid = $api->campaignCreate($type, $opts, $content);
     // Send this now!
     if (!$api->errorCode) {
         $api->campaignSendNow($cid);
     }
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:43,代码来源:mailchimp.php

示例2: array

$opts['tracking'] = array('opens' => true, 'html_clicks' => true, 'text_clicks' => false);
$opts['authenticate'] = true;
$opts['analytics'] = array('google' => 'my_google_analytics_key');
$opts['title'] = 'Eur 5,- Rabatt MyGassi (Aktion)!';
$message = 'Herzlichen Glückwunsch zu Ihrem persönlichen Eur 5,- Aktions-Rabatt-Coupon, einzulösen mit dem Gutschein "' . $code . '" bei Ihrem nächsten Einkauf im MyGassi Shop! ';
$content = array('html' => $message, 'text' => $message);
/** OR we could use this:
$content = array('html_main'=>'some pretty html content',
		 'html_sidecolumn' => 'this goes in a side column',
		 'html_header' => 'this gets placed in the header',
		 'html_footer' => 'the footer with an *|UNSUB|* message', 
		 'text' => 'text content text content *|UNSUB|*'
		);
$opts['template_id'] = "1";
**/
$campaignId = $api->campaignCreate($type, $opts, $content);
if ($api->errorCode) {
    echo "Unable to Create New Campaign!";
    echo "\n\tCode=" . $api->errorCode;
    echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "New Campaign ID:" . $campaignId . "\n";
}
// on could do this;
// it is probably a good idea
// to click on that "send" button
// in the  mailchimp panel
$retval = $api->campaignSendNow($campaignId);
if ($api->errorCode) {
    echo "Unable to Send Campaign!";
    echo "\n\tCode=" . $api->errorCode;
开发者ID:vberzsin,项目名称:shop,代码行数:31,代码来源:mygassi-mc-action-campaign.php

示例3: MCAPI

This Example shows how to create a basic campaign via the MCAPI class.
**/
require_once 'inc/MCAPI.class.php';
$api = new MCAPI($apikey);
$type = 'regular';
$opts['list_id'] = 'f9ee6d8616';
$opts['subject'] = 'Test Newsletter Subject';
$opts['from_email'] = 'mailchimp@example.org';
$opts['from_name'] = 'ACME, Inc.';
$opts['tracking'] = array('opens' => true, 'html_clicks' => true, 'text_clicks' => false);
$opts['authenticate'] = true;
$opts['analytics'] = array('google' => 'my_google_analytics_key');
$opts['title'] = 'Test Newsletter Title';
$content = array('html' => 'some pretty html content *|UNSUB|* message', 'text' => 'text text text *|UNSUB|*');
/** OR we could use this:
$content = array('html_main'=>'some pretty html content',
		 'html_sidecolumn' => 'this goes in a side column',
		 'html_header' => 'this gets placed in the header',
		 'html_footer' => 'the footer with an *|UNSUB|* message', 
		 'text' => 'text content text content *|UNSUB|*'
		);
$opts['template_id'] = "1";
**/
$retval = $api->campaignCreate($type, $opts, $content);
if ($api->errorCode) {
    echo "Unable to Create New Campaign!";
    echo "\n\tCode=" . $api->errorCode;
    echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "New Campaign ID:" . $retval . "\n";
}
开发者ID:vberzsin,项目名称:shop,代码行数:31,代码来源:mcapi_campaignCreate.php

示例4: send_test

 public function send_test()
 {
     $host = $this->host;
     $api_key = $this->get_setting('api_key');
     $html = $this->get_file("{$host}?lang=en&production");
     $campaign_type = $this->get_setting('type');
     $conditions = $this->settings['test_matrix'];
     $opts = $this->get_setting('options');
     $title = $this->get_setting('campaign_name_human_readable');
     $edm_checker = strtoupper($this->get_setting('edm_checker'));
     $opts['analytics'] = array('google' => '');
     $opts['list_id'] = $this->get_setting('test_list');
     $opts['title'] = $title . ' TEST';
     $opts['subject'] = "[TEST - REPORT ERRORS TO {$edm_checker}] " . $this->extract_html_subject($html);
     $opts['authenticate'] = true;
     $segment_opts = array('match' => 'all', 'conditions' => $conditions);
     $api = new MCAPI($api_key);
     $campaign_id = $api->campaignCreate($campaign_type, $opts, array('html' => $html), $segment_opts);
     if ($api->errorCode) {
         $this->send_json(array('fail' => $api->errorMessage));
     } else {
         $this->set_cache($campaign_id);
         $this->send_json(array('success' => $campaign_id));
     }
     exit;
 }
开发者ID:sidouglas,项目名称:aussieBumEDM,代码行数:26,代码来源:create.campaign.php


注:本文中的MCAPI::campaignCreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。