本文整理汇总了PHP中CRM_Core_BAO_Email::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Email::get方法的具体用法?PHP CRM_Core_BAO_Email::get怎么用?PHP CRM_Core_BAO_Email::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Email
的用法示例。
在下文中一共展示了CRM_Core_BAO_Email::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
$my_key = CRM_Core_BAO_Setting::getItem(self::MC_SETTING_GROUP, 'security_key', NULL, FALSE);
CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Page_WebHook run $my_key= ', $my_key);
if (CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported() && !CRM_Mailchimp_Permission::check('allow webhook posts')) {
CRM_Core_Error::fatal();
}
// Check the key
// @todo is this a DOS attack vector? seems a lot of work for saying 403, go away, to a robot!
if (!isset($_GET['key']) || $_GET['key'] != $my_key) {
CRM_Core_Error::fatal();
}
if (!empty($_POST['data']['list_id']) && !empty($_POST['type'])) {
$requestType = $_POST['type'];
$requestData = $_POST['data'];
switch ($requestType) {
case 'subscribe':
case 'unsubscribe':
case 'profile':
// Create/Update contact details in CiviCRM
$delay = $requestType == 'profile';
$contactID = CRM_Mailchimp_Utils::updateContactDetails($requestData['merges'], $delay);
$contactArray = array($contactID);
// Subscribe/Unsubscribe to related CiviCRM groups
self::manageCiviCRMGroupSubcription($contactID, $requestData, $requestType);
CRM_Mailchimp_Utils::checkDebug('Start - CRM_Mailchimp_Page_WebHook run $_POST= ', $_POST);
CRM_Mailchimp_Utils::checkDebug('Start - CRM_Mailchimp_Page_WebHook run $contactID= ', $contactID);
CRM_Mailchimp_Utils::checkDebug('Start - CRM_Mailchimp_Page_WebHook run $requestData= ', $requestData);
CRM_Mailchimp_Utils::checkDebug('Start - CRM_Mailchimp_Page_WebHook run $requestType= ', $requestType);
break;
case 'upemail':
// Mailchimp Email Update event
// Try to find the email address
$email = new CRM_Core_BAO_Email();
$email->get('email', $requestData['old_email']);
CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Page_WebHook run- case upemail $requestData[old_email]= ', $requestData['old_email']);
// If the Email was found.
if (!empty($email->contact_id)) {
$email->email = $requestData['new_email'];
$email->save();
CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Page_WebHook run- case upemail inside condition $requestData[new_email]= ', $requestData['new_email']);
}
break;
case 'cleaned':
// Try to find the email address
$email = new CRM_Core_BAO_Email();
$email->get('email', $requestData['email']);
CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Page_WebHook run - case cleaned $requestData[new_email]= ', $requestData['email']);
// If the Email was found.
if (!empty($email->contact_id)) {
$email->on_hold = 1;
$email->holdEmail($email);
$email->save();
CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Page_WebHook run - case cleaned inside condition $email= ', $email);
CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Page_WebHook run - case cleaned inside condition $requestData[new_email]= ', $requestData['email']);
}
break;
default:
// unhandled webhook
CRM_Mailchimp_Utils::checkDebug('End- CRM_Mailchimp_Page_WebHook run $contactID= ', $contactID);
CRM_Mailchimp_Utils::checkDebug('End- CRM_Mailchimp_Page_WebHook run $requestData= ', $requestData);
CRM_Mailchimp_Utils::checkDebug('End- CRM_Mailchimp_Page_WebHook run $requestType= ', $requestType);
CRM_Mailchimp_Utils::checkDebug('End - CRM_Mailchimp_Page_WebHook run $email= ', $email);
}
}
// Return the JSON output
header('Content-type: application/json');
$data = NULL;
// We should ideally throw some status
print json_encode($data);
CRM_Utils_System::civiExit();
}