Merged in feature/MAW-889-streamline-host-and-post (pull request #54)
Feature/MAW-889 streamline host and post
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Recommended way to include parent theme styles.
|
||||
// (Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
|
||||
//
|
||||
//
|
||||
|
||||
add_action( 'pre_get_posts', function() {
|
||||
unset( $_GET['et_pb_searchform_submit'] );
|
||||
@@ -26,9 +26,9 @@ function rlv_shortcode_attribute( $content ) {
|
||||
return preg_replace( '/\[et_pb_blurb.*?title="(.*?)".*?\]/im', '\1 ', $content );
|
||||
}
|
||||
|
||||
add_filter( 'et_use_dynamic_css', function() {
|
||||
if ( is_search() ) {
|
||||
return false;
|
||||
add_filter( 'et_use_dynamic_css', function() {
|
||||
if ( is_search() ) {
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
|
||||
@@ -71,12 +71,12 @@ jQuery(function($){
|
||||
$('#screen_1').show();
|
||||
$( "#screen_1_btn_2" ).click(function() {
|
||||
$(".loved-one").css("display", "block");
|
||||
});
|
||||
});
|
||||
var revealButtons = {
|
||||
'#screen_1_btn_1': '#screen_2',
|
||||
'#screen_1_btn_2': '#screen_2',
|
||||
'#screen_2_btn_no': '#screen_3',
|
||||
'#screen_2_btn_yes': '#screen_6',
|
||||
'#screen_2_btn_yes': '#screen_6',
|
||||
'#screen_3_btn_yes': '#screen_4',
|
||||
'#screen_3_btn_no': '#screen_5',
|
||||
'#screen_4_btn_no': '#result_1',
|
||||
@@ -124,3 +124,116 @@ jQuery(document).ready(function(){
|
||||
<?php
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
function postsf()
|
||||
{
|
||||
$oid = "00D1I000000mJ0Q";
|
||||
$lead_source = "Web";
|
||||
$member_status = "Web response";
|
||||
$lead_source = "Web";
|
||||
$callback = $_POST['callback'];
|
||||
$campaign_ID = $_POST['campaign_ID'];
|
||||
$cleanPOST = array(
|
||||
'first_name' => ($_POST['first-name']),
|
||||
'last_name' => ($_POST['last-name']),
|
||||
'phone' => ($_POST['phone']),
|
||||
'email' => ($_POST['your-email']),
|
||||
'zip' => ($_POST['zip']),
|
||||
'Campaign_ID' => $campaign_ID,
|
||||
//'callback' => $callback,
|
||||
'oid' => $oid,
|
||||
'lead_source' => $lead_source,
|
||||
'Custom_Field_1__c' => ($_POST['subid1']),
|
||||
'Custom_Field_2__c' => ($_POST['subid2']),
|
||||
'Custom_Field_3__c' => ($_POST['subid3']),
|
||||
'Custom_Field_4__c' => ($_POST['subid4'])
|
||||
);
|
||||
|
||||
foreach ($cleanPOST as $key=>$value){
|
||||
$cleanPOST[stripslashes($key)] = stripslashes($value);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://webto.salesforce.com/servlet/servlet.WebToLead");
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
|
||||
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$error = curl_error($ch);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
if ($error) {
|
||||
echo $error;
|
||||
} else {
|
||||
echo json_encode($response);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
function post59($data) {
|
||||
$Campaign_ID = '701130000026vNy';
|
||||
date_default_timezone_set('America/New_York');
|
||||
$F9Date = date("Y-m-d")."-". date("H:i");
|
||||
$F9domain = "connect america";
|
||||
$F9list = $data['callback'];
|
||||
$newphone = preg_replace('/^1|\D/', '', $data['phone']);
|
||||
|
||||
$cleanPOST = array(
|
||||
'first_name' => $data['first-name'],
|
||||
'last_name' => $data['last-name'],
|
||||
'number1' => $newphone,
|
||||
'F9domain' => $F9domain,
|
||||
'F9list' => $F9list,
|
||||
'salesforce_id' => $Campaign_ID,
|
||||
'Device_6' => $title,
|
||||
'WebDialer_Key' => $F9Date,
|
||||
'F9key' => WebDialer_Key,
|
||||
'F9CallASAP' => true
|
||||
);
|
||||
|
||||
foreach ($cleanPOST as $key => $value) {
|
||||
$cleanPOST[stripslashes($key)] = stripslashes($value);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://api.five9.com/web2campaign/AddToList");
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
if ($response === false) {
|
||||
$error = curl_error($ch);
|
||||
return "Error: $error";
|
||||
} else {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
add_action('rest_api_init', function () {
|
||||
register_rest_route('affiliates/v1', '/form', array(
|
||||
'methods' => 'POST',
|
||||
'callback' => 'handle_form_submission',
|
||||
));
|
||||
});
|
||||
|
||||
function handle_form_submission($request)
|
||||
{
|
||||
$response1 = postsf($request->get_params());
|
||||
$response2 = post59($request->get_params());
|
||||
|
||||
$response = array(
|
||||
'response1' => $response1,
|
||||
'response2' => $response2
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user