if (!defined('CP_AUTH_INCLUDE')) { echo 'Direct access not allowed.'; exit; } ?> <link href="<?php echo plugins_url('css/stylepublic.css', __FILE__); ?> " type="text/css" rel="stylesheet" /> <link href="<?php echo plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__); ?> " type="text/css" rel="stylesheet" /> <?php $raw_form_str = str_replace("\r", " ", str_replace("\n", " ", cp_calculatedfieldsf_cleanJSON(cp_calculatedfieldsf_get_option('form_structure', CP_CALCULATEDFIELDSF_DEFAULT_form_structure, $id)))); $form_data = json_decode($raw_form_str); if (is_null($form_data)) { $json = new JSON(); $form_data = $json->unserialize($raw_form_str); } if (!is_null($form_data) && isset($form_data[1]) && isset($form_data[1][0]) && isset($form_data[1][0]->formtemplate)) { $templatelist = cp_calculatedfieldsf_available_templates(); if (isset($templatelist[$form_data[1][0]->formtemplate])) { print '<link href="' . esc_attr(esc_url($templatelist[$form_data[1][0]->formtemplate]['file'])) . '" type="text/css" rel="stylesheet" />'; if (isset($templatelist[$form_data[1][0]->formtemplate]['js'])) { print '<script src="' . esc_attr(esc_url($templatelist[$form_data[1][0]->formtemplate]['js'])) . '"></script>'; } } } $raw_form_str = str_replace('"', '"', esc_attr($raw_form_str));
function cp_calculatedfieldsf_get_option($field, $default_value, $id = '') { $value = ''; if (!defined("CP_CALCULATEDFIELDSF_ID")) { define("CP_CALCULATEDFIELDSF_ID", 1); } if ($id == '') { $id = CP_CALCULATEDFIELDSF_ID; } global $wpdb, $cp_calculatedfieldsf_option_buffered_item, $cp_calculatedfieldsf_option_buffered_id; if ($cp_calculatedfieldsf_option_buffered_id == $id) { if (property_exists($cp_calculatedfieldsf_option_buffered_item, $field)) { $value = @$cp_calculatedfieldsf_option_buffered_item->{$field}; } } else { $myrows = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . " WHERE id=%d", $id)); if (!empty($myrows)) { if (property_exists($myrows[0], $field)) { $value = @$myrows[0]->{$field}; } else { $value = $default_value; } $cp_calculatedfieldsf_option_buffered_item = $myrows[0]; $cp_calculatedfieldsf_option_buffered_id = $id; } else { $value = $default_value; } } if ($field == 'form_structure' && !is_array($value)) { $raw_form_str = cp_calculatedfieldsf_cleanJSON($value); $form_data = json_decode($raw_form_str); if (is_null($form_data)) { $json = new JSON(); $form_data = $json->unserialize($raw_form_str); } $value = $cp_calculatedfieldsf_option_buffered_item->form_structure = !is_null($form_data) ? $form_data : ''; } if ($field == 'vs_all_texts' && empty($value) || $value == '' && $cp_calculatedfieldsf_option_buffered_item->form_structure == '') { $value = $default_value; } /** * Filters applied before returning a form option, * use three parameters: The value of option, the name of option and the form's id * returns the new option's value */ $value = apply_filters('cpcff_get_option', $value, $field, $id); return $value; }
?> " /> <div id="normal-sortables" class="meta-box-sortables"> <h2>Form Settings:</h2> <hr /> <div>* Different form styles available on the tab Form Settings >> Form Template</div> <div id="metabox_basic_settings" class="postbox" > <h3 class='hndle' style="padding:5px;"><span>Form Builder</span></h3> <div class="inside"> <p style="border:1px solid #F0AD4E;background:#FBE6CA;padding:10px;">If you need also the form to be sent to the server side for processing (for example to deliver emails) then the <a href="http://wordpress.dwbooster.com/forms/calculated-fields-form#download">Professional or Developer versions</a> of the plugin will be required.</p> <input type="hidden" name="form_structure" id="form_structure" value="<?php echo str_replace('"', '"', str_replace("\r", "", str_replace("\n", "", esc_attr(cp_calculatedfieldsf_cleanJSON(cp_calculatedfieldsf_get_option('form_structure', CP_CALCULATEDFIELDSF_DEFAULT_form_structure)))))); ?> " /> <input type="hidden" name="templates" id="templates" value="<?php echo str_replace('"', '"', esc_attr(json_encode(cp_calculatedfieldsf_available_templates()))); ?> " /> <link href="<?php echo plugins_url('css/style.css', __FILE__); ?> " type="text/css" rel="stylesheet" /> <link href="<?php echo plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__); ?> " type="text/css" rel="stylesheet" />