本文整理汇总了PHP中MCAPI::getAffiliateInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP MCAPI::getAffiliateInfo方法的具体用法?PHP MCAPI::getAffiliateInfo怎么用?PHP MCAPI::getAffiliateInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCAPI
的用法示例。
在下文中一共展示了MCAPI::getAffiliateInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: a360_get_chimp_chatter_url
function a360_get_chimp_chatter_url()
{
if ($url = get_option('a360_chimp_chatter_url')) {
// intentional assignment
return $url;
}
global $a360_api_key;
if (!empty($a360_api_key)) {
if (!class_exists('MCAPI')) {
include_once ABSPATH . PLUGINDIR . '/analytics360/php/MCAPI.class.php';
}
$api = new MCAPI($a360_api_key);
if (!empty($api->errorCode)) {
return null;
}
$results = $api->getAffiliateInfo();
if (!empty($api->errorCode)) {
return null;
}
$url = 'http://us1.admin.mailchimp.com/chatter/feed?u=' . $results['user_id'];
update_option('a360_chimp_chatter_url', $url);
return $url;
}
}
示例2: mailchimpSF_setup_page
function mailchimpSF_setup_page()
{
$msg = '';
if (get_option('mc_password') != '') {
//some upgrade code for < 0.5 users - we want to rip out the password we've been saving.
$api = new MCAPI(get_option('mc_username'), get_option('mc_password'));
if ($api->errorCode == '') {
update_option('mc_apikey', $api->api_key);
//this should already be here, but let's make sure anyway
$req = $api->getAffiliateInfo();
update_option('mc_user_id', $req['user_id']);
} else {
$msg = "<span class='error_msg'>" . __("While upgrading the plugin setup, we were unable to login to your account. You will need to login again and setup your list.", 'mailchimp_i18n') . "<br/>";
}
delete_option('mc_password');
}
?>
<div class="wrap">
<h2><?php
echo __('MailChimp List Setup', 'mailchimp_i18n');
?>
</h2>
<?php
if ($_REQUEST['action'] === 'logout') {
update_option('mc_apikey', '');
}
//see if we need to set/change the username & password.
if (isset($_REQUEST['mc_username']) && isset($_REQUEST['mc_password'])) {
$delete_setup = false;
$api = new MCAPI($_REQUEST['mc_username'], $_REQUEST['mc_password']);
if ($api->errorCode == '') {
$msg = "<span class='success_msg'>" . htmlentities(__("Success! We were able to verify your username & password! Let's continue, shall we?", 'mailchimp_i18n')) . "</span>";
update_option('mc_username', $_REQUEST['mc_username']);
update_option('mc_apikey', $api->api_key);
$req = $api->getAffiliateInfo();
update_option('mc_user_id', $req['user_id']);
if (get_option('mc_list_id') != '') {
$lists = $api->lists();
//but don't delete if the list still exists...
$delete_setup = true;
foreach ($lists as $list) {
if ($list['id'] == get_option('mc_list_id')) {
$list_id = $_REQUEST['mc_list_id'];
$delete_setup = false;
}
}
}
} else {
$msg .= "<span class='error_msg'>" . htmlentities(__('Uh-oh, we were unable to login and verify your username & password. Please check them and try again!', 'mailchimp_i18n')) . "<br/>";
$msg .= __('The server said:', 'mailchimp_i18n') . "<i>" . $api->errorMessage . "</i></span>";
if (get_option('mc_username') == '') {
$delete_setup = true;
}
}
if ($delete_setup) {
delete_option('mc_user_id');
delete_option('mc_rewards');
delete_option('mc_use_javascript');
delete_option('mc_use_unsub_link');
delete_option('mc_list_id');
delete_option('mc_list_name');
delete_option('mc_interest_groups');
delete_option('mc_show_interest_groups');
$mv = get_option('mc_merge_vars');
if (!is_array($mv)) {
$mv = unserialize($mv);
}
if (is_array($mv)) {
foreach ($mv as $var) {
$opt = 'mc_mv_' . $var['tag'];
delete_option($opt);
}
}
delete_option('mc_merge_vars');
}
//set these for the form fields below
$user = $_REQUEST['mc_username'];
} else {
$user = get_option('mc_username');
$pass = get_option('mc_password');
}
if (get_option('mc_apikey') != '') {
$GLOBALS["mc_api_key"] = get_option('mc_apikey');
$api = new MCAPI('no_login', 'is_needed');
$lists = $api->lists();
foreach ($lists as $list) {
if ($list['id'] == $_REQUEST['mc_list_id']) {
$list_id = $_REQUEST['mc_list_id'];
$list_name = $list['name'];
}
}
$orig_list = get_option('mc_list_id');
if ($list_id != '') {
update_option('mc_list_id', $list_id);
update_option('mc_list_name', $list_name);
if ($orig_list != $list_id) {
update_option('mc_header_content', __('Sign up for', 'mailchimp_i18n') . ' ' . $list_name);
update_option('mc_submit_text', __('Subscribe', 'mailchimp_i18n'));
update_option('mc_custom_style', 'on');
update_option('mc_use_javascript', 'on');
//.........这里部分代码省略.........