Пример #1
0
    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);
    }
Пример #2
0
 function wpsight_contact_fields()
 {
     // Get labels
     $labels = wpsight_contact_labels();
     // Extract labels
     extract($labels, EXTR_SKIP);
     // Set contact fields
     $fields = array('fields_1' => array('id' => 'contact_name', 'label' => $name, 'label_email' => $name_email, 'required' => true, 'type' => 'text', 'placeholder' => true, 'before' => false, 'after' => false, 'value' => false, 'position' => 10), 'fields_2' => array('id' => 'contact_email', 'label' => $email, 'label_email' => $email_email, 'required' => 'email', 'type' => 'text', 'placeholder' => true, 'before' => false, 'after' => false, 'value' => false, 'position' => 20), 'fields_3' => array('id' => 'contact_phone', 'label' => $phone, 'label_email' => $phone_email, 'required' => false, 'type' => 'numbers', 'placeholder' => true, 'before' => false, 'after' => false, 'value' => false, 'position' => 30), 'fields_4' => array('id' => 'contact_message', 'label' => $message, 'label_email' => $message_email, 'required' => true, 'type' => 'textarea', 'placeholder' => true, 'before' => false, 'after' => false, 'value' => false, 'position' => 40), 'captcha' => array('show' => true, 'type' => 'string', 'placeholder' => false, 'case_sensitive' => false, 'code_length' => 4, 'image_width' => 150, 'image_height' => 60, 'perturbation' => 0.5, 'bg_color' => '#ffffff', 'text_color' => '#606060', 'num_lines' => 6, 'line_color' => '#6e6e6e', 'font' => './AHGBold.ttf', 'before' => false, 'after' => false, 'value' => false, 'position' => false));
     // Apply filter to array
     $fields = apply_filters('wpsight_contact_fields', $fields);
     // Sort array by position
     $fields = wpsight_sort_array_by_position($fields);
     // ensure that 'required' is always set.
     foreach ($fields as &$field) {
         if (!isset($field['required'])) {
             $field['required'] = false;
         }
     }
     // Return array
     return $fields;
 }
Пример #3
0
<?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>
	
Пример #4
0
 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);
 }