public function render($location = false, $args = false, $context = array()) { ++$this->_times_rendered; // Don't show when password required if (post_password_required()) { return; } // Get contact fields $fields = wpsight_contact_fields(); // Get contact labels $labels = wpsight_contact_labels(); // Get captcha image class require_once WPSIGHT_ADMIN_DIR . '/captcha/securimage.php'; if (isset($_POST['submitted'])) { // will poplulate $errors and $values extract($this->_handle_submit($fields, $labels)); if (empty($errors)) { $success = $this->_send_mail($location, $values, $args); ?> <div class="form-field-confirm"> <p><?php echo $success ? $labels['confirm'] : $labels['sending_failed']; ?> </p> </div> <?php return; } else { ?> <div class="form-error form-field-error"> <?php echo $labels['error']; ?> </div> <?php } } else { $errors = array(); $values = array(); } do_action('wpsight_contact_form_fields', $_POST, $location, $errors); }
<?php /** * Email HTML template for emails * sent through contact form on * contact page template * * @since 1.2 */ // Get contact fields $contact_fields = wpsight_contact_fields(); // Get contact labels $contact_labels = wpsight_contact_labels(); ?> <html> <head> <style type="text/css"> html, body{ width: 100% !important; margin-top: 0px !important; padding-top: 0px !important; } body{ margin-top: 0px !important; padding-top: 0px !important; font-family:sans-serif; } table{ margin-top: 0px !important; padding-top: 0px !important; } td{ padding: 5px 0; vertical-align: top;} a, img{ outline: none !important; border: none !important;} img{ margin: 5px 0;} h3, #logo-text a { font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; line-height: 1.1; margin-bottom: 15px; color:#ddd; font-weight:500; font-size: 27px; } #logo-text a { color: #aaa; text-decoration: none; font-size: 48px; letter-spacing: -1px; } </style> <head>
function wpsight_contact_placeholders($fields) { // Get contact fields $contact_fields = wpsight_contact_fields(); // Get contact labels $contact_labels = wpsight_contact_labels(); // Set body placeholders $placeholders = array(); // Set site place holder $placeholders['[site]'] = apply_filters('wpsight_listing_contact_site', get_bloginfo('name')); foreach ($contact_fields as $k => $v) { // Set placeholder to false by default $v['placeholder'] = isset($v['placeholder']) ? $v['placeholder'] : false; if ($k == 'captcha' || $k == 'copy') { continue; } $field = $v['id']; // Create placeholder for each field if ($v['placeholder'] == true) { if (!empty($v['data'])) { $key = $fields[$field]; if (!is_array($key)) { $label = $v['data'][$key]; $placeholders['[' . str_replace('contact-', '', $field) . ']'] = $label; } else { /** * For checkboxes and radio buttons * we have to deal with arrays in $get_post */ $values = ''; $counter = 1; // Create comma list of values foreach ($key as $value) { if ($counter > 1) { $values .= ', '; } $values .= $v['data'][$value]; $counter++; } $placeholders['[' . str_replace('contact-', '', $field) . ']'] = $values; } } else { $placeholders['[' . str_replace('contact-', '', $field) . ']'] = $fields[$field]; } } } return apply_filters('wpsight_contact_placeholders', $placeholders, $fields); }