"; var template_url = "<?php echo get_bloginfo('template_url'); ?> "; //]]> </script> <!-- plugin admin header --> <div class="cf7cloud_logo"> <h1>Contact Form 7 Integrations</h1> <?php // get option if plugin is already activated $cUsComAPI_Cloud = new cUsComAPI_Cloud(); if ($cf7_cloud_activated == 1) { // get the credentials $credentials = get_option('cUsCloud_settings_userCredentials'); $cUs_API_Account = $credentials['API_Account']; $cUs_API_Key = $credentials['API_Key']; $cus_par_url = 'https://admin.contactus.com/partners'; $default_deep_link = get_option('cUsCloud_settings_default_deep_link_view'); $defaultFormId = get_option('cUsCloud_settings_form_id'); if (!strlen($default_deep_link)) { $cUsAPI_getFormKeys = $cUsComAPI_Cloud->getFormKeysAPI($cUs_API_Account, $cUs_API_Key); //api hook; $default_deep_link = $cUsComAPI_Cloud->getDefaultDeepLink($cUsAPI_getFormKeys); update_option('cUsCloud_settings_default_deep_link_view', $default_deep_link); // DEFAULT FORM KEYS }
public function wpcf7_cloud_send_all($wpcf7) { /* Use WPCF7_Submission object's get_posted_data() method to get it. */ $submission = WPCF7_Submission::get_instance(); if ($submission) { $posted_data = $submission->get_posted_data(); } $data = ''; $cuapi = new cUsComAPI_Cloud(); // get the option for this specific form and see which fields to send to CU API $cf7cloud_data = get_option('CU_cf7cloud_database_data_' . $posted_data['_wpcf7']); // get if this form is active to send data to admin.contactus.com $is_active = get_option('CU_cf7cloud_database_form_' . $posted_data['_wpcf7'] . '_active'); // ************************** // check for unmapped fields and delete from array that is used to send to CU API $cf7cloud_data['customs'] = $this->_clear_unmapped($cf7cloud_data['customs']); // ************************************** // first check if this form has any Analytics associated if ($cf7cloud_data && is_array($cf7cloud_data) && $is_active) { $CU_string = ''; // check if this form has any CF7 Cloud database analytics associated to it foreach ($cf7cloud_data as $key => $value) { if (!is_array($value)) { // avoid using arrays customs if (array_key_exists($value, $posted_data)) { $CU_string .= $key . "=" . urlencode($posted_data[$value]) . '&'; } } } // now check for custom fields. foreach ($cf7cloud_data['customs'] as $key => $value) { // check if array of values comming or any other array type if (is_array($posted_data[$key])) { // as array unify it as string and associate it to custom field foreach ($posted_data[$key] as $akey => $avalue) { $CU_array .= $avalue . ' / '; } $CU_string .= $value . "=" . urlencode($CU_array) . '&'; $CU_array = NULL; // clear array to avoid duplicates in foreach association } elseif (array_key_exists($key, $posted_data)) { $CU_string .= $value . "=" . urlencode($posted_data[$key]) . '&'; } } // remove last character $CU_string = substr_replace($CU_string, "", -1); $ch = curl_init(); $strCURLOPT = $this->API_url; $thekey = get_option('cUsCloud_settings_form_key'); $credentials = get_option('cUsCloud_settings_userCredentials'); $strCURLOPT .= 'API_Account=' . $credentials['API_Account']; // constants defined in config.php $strCURLOPT .= '&API_Key=' . $credentials['API_Key']; // constants defined in config.php $strCURLOPT .= '&API_Action=postSubmitLead'; $strCURLOPT .= '&Form_Key=' . $thekey . '&'; // constants defined in config.php curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-ContactUs-Request-URL: ' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'], 'X-ContactUs-Signature: CF7i|1.4.1|' . $cuapi->getIP())); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); $strCURLOPT = trim($strCURLOPT . $CU_string); // curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_URL, $strCURLOPT); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec($ch); curl_close($ch); } }
function cUsCloud_logoutUser_callback() { $cUsCF_api = new cUsComAPI_Cloud(); $cUsCF_api->resetData(); //RESET DATA delete_option('cUsCloud_settings_form_key'); delete_option('cUsCloud_settings_form_keys'); delete_option('cf7_cloud_database_active'); delete_option('cUsCloud_settings_userCredentials'); delete_option('cUsCloud_settings_default_deep_link_view'); echo 'Deleted.... User data'; //none list die; }