本文整理汇总了PHP中MCAPI::listGrowthHistory方法的典型用法代码示例。如果您正苦于以下问题:PHP MCAPI::listGrowthHistory方法的具体用法?PHP MCAPI::listGrowthHistory怎么用?PHP MCAPI::listGrowthHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCAPI
的用法示例。
在下文中一共展示了MCAPI::listGrowthHistory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cw_mailchimp_list_history
/**
* Subscription wrapper for Mailchimp service (listGrowthHistory method)
*
* @param mixed $listid id of Mailchimp accout
* @param mixed $apikey apikey of Mailchimp accout
*
* @return array
* @see ____func_see____
* @since 1.0.0
*/
function cw_mailchimp_list_history($listid = false, $apikey = false)
{
global $config;
if (!$apikey) {
$apikey = $config['mailchimp_subscription']['mailchimp_apikey'];
}
if (!$listid) {
$listid = $config['mailchimp_subscription']['mailchimp_id'];
}
$mailchimp_api = new MCAPI($apikey);
$mailchimp_return = $mailchimp_api->listGrowthHistory($listid);
if ($mailchimp_api->errorCode) {
$mailchimp_response['Error_code'] = $mailchimp_api->errorCode;
$mailchimp_response['Error_message'] = $mailchimp_api->errorMessage;
} else {
$mailchimp_response['Response'] = $mailchimp_return;
}
return $mailchimp_response;
}
示例2: MCAPI
<?php
// Include the MailChimp API code. Do Not Edit This!
require_once 'inc/MCAPI.class.php';
require_once 'inc/config.inc.php';
//contains apikey
$api = new MCAPI($apikey);
$history = $api->listGrowthHistory($listId);
if ($api->errorCode) {
echo "Unable to run listGrowthHistory()!\n\tCode=" . $api->errorCode . "\n\tMsg=" . $api->errorMessage . "\n";
} else {
foreach ($history as $h) {
echo $h['month'] . "\n";
echo "\tExisting=" . $h['existing'] . "\n";
echo "\tImports=" . $h['imports'] . "\n";
echo "\tOptins=" . $h['optins'] . "\n";
}
}
?>
示例3: a360_request_handler
function a360_request_handler()
{
if (!empty($_GET['a360_action'])) {
switch ($_GET['a360_action']) {
case 'admin_js':
a360_admin_js();
break;
case 'admin_css_ie':
header('Content-type: text/css');
require 'css/a360-ie.css';
die;
break;
case 'admin_css':
header('Content-type: text/css');
require 'css/datePicker.css';
require 'css/a360.css';
die;
break;
case 'capture_ga_token':
if (!current_user_can('manage_options')) {
wp_die(__('You are not allowed to do that.', 'analytics360'));
}
$args = array();
parse_str($_SERVER['QUERY_STRING'], $args);
$token = NULL;
if (isset($args['token'])) {
$ch = curl_init('https://www.google.com/accounts/AuthSubSessionToken');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: AuthSub token="' . $args['token'] . '"'));
$result = curl_exec($ch);
$matches = array();
$found = preg_match('/Token=(.*)/', $result, $matches);
if ($found) {
$token = $matches[1];
$result = update_option('a360_ga_token', $token);
}
}
if (!$token) {
$q = http_build_query(array('a360_error' => 'Authentication with Google did not succeed. Please try again.'));
} else {
delete_option('a360_ga_profile_id');
$q = http_build_query(array('updated' => true));
}
wp_redirect(trailingslashit(get_bloginfo('wpurl')) . 'wp-admin/options-general.php?page=' . basename(__FILE__) . '&' . $q);
break;
case 'get_wp_posts':
add_filter('posts_where', create_function('$where', 'return $where." AND post_date >= \'' . $_GET['start_date'] . '\' AND post_date < \'' . $_GET['end_date'] . '\'";'));
$results = query_posts('post_status=publish&posts_per_page=999');
header('Content-type: text/javascript');
die(cf_json_encode(array('success' => true, 'data' => $results, 'cached' => false)));
break;
case 'get_mc_data':
global $a360_api_key;
if (!class_exists('MCAPI')) {
include_once ABSPATH . PLUGINDIR . '/analytics360/php/MCAPI.class.php';
}
$api = new MCAPI($a360_api_key);
switch ($_GET['data_type']) {
case 'campaigns':
$results = $api->campaigns(array('sendtime_start' => $_GET['start_date'], 'end_start' => $_GET['end_date']));
if ($results) {
die(cf_json_encode(array('success' => true, 'data' => $results, 'cached' => false)));
} else {
die(cf_json_encode(array('success' => false, 'error' => $api->errorMessage)));
}
break;
case 'list_growth':
$results = $api->listGrowthHistory($_GET['list_id']);
if ($results) {
die(cf_json_encode(array('success' => true, 'data' => $results, 'cached' => false)));
} else {
die(cf_json_encode(array('success' => false, 'error' => $api->errorMessage)));
}
break;
}
break;
case 'get_ga_data':
global $a360_ga_token, $a360_ga_profile_id;
$parameters = array('start-date' => $_GET['start_date'], 'end-date' => $_GET['end_date'], 'sort' => 'ga:date', 'ids' => 'ga:' . $a360_ga_profile_id);
// split up top referrals by filtering on each medium in turn
if ($_GET['data_type'] == 'top_referrals') {
$handles = array('referral' => null, 'organic' => null, 'email' => null, 'cpc' => null, '*' => null);
$parameters['dimensions'] = 'ga:medium,ga:source';
$parameters['metrics'] = 'ga:visits,ga:timeOnSite,ga:pageviews';
$parameters['sort'] = '-ga:visits';
foreach ($handles as $filter => $handle) {
$p = $filter == '*' ? array('max-results' => 200) : array('filters' => 'ga:medium==' . $filter, 'max-results' => 200);
$handles[$filter] = $handle = curl_init('https://www.google.com/analytics/feeds/data?' . http_build_query(array_merge($parameters, $p)));
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_TIMEOUT, 10);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, true);
curl_setopt($handle, CURLOPT_HTTPHEADER, array('Authorization: AuthSub token="' . $a360_ga_token . '"'));
}
$mh = curl_multi_init();
foreach ($handles as $handle) {
curl_multi_add_handle($mh, $handle);
//.........这里部分代码省略.........