public function wpcf7_cf7cloud_add_contactus_analytics($args) { $cUsComAPI_Cloud = new cUsComAPI_Cloud(); ?> <script> //<![CDATA[ jQuery(document).ready(function() { jQuery('#wpcf7-cf7cloud-active').on('click', function() { if (jQuery('#wpcf7-cf7cloud-active').is(':checked')) { //jQuery('#wpcf7-admin-form-element').submit(); jQuery('#cf7cloud-formdata').show('fast'); } else { jQuery('#cf7cloud-formdata').hide('fast'); } }); // function to validate email address function validate_email(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } }); //]]> </script> <?php // get the custom data for this contact form $the_data = get_option('CU_cf7cloud_database_data_' . $_GET['post']); $the_cf7_fields = get_option('CU_cf7_cloud_mapped_fields_' . $_GET['post']); $is_active_form = get_option('CU_cf7cloud_database_form_' . $_GET['post'] . '_active'); //print_r($the_data); $cred = get_option('cUsCloud_settings_userCredentials'); $cf7_cloud_activated = get_option('cf7_cloud_database_active'); $fkey = get_option('cUsCloud_settings_form_key'); //echo $fkey; ?> <input type="hidden" name="trcount" id="trcount" value="<?php echo is_array($the_data['customs']) ? count($the_data['customs']) : 1; ?> " /> <div class="mail-field"> <div class="cf7cloud-active"> <input type="checkbox" id="wpcf7-cf7cloud-active" name="wpcf7-cf7cloud-active" value="1" <?php echo $is_active_form ? "checked" : ""; ?> /> <label for="wpcf7-cf7cloud-active"><?php echo esc_html(__('Turn On Contact Form 7 Integrations', 'wpcf7')); ?> </label> <a name="cf7cloud_errors"></a> <?php // CF7 cloud errors in fields if (isset($_GET['cf7cloud_errors'])) { echo '<div class="cf7_cloud_errors">' . $_GET['cf7cloud_errors'] . '</div>'; } ?> </div> <div id="cf7cloud-formdata" <?php echo $is_active_form ? 'style="display:block"' : ""; ?> > <input type="submit" name="map_button" id="map_button" value="Map Contact Form 7 Fields" style="padding:5px 10px 5px; cursor:pointer" /> <br/><strong>Click here before mapping or editing your mapped fields (Required).</strong> <hr/> <table id="cf7_cloud_table" <?php echo $is_active_form ? 'style="display:block"' : 'style="display:none"'; ?> > <tbody> <tr><td colspan="2"><h4>To integrate your ContactUs.com account with your form, you must map fields by matching Contact Form 7 fields with ContactUs.com form fields. We have set the default form fields, but please make sure they are correct.</h4></td></tr> <tr> <td>Input name for EMAIL field:</td> <td> <select name="cf7cloud_email"> <?php // list the CF7 fields names foreach ($the_cf7_fields as $key => $value) { if ($the_data['Email'] == $value) { echo '<option value="' . $value . '" selected="selected">' . $value . '</option>'; } else { // check if email name of CF7 is the default, your email if ($value == 'your-email') { echo '<option value="' . $value . '" selected="selected">' . $value . '</option>'; } else { echo '<option value="' . $value . '">' . $value . '</option>'; } } } ?> </select> </td> </tr> <tr> <td>Select input name for NAME field:</td> <td> <select name="cf7cloud_name"> <?php // list the CF7 fields names foreach ($the_cf7_fields as $key => $value) { if ($the_data['Full_Name'] == $value) { echo '<option value="' . $value . '" selected="selected">' . $value . '</option>'; } else { // check if email name of CF7 is the default, your name if ($value == 'your-name') { echo '<option value="' . $value . '" selected="selected">' . $value . '</option>'; } else { echo '<option value="' . $value . '">' . $value . '</option>'; } } } ?> </select> </td> </tr> <tr> <td colspan="2"><br /> </h2> </td> </tr> <?php // check if custom forms fields available to show or not $count_mapper = 0; // variable to compare how many custom fields are being displayed already and not allow more than $total-2 if (isset($the_data['customs']) && is_array($the_data['customs'])) { $counter = 1; // counter to create row ids foreach ($the_data['customs'] as $key => $value) { // check and compare amount of fields with mapper if (count($the_cf7_fields) - 2 == $count_mapper) { break; } ?> <tr id="row_<?php echo $counter; ?> "> <td> Select Contact Form 7 field:<br /> <select name="cf7cloud_custom_field_name[]"> <?php // list the CF7 fields names foreach ($the_cf7_fields as $xkey => $xvalue) { if ($xvalue == $key) { echo '<option value="' . $xvalue . '" selected="selected">' . $xvalue . '</option>'; } else { // avoid including here CF7 defaults, your-name and your-mail if ($xvalue != 'your-name' && $xvalue != 'your-email') { if ($value == 'your-subject') { echo '<option value="' . $xvalue . '">' . $xvalue . '</option>'; $subject_present = TRUE; } elseif ($value == 'your-message') { echo '<option value="' . $xvalue . '">' . $xvalue . '</option>'; $message_present = TRUE; } else { echo '<option value="' . $xvalue . '">' . $xvalue . '</option>'; } } } } ?> </select> </td> <td> Select ContactUs.com field to associate:<br /> <?php //print_r($this->CU_API_fields); exit; ?> <select name="cf7cloud_custom_field_select[]"> <option value="unmapped">-- Unmapped --</option> <?php // list and select current select value foreach ($this->CU_API_fields as $skey => $svalue) { if ($value == $skey) { echo '<option value="' . $skey . '" selected="selected">' . $svalue . '</option>'; } else { // check if subject_present gives TRUE to select Generic_Field_10 if ($subject_present == TRUE && $skey == 'Generic_Field_10') { echo '<option value="' . $skey . '" selected="selected">' . $svalue . '</option>'; $subject_present = FALSE; } elseif ($message_present == TRUE && $skey == 'Message') { echo '<option value="' . $skey . '" selected="selected">' . $svalue . '</option>'; $message_present = FALSE; } else { echo '<option value="' . $skey . '">' . $svalue . '</option>'; } } } ?> </select> </td> <td> </td> </tr> <?php $counter++; // increment the counter for row identification $count_mapper++; } // end foreach } ?> <tr> <td colspan="2"> </td> </tr> <tr><td colspan="2" style="text-align:center;"> </td></tr> <tr> <td colspan="2" style="text-align:center;"> <!-- <input type="submit" name="save_cf7cloud" id="save_cf7cloud" value="Save Analytics Data" /><br /><br /> --> </td> </tr> </tbody> </table> <table class="cf7cloud_custom_fields_table" <?php echo $is_active_form ? 'style="display:block"' : 'style="display:none"'; ?> > <?php // get api account and api key $data = get_option('cUsCloud_settings_userCredentials'); $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'); $partnerID = $cUsComAPI_Cloud->get_partner_id($default_deep_link); $cus_CRED_url = $cus_par_url . '/index.php?loginName=' . $cUs_API_Account . '&userPsswd=' . urlencode($cUs_API_Key); ?> <tbody> <tr> <td colspan="3">When you’re finish mapping, remember to hit <strong>Save</strong> your Contact Form 7 settings! (Save button is located on upper right)<br /><br /></td> </tr> <tr> <td colspan="3"><strong>What’s Next?</strong> <p>Once saved, your ContactUs.com account is now connected with your Contact Form 7 form. Visit your ContactUs.com admin panel to: </p> <ul> <li><a href="<?php echo $cus_CRED_url; ?> &confirmed=1" target="_blank" rel="toDash" class="deep_link_action btn action_orange_button_2">View Your Stats</a></li> </ul> </td> </tr> </tbody> </table> </div> <!-- insert video tutorial --> <div id="cf7cloud_video"> <?php if (strlen($credentials['API_Key']) && strlen($credentials['API_Account'])) { ?> <p> <a href="<?php echo $cus_CRED_url; ?> &confirmed=1" target="_blank" rel="toDash" class="action_orange_button_2 btn">Form Control Panel</a> <a href="<?php echo $cus_CRED_url; ?> &confirmed=1&redir_url=<?php echo urlencode(trim($default_deep_link)); ?> %26expand=103" target="_blank" rel="toDash" class="action_orange_button_2 btn">Software Integrations</a> </p> <hr/> <br/> <?php } ?> <div class="cf7integrations_support"> <h2>Contact Form 7 Integrations Support</h2> <ul> <li><a href="http://help.contactus.com/hc/en-us/articles/200918046-Installing-the-CF7-Integrations-Plugin" target="_blank">Installing the CF7 Integrations Plugin</a></li> <li><a href="http://help.contactus.com/hc/en-us/articles/200919166-Setting-up-your-Contact-Form-7-Integrations-Plugin" target="_blank">Setting up your "Contact Form 7 Integrations" Plugin</a></li> <li><a href="http://help.contactus.com/hc/en-us/articles/201083933-Creating-a-POST-form-type" target="_blank">Creating a POST form type</a></li> <li><a href="http://help.contactus.com/hc/en-us/articles/200927346-Integrating-your-Contact-Form-7-with-Third-party-applications" target="_blank">Integrating your Contact Form 7 with Third party applications</a></li> <li><a href="http://help.contactus.com/hc/en-us/requests/new" target="_blank"><strong>Submit support ticket</strong></a></li> </ul> <hr/> <h2>Step by Step Instructions</h2> <iframe src="//www.youtube.com/embed/videoseries?list=PL0S7fxBYpaTEB-GJtkE0lgDe0XHhzEXrG" width="100%" height="220" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> </div> <!-- / insert video tutorial --> </div> <br class="clear" /> <?php }
$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 } if (!strlen($defaultFormId)) { $cUsAPI_getFormKeys = $cUsComAPI_Cloud->getFormKeysAPI($cUs_API_Account, $cUs_API_Key); //api hook; $defaultFormId = $cUsComAPI_Cloud->getDefaultFormID($cUsAPI_getFormKeys); update_option('cUsCloud_settings_form_id', $defaultFormId); // DEFAULT FORM KEYS } $partnerID = $cUsComAPI_Cloud->get_partner_id($default_deep_link); $cus_CRED_url = $cus_par_url . '/index.php?loginName=' . $cUs_API_Account . '&userPsswd=' . urlencode($cUs_API_Key); ?> <?php if (strlen($credentials['API_Key']) && strlen($credentials['API_Account'])) { ?> <a href="<?php echo $cus_CRED_url; ?> &confirmed=1" target="_blank" rel="toDash" class="action_orange_button btn">Form Control Panel</a><?php } ?> <?php }