Plugin Directory

Changeset 687822


Ignore:
Timestamp:
03/27/2013 02:05:14 AM (13 years ago)
Author:
properwp
Message:

0.9.5 update

Location:
proper-contact-form/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • proper-contact-form/trunk/README.md

    r610257 r687822  
    1 Proper Contact Platform
     1PROPER Contact Form
    22=================
    33
     
    66At the moment, this simply creates a contact form with the shortcode [proper_contact_form]. There is a settings page to tinker with a few of the options, and allows you to validate and submit to a new page to help with goal tracking in analytics.
    77
    8 This will eventually be submitted to the WordPress repo, most likely after the first feature listed below. There are a bazillion contact form plugins out there but nothing I've ever liked using or extending. I usually just code my own but I want a bit of flexibility for clients and projects, hance this.
     8This will eventually be submitted to the WordPress repo, most likely after the first feature listed below. There are a bazillion contact form plugins out there but nothing I've ever liked using or extending. I usually just code my own but I want a bit of flexibility for clients and projects, hence this.
    99
    1010Planned features, in order:
     
    12121) Custom forms using shortcodes - this appears to be the easiest way to create forms both in the content, using the shortcode tag, and in the template, using `do_shortcut()`. We're working on the best way to balance flexibility, functionality, and ease-of-use.
    1313
    14 2) Storing form submissions - since we're pushing changes to the database from a public form, we have to be very careful here. I've tested a proof of concept in a few places but want to make sure it's solid before I release it.
    15 
    16 3) TinyLetter and Mailchimp integration - at some point, since I use these so often in my other projects.
     142) TinyLetter and Mailchimp integration - at some point, since I use these so often in my other projects.
  • proper-contact-form/trunk/css/admin.css

    r646683 r687822  
    11@charset "UTF-8";
    22/* CSS Document */
    3 #proper-contact-options {width: 60%; min-width: 400px}
     3#proper-contact-options {width: 80%; min-width: 400px}
    44#proper-contact-options th, #proper-contact-options td {display: table-cell; border-bottom: 1px solid #f1f1f1; padding: 10px;}
    55#proper-contact-options th {text-align: left; font-size: 1.1em; font-weight: bold;}
  • proper-contact-form/trunk/inc/FormBuilder.php

    r610257 r687822  
    1212   
    1313    // Make sure a submit button is output
    14     private $has_submit = false;
     14    private $has_submit = FALSE;
    1515   
    1616    // Constructor to set basic form attributes
    17     function __construct($action = '', $args = false) {
     17    function __construct($action = '', $args = FALSE) {
    1818       
    1919        $defaults = array(
     
    2424            'id' => '',
    2525            'markup' => 'html',
    26             'novalidate' => false,
    27             'add_nonce' => false,
    28             'add_honeypot' => true,
     26            'novalidate' => FALSE,
     27            'add_nonce' => FALSE,
     28            'add_honeypot' => TRUE,
     29            'submit_text' => 'Submit'
    2930        );
    3031       
     
    4647           
    4748            case 'method':
    48                 if (! in_array($val, array('post', 'get'))) return false;
     49                if (! in_array($val, array('post', 'get'))) return FALSE;
    4950                break;
    5051           
    5152            case 'enctype':
    52                 if (! in_array($val, array('application/x-www-form-urlencoded', 'multipart/form-data'))) return false;
     53                if (! in_array($val, array('application/x-www-form-urlencoded', 'multipart/form-data'))) return FALSE;
    5354                break;
    5455           
    5556            case 'markup':
    56                 if (! in_array($val, array('html', 'xhtml'))) return false;
     57                if (! in_array($val, array('html', 'xhtml'))) return FALSE;
    5758                break;
    5859           
    5960            case 'class':
    6061            case 'id':
    61                 if (! $this->_check_valid_attr($val)) return false;
     62                if (! $this->_check_valid_attr($val)) return FALSE;
    6263                break;
    6364           
    6465            case 'novalidate':
    6566            case 'add_honeypot':
    66                 if (! is_bool($val)) return false;
     67                if (! is_bool($val)) return FALSE;
    6768                break;
    6869           
    6970            case 'add_nonce':
    70                 if (! is_string($val) && !is_bool($val)) return false;
     71                if (! is_string($val) && !is_bool($val)) return FALSE;
    7172                break;
    7273           
    7374            default:
    74                 return false;
     75                return FALSE;
    7576           
    7677        endswitch;
     
    7879        $this->form[$key] = $val;
    7980       
    80         return true;
     81        return TRUE;
    8182       
    8283    }
     
    100101            'max' => '',
    101102            'step' => '',
    102             'autofocus' => false,
    103             'checked' => false,
    104             'required' => false,
    105             'add_label' => true,
     103            'autofocus' => FALSE,
     104            'checked' => FALSE,
     105            'required' => FALSE,
     106            'add_label' => TRUE,
    106107            'options' => array(),
    107108            'wrap_tag' => 'div',
     
    123124    function add_inputs($arr) {
    124125       
    125         if (!is_array($arr)) return false;
     126        if (!is_array($arr)) return FALSE;
    126127       
    127128        foreach ($arr as $field) :
     
    132133   
    133134    // Parse the inputs and build the form HTML
    134     function build_form($echo = true) {
     135    function build_form($echo = TRUE) {
    135136   
    136137        $output = '
     
    163164            $this->add_input('WordPress nonce', array(
    164165                'value' => wp_create_nonce($this->form['add_nonce']),
    165                 'add_label' => false,
     166                'add_label' => FALSE,
    166167                'type' => 'hidden'
    167168            ));
     
    223224               
    224225                case 'submit':
    225                     $this->has_submit = true;
    226                     break;
     226                    $this->has_submit = TRUE;
     227                    $val['value'] = $val['label'];
    227228               
    228229                default :
     
    292293    private function _check_valid_attr($string) {
    293294       
    294         $result = true;
     295        $result = TRUE;
    295296       
    296297        // Check $name for correct characters
  • proper-contact-form/trunk/proper-contact-form.php

    r660317 r687822  
    1 <?php 
     1<?php
    22
    33/*
     
    55Plugin URI: http://theproperweb.com/shipped/wp/proper-contact-form
    66Description: A better contact form processor
    7 Version: 0.9.3
     7Version: 0.9.5
    88Author: PROPER Development
    99Author URI: http://theproperweb.com
     
    1515
    1616function proper_contact_form($atts, $content = NULL) {
    17    
     17
    1818    if (isset($_SESSION['propercfp_sent']) && $_SESSION['propercfp_sent'] === 'yes') :
    1919        unset($_SESSION['propercfp_sent']);
    2020        return '
    2121        <div class="proper_contact_form_wrap">
    22             <h2>'.proper_get_key('propercfp_label_submit').'</h2>
     22            <h2>'.proper_contact_get_key('propercfp_label_submit').'</h2>
    2323        </div>';
    2424    endif;
    25    
     25
    2626    // FormBuilder
    2727    require_once(plugin_dir_path( __FILE__ ) . '/inc/FormBuilder.php');
    28    
     28
    2929    $form = new ThatFormBuilder;
    30    
     30
    3131    $form->set_att('id', 'proper_contact_form_' . get_the_id());
    3232    $form->set_att('class', array('proper_contact_form'));
    3333    $form->set_att('add_nonce', get_bloginfo('admin_email'));
     34    if (proper_contact_get_key('propercfp_html5_no_validate') === '') {
     35        $form->set_att('novalidate', TRUE);
     36    }
     37
    3438
    3539    // Add name field if selected on the settings page
    36     if( proper_get_key('propercfp_name_field') ) :
    37         $required = proper_get_key('propercfp_name_field') === 'req' ? TRUE : FALSE;
    38         $form->add_input(stripslashes(proper_get_key('propercfp_label_name')), array(
     40    if( proper_contact_get_key('propercfp_name_field') ) :
     41        $required = proper_contact_get_key('propercfp_name_field') === 'req' ? TRUE : FALSE;
     42        $form->add_input(stripslashes(proper_contact_get_key('propercfp_label_name')), array(
    3943            'required' => $required,
    40             'wrap_class' => isset($_SESSION['cfp_contact_errors']['contact-name']) ? array('form_field_wrap', 'error') : array('form_field_wrap')
     44            'wrap_class' => isset($_SESSION['cfp_contact_errors']['contact-name'])
     45                ? array('form_field_wrap', 'error')
     46                : array('form_field_wrap')
    4147        ), 'contact-name');
    4248    endif;
    43    
     49
    4450    // Add email field if selected on the settings page
    45     if( proper_get_key('propercfp_email_field') ) :
    46         $required = proper_get_key('propercfp_email_field') === 'req' ? TRUE : FALSE;
    47         $form->add_input(stripslashes(proper_get_key('propercfp_label_email')), array(
     51    if( proper_contact_get_key('propercfp_email_field') ) :
     52        $required = proper_contact_get_key('propercfp_email_field') === 'req' ? TRUE : FALSE;
     53        $form->add_input(stripslashes(proper_contact_get_key('propercfp_label_email')), array(
    4854            'required' => $required,
    4955            'type' => 'email',
    50             'wrap_class' => isset($_SESSION['cfp_contact_errors']['contact-email']) ? array('form_field_wrap', 'error') : array('form_field_wrap')
     56            'wrap_class' => isset($_SESSION['cfp_contact_errors']['contact-email'])
     57                ? array('form_field_wrap', 'error')
     58                : array('form_field_wrap')
    5159        ), 'contact-email');
    5260    endif;
    53    
     61
    5462    // Add phone field if selected on the settings page
    55     if( proper_get_key('propercfp_phone_field') ) :
    56         $required = proper_get_key('propercfp_phone_field') === 'req' ? TRUE : FALSE;
    57         $form->add_input(stripslashes(proper_get_key('propercfp_label_phone')), array(
    58             'required' => $required
     63    if( proper_contact_get_key('propercfp_phone_field') ) :
     64        $required = proper_contact_get_key('propercfp_phone_field') === 'req' ? TRUE : FALSE;
     65        $form->add_input(stripslashes(proper_contact_get_key('propercfp_label_phone')), array(
     66            'required' => $required,
     67            'wrap_class' => isset( $_SESSION['cfp_contact_errors']['contact-phone'] )
     68                ? array ( 'form_field_wrap', 'error' )
     69                : array ( 'form_field_wrap' )
    5970        ), 'contact-phone');
    6071    endif;
    61    
     72
    6273    // Add reasons drop-down
    63     $reasons = trim(proper_get_key('propercfp_reason'));
    64     if(!empty($reasons)) :
    65         $options = proper_get_textarea_opts($reasons);
    66         if (!empty($options))
    67             array_unshift($options, 'Select one...');
    68             $form->add_input(stripslashes(proper_get_key('propercfp_label_reason')), array(
    69                 'type' => 'select',
    70                 'options' => $options
    71             ), 'contact-reasons');
    72     endif;
    73    
     74    $reasons = trim(proper_contact_get_key('propercfp_reason'));
     75    $options = proper_get_textarea_opts( $reasons );
     76    if (!empty($options)) {
     77        array_unshift($options, 'Select one...');
     78        $form->add_input(stripslashes(proper_contact_get_key('propercfp_label_reason')), array(
     79            'type' => 'select',
     80            'options' => $options
     81        ), 'contact-reasons');
     82    }
     83
     84
    7485    // Comment field
    75     $form->add_input(stripslashes(proper_get_key('propercfp_label_comment')), array(
     86    $form->add_input(stripslashes(proper_contact_get_key('propercfp_label_comment')), array(
    7687        'required' => TRUE,
    7788        'type' => 'textarea',
    7889        'wrap_class' => isset($_SESSION['cfp_contact_errors']['question-or-comment']) ? array('form_field_wrap', 'error') : array('form_field_wrap')
    7990    ), 'question-or-comment');
    80    
    81     // IP Address
    82     $form->add_input('Contact IP', array(
    83         'type' => 'hidden',
    84         'value' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''
    85     ));
    86    
     91
     92    // Submit button
     93    $form->add_input( proper_contact_get_key( 'propercfp_label_submit_btn' ), array(
     94        'type' => 'submit'
     95    ), 'submit');
     96
    8797    // Referring site
    8898    $form->add_input('Contact Referrer', array(
     
    90100        'value' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''
    91101    ));
    92    
     102
    93103    // Referring page
    94104    if (isset($_REQUEST['src']) || isset($_REQUEST['ref'])) :
     
    98108        ));
    99109    endif;
    100    
     110
    101111    $errors = '';
    102112    if (isset($_SESSION['cfp_contact_errors']) && !empty($_SESSION['cfp_contact_errors'])) :
     
    104114        unset($_SESSION['cfp_contact_errors']);
    105115    endif;
    106    
     116
    107117    return '
    108118    <div class="proper_contact_form_wrap">
    109119    ' . $errors . $form->build_form(FALSE) . '
    110120    </div>';
    111    
     121
    112122}
    113123add_shortcode( 'proper_contact_form', 'proper_contact_form' );
    114124
    115125function cfp_process_contact() {
    116    
     126
    117127    // If POST, nonce and honeypot are not set, escape
    118128    if (empty($_POST)) return;
    119129    if (! isset($_POST['wordpress-nonce'])) return;
    120130    if (! isset($_POST['honeypot'])) return;
    121    
     131
    122132    // Session variable for form errors
    123133    $_SESSION['cfp_contact_errors'] = array();
    124    
     134
    125135    // If nonce is not passed or honeypot is not empty, escape
    126     if (! wp_verify_nonce($_POST['wordpress-nonce'], get_bloginfo('admin_email')))
    127         $_SESSION['cfp_contact_errors']['nonce'] = 'Invalid form submission!';
    128        
    129     if (! empty($_POST['honeypot']))
    130         $_SESSION['cfp_contact_errors']['honeypot'] = 'No spam please!';
    131    
     136    if (! wp_verify_nonce($_POST['wordpress-nonce'], get_bloginfo('admin_email'))) {
     137        $_SESSION['cfp_contact_errors']['nonce'] = 'Nonce failed!';
     138    }
     139
     140    if (! empty($_POST['honeypot'])) {
     141        $_SESSION['cfp_contact_errors']['honeypot'] = 'Form submission failed!';
     142    }
     143
    132144    $body = "
    133 *** Contact form submission on " . get_bloginfo('name') . " (" . site_url() . ")\n\n";
    134    
     145*** Contact form submission on " . get_bloginfo('name') . " (" . site_url() . ") *** \n\n";
     146
    135147    // Sanitize and validate name
    136148    $contact_name = isset($_POST['contact-name']) ? sanitize_text_field(trim($_POST['contact-name'])) : '';
    137     if (proper_get_key('propercfp_name_field') === 'req' && empty($contact_name))
    138         $_SESSION['cfp_contact_errors']['contact-name'] = 'Enter your name';
    139     else
    140         $body .= "
    141 Name: $contact_name\n";
    142    
     149    if (proper_contact_get_key('propercfp_name_field') === 'req' && empty($contact_name)) {
     150        $_SESSION['cfp_contact_errors']['contact-name'] = proper_contact_get_key('propercfp_label_err_name');
     151    } elseif ( !empty( $contact_name ) ) {
     152        $body .= stripslashes( proper_contact_get_key( 'propercfp_label_name' ) ) . ": $contact_name \r";
     153    }
     154
    143155    // Sanitize and validate email
    144156    $contact_email = isset($_POST['contact-email']) ? sanitize_email($_POST['contact-email']) : '';
    145     if (proper_get_key('propercfp_email_field') === 'req' && ! filter_var($contact_email, FILTER_VALIDATE_EMAIL) )
    146         $_SESSION['cfp_contact_errors']['contact-email'] = 'Enter a valid email';
    147     elseif (!empty($contact_email))
    148         $body .= "
    149 Email: $contact_email\r
    150 Email search: https://www.google.com/#q=$contact_email\n";
    151    
     157    if (proper_contact_get_key('propercfp_email_field') === 'req' && ! filter_var($contact_email, FILTER_VALIDATE_EMAIL) ) {
     158        $_SESSION['cfp_contact_errors']['contact-email'] = proper_contact_get_key('propercfp_label_err_email');
     159    } elseif (!empty($contact_email)) {
     160        $body .= stripslashes( proper_contact_get_key( 'propercfp_label_email' ) ) . ": $contact_email \r
     161Google: https://www.google.com/#q=$contact_email \r";
     162    }
     163
    152164    // Sanitize phone number
    153165    $contact_phone = isset($_POST['contact-phone']) ? sanitize_text_field($_POST['contact-phone']) : '';
    154     if (proper_get_key('propercfp_phone_field') === 'req' && empty($contact_phone) )
    155         $_SESSION['cfp_contact_errors']['contact-phone'] = 'Please enter a phone number';
    156     elseif (!empty($contact_phone))
    157         $body .= "
    158 Phone: $contact_phone\n";
    159        
     166    if (proper_contact_get_key('propercfp_phone_field') === 'req' && empty($contact_phone) ) {
     167        $_SESSION['cfp_contact_errors']['contact-phone'] = proper_contact_get_key('propercfp_label_err_phone');
     168    } elseif (!empty($contact_phone)) {
     169        $body .= stripslashes( proper_contact_get_key( 'propercfp_label_phone' ) ) . ": $contact_phone \r";
     170    }
     171
    160172    // Sanitize contact reason
    161173    $contact_reason = isset($_POST['contact-reasons']) ? strip_tags($_POST['contact-reasons']) : '';
    162     if (!empty($contact_reason))
    163         $body .= "
    164 Reason for contacting: $contact_reason\n";
    165    
     174    if (!empty($contact_reason)) {
     175        $body .= stripslashes( proper_contact_get_key( 'propercfp_label_reason' ) ) . ": $contact_reason \r";
     176    }
     177
    166178    // Sanitize and validate comments
    167179    $contact_comment = sanitize_text_field(trim($_POST['question-or-comment']));
    168     if (empty($contact_comment))
    169         $_SESSION['cfp_contact_errors']['question-or-comment'] = 'Enter your question or comment';
    170     else
    171         $body .= "
    172 Comment/question: " . stripslashes($contact_comment) . "\n";
    173    
     180    if (empty($contact_comment)) {
     181        $_SESSION['cfp_contact_errors']['question-or-comment'] = proper_contact_get_key('propercfp_label_err_no_content');
     182    } else {
     183        $body .= "\n\n" . stripslashes( proper_contact_get_key( 'propercfp_label_comment' ) ) . ": " . stripslashes($contact_comment) . " \n\n";
     184    }
     185
    174186    // Sanitize and validate IP
    175     $contact_ip = filter_var($_POST['contact-ip'], FILTER_VALIDATE_IP);
    176     if (!empty($contact_ip))
    177         $body .= "
    178 IP address: $contact_ip \r
    179 IP search: http://whatismyipaddress.com/ip/$contact_ip\n";
    180    
     187    $contact_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);
     188    if (!empty($contact_ip)) {
     189        $body .= "IP address: $contact_ip \r
     190IP search: http://whatismyipaddress.com/ip/$contact_ip \n\n";
     191    }
     192
    181193    // Sanitize and prepare referrer
    182194    $contact_referrer = sanitize_text_field($_POST['contact-referrer']);
    183     if (!empty($contact_referrer))
    184         $body .= "
    185 Came from: $contact_referrer\n";
    186    
    187     $body .= '
    188 Sent from page: ' . get_permalink(get_the_id());
    189    
     195    if (!empty($contact_referrer)) {
     196        $body .= "Came from: $contact_referrer \r";
     197    }
     198
     199    $body .= 'Sent from page: ' . get_permalink(get_the_id());
     200
    190201    if (empty($_SESSION['cfp_contact_errors'])) :
    191202
    192         $site_email = proper_get_key('propercfp_email');
     203        $site_email = proper_contact_get_key('propercfp_email');
    193204        $site_name = get_bloginfo('name');
    194        
     205
     206        if ( empty( $contact_name ) ) {
     207            $contact_name = !empty( $contact_email ) ? $contact_email : '[None given]';
     208        }
     209
     210        if ( empty( $contact_email ) ) {
     211            $contact_email = $site_email;
     212        }
     213
     214        $headers = array();
    195215        $headers[] = "From: $contact_name <$contact_email>";
    196216        $headers[] = "Reply-To: $contact_email";
    197         $headers[] = 'X-Mailer: PHP/' . phpversion();
    198        
     217
    199218        wp_mail($site_email, 'Contact on ' . $site_name, $body, $headers);
    200        
    201         // Should a confirm email be sent?
    202         $confirm_body = stripslashes(trim(proper_get_key('propercfp_confirm_email')));
    203         if (!empty($confirm_body)) :
     219
     220        // Should a confirm email be sent?
     221        $confirm_body = stripslashes(trim(proper_contact_get_key('propercfp_confirm_email')));
     222        if (!empty($confirm_body) && !empty( $contact_email ) ) :
     223            $headers = array ();
    204224            $headers[] = "From: $site_name <$site_email>";
    205225            $headers[] = "Reply-To: $site_email";
    206             $headers[] = 'X-Mailer: PHP/' . phpversion();
    207             wp_mail($contact_email, 'Your contact on ' . get_bloginfo('name'), $confirm_body, $headers);
     226            wp_mail($contact_email, proper_contact_get_key( 'propercfp_label_submit' ) . ' - ' . get_bloginfo('name'), $confirm_body, $headers);
    208227        endif;
    209        
     228
    210229        // Should the entry be stored in the DB?
    211         if (proper_get_key('propercfp_store') === 'yes') :
     230        if (proper_contact_get_key('propercfp_store') === 'yes') :
    212231            $new_post_id = wp_insert_post(array(
    213232                'post_type' => 'proper_contact',
    214                 'post_title' => date('l, M j, Y', time()) . ' by "' . $contact_name . '"',
     233                'post_title' => date('l, M j, Y', time()) . ( empty( $contact_name ) ? '' : ' by "' . $contact_name . '"'),
    215234                'post_content' => $body,
    216235                'post_author' => 1,
    217236                'post_status' => 'private'
    218237            ));
    219             if (isset($contact_email) && !empty($contact_email)) add_post_meta($new_post_id, 'Contact email', $contact_email);
     238            if (isset($contact_email) && !empty($contact_email)) {
     239                add_post_meta($new_post_id, 'Contact email', $contact_email);
     240            }
    220241        endif;
    221        
     242
    222243        // Should the user get redirected?
    223         if( proper_get_key('propercfp_result_url')) :
    224             $redirect_id = proper_get_key('propercfp_result_url');
     244        if( proper_contact_get_key('propercfp_result_url')) :
     245            $redirect_id = proper_contact_get_key('propercfp_result_url');
    225246            $redirect = get_permalink($redirect_id);
    226247            wp_redirect($redirect);
     
    228249            $_SESSION['propercfp_sent'] = 'yes';
    229250        endif;
    230        
    231     endif;
    232    
     251
     252    endif;
     253
    233254}
    234255add_action('template_redirect', 'cfp_process_contact');
     
    241262include('settings.php');
    242263
    243 if (! function_exists('proper_get_key')) :
    244 function proper_get_key($id) {
    245     global $propercfp_options;
    246     if (isset($propercfp_options[$id])) return $propercfp_options[$id];
    247     else return '';
    248 }
    249 endif;
     264function proper_contact_get_key($id) {
     265    global $propercfp_options, $plugin_options;
     266    return isset( $propercfp_options[$id] ) ? $propercfp_options[$id] : $plugin_options[$id][4];
     267}
    250268
    251269
     
    256274    wp_register_style( 'proper_contact_styles', plugins_url('css/front.css', __FILE__));
    257275    wp_enqueue_style( 'proper_contact_styles' );
    258 } 
    259    
    260 if (proper_get_key('propercfp_css') === 'yes')
     276}
     277
     278if (proper_contact_get_key('propercfp_css') === 'yes')
    261279    add_action('wp_enqueue_scripts', 'proper_contact_styles');
    262    
    263    
     280
     281
    264282/*
    265283Store submissions in the DB
     
    277295    'view_item' => __('View Contact'),
    278296    'not_found' =>  __('No Contacts found'),
    279     'not_found_in_trash' => __('No Contacts found in Trash'), 
     297    'not_found_in_trash' => __('No Contacts found in Trash'),
    280298    'parent_item_colon' => '',
    281299    'menu_name' => 'Contacts'
     
    293311        'menu_icon' => plugin_dir_url(__FILE__) . '/images/person.png',
    294312    'supports' => array( 'title', 'editor', 'custom-fields')
    295   ); 
     313  );
    296314  register_post_type('proper_contact',$args);
    297315}
    298316
    299 if (proper_get_key('propercfp_store') === 'yes')
     317if (proper_contact_get_key('propercfp_store') === 'yes')
    300318    add_action( 'init', 'proper_contact_content_type' );
    301    
    302    
     319
  • proper-contact-form/trunk/readme.txt

    r652705 r687822  
    11=== Proper Contact Form ===
    2 Contributors: properwp
     2Contributors: properwp, joshcanhelp
    33Donate link:
    44Tags: contact, contact form
    55Requires at least: 3.0
    6 Tested up to: 3.5
    7 Stable tag: 0.9.3
     6Tested up to: 3.5.1
     7Stable tag: 0.9.5
    88
    99Creates a flexible, secure contact form on your WP site
     
    1818- Create an auto-respond email
    1919- Redirect contact submissions to a new page (helpful for goal tracking)
    20 - Store contacts in the admin
    21 - Over-ride label names
     20- Store contacts in the database
     21- Over-ride label names and error messages
    2222
    23 The current, basic functionality will not change but, in a future version, WP users will be able to add custom forms with validation quickly and easily.
     23Features in the works:
     24
     25- Additional style options
     26- Complete internationalization
     27- Ability to add custom fields to the form
    2428
    2529Get the absolute latest at the [Github repo](https://github.com/joshcanhelp/proper-contact-form).
     
    4650== Changelog ==
    4751
     52= 0.9.5 =
     53* Added text fields for error messages and submit button
     54* Added a setting to use HTML5 validation
     55* Changed to use custom label fields for email notification
     56* Changed to use the "Text to show when form is submitted..." text for the confirmation email subject
     57* Changed the email notification format slightly
     58* Setting better default text and information throughout
     59* Fixed the missing error formatting for the phone number field
     60
    4861= 0.9.3 =
    4962* Fixed name requirement issue
  • proper-contact-form/trunk/settings.php

    r646683 r687822  
    1414global $plugin_options;
    1515$plugin_options = array(
    16     array(
     16    'head1' => array(
    1717        'Fields to show',
    1818        '',
     
    2121        '',
    2222    ),
    23     array(
     23    'propercfp_name_field' => array(
    2424        'Name',
    2525        'propercfp_name_field',
     
    3333        ),
    3434    ),
    35     array(
     35    'propercfp_email_field' => array(
    3636        'Email address',
    3737        'propercfp_email_field',
     
    4545        ),
    4646    ),
    47     array(
     47    'propercfp_phone_field' => array(
    4848        'Phone number',
    4949        'propercfp_phone_field',
     
    5757        ),
    5858    ),
    59     array(
     59    'propercfp_reason' => array(
    6060        '"Reason for contacting" options',
    6161        'propercfp_reason',
     
    6464        '',
    6565    ),
    66     array(
     66    'head2' => array(
    6767        'Form processing options',
    6868        '',
     
    7171        '',
    7272    ),
    73     array(
     73    'propercfp_email' => array(
    7474        'Default contact submission email',
    7575        'propercfp_email',
     
    7878        get_bloginfo('admin_email')
    7979    ),
    80     array(
     80    'propercfp_result_url' => array(
    8181        '"Thank You" URL',
    8282        'propercfp_result_url',
     
    8686        proper_get_content_array()
    8787    ),
    88     array(
     88    'propercfp_css' => array(
    8989        'Add styles to the site',
    9090        'propercfp_css',
    91         'Checking this box will add styles to the form. By deafult, this is off so you can add your own styles.',
     91        'Checking this box will add styles to the form. By default, this is off so you can add your own styles.',
    9292        'checkbox',
    9393        '',
    9494    ),
    95     array(
     95    'propercfp_store' => array(
    9696        'Store submissions in the database',
    9797        'propercfp_store',
     
    100100        '',
    101101    ),
    102     array(
    103         'Send email confirmation<br />to form submitter',
     102    'propercfp_confirm_email' => array(
     103        'Send email confirmation to form submitter',
    104104        'propercfp_confirm_email',
    105         'Adding text here will send an email to the form submitter.',
     105        'Adding text here will send an email to the form submitter. The email uses the "Text to show when form is submitted..." field below as the subject line.',
    106106        'textarea',
    107107        '',
    108108    ),
    109     array(
     109    'head3' => array(
    110110        'Text overrides',
    111111        '',
     
    114114        '',
    115115    ),
    116     array(
     116    'propercfp_label_name' => array(
    117117        'Name field label',
    118118        'propercfp_label_name',
     
    121121        'Your full name'
    122122    ),
    123     array(
     123    'propercfp_label_email' => array(
    124124        'Email field label',
    125125        'propercfp_label_email',
     
    128128        'Your email address'
    129129    ),
    130     array(
     130    'propercfp_label_phone' => array(
    131131        'Phone field label<br />(if activated above)',
    132132        'propercfp_label_phone',
     
    135135        'Your phone number'
    136136    ),
    137     array(
     137    'propercfp_label_reason' => array(
    138138        'Reason for contacting label<br />(if activated above)',
    139139        'propercfp_label_reason',
     
    142142        'Reason for contacting'
    143143    ),
    144     array(
     144    'propercfp_label_comment' => array(
    145145        'Comment field label',
    146146        'propercfp_label_comment',
     
    149149        'Question or comment'
    150150    ),
    151     array(
    152         'Submit complete text<br />(if "Thank You" URL above is not set)',
     151    'propercfp_label_submit_btn' => array(
     152        'Submit button text',
     153        'propercfp_label_submit_btn',
     154        '',
     155        'text',
     156        'Submit'
     157    ),
     158    'propercfp_label_submit' => array(
     159        'Successful form submission text',
    153160        'propercfp_label_submit',
    154         '',
     161        'This text is used on the page if no "Thank You" URL is set above. This is also used as the confirmation email title, if one is set to send out.',
    155162        'text',
    156163        'Thank you for your contact!'
    157164    ),
    158    
     165    'head4' => array(
     166        'HTML5 validation',
     167        '',
     168        '',
     169        'title',
     170        '',
     171    ),
     172        'propercfp_html5_no_validate' => array(
     173        'Use HTML5 validation',
     174        'propercfp_html5_no_validate',
     175        '',
     176        'checkbox',
     177        'yes'
     178    ),
     179    'head5' => array (
     180        'Error Messages (if not using HTML5 validation)',
     181        '',
     182        '',
     183        'title',
     184        '',
     185    ),
     186    'propercfp_label_err_name' => array(
     187        'Error message if name required and missing',
     188        'propercfp_label_err_name',
     189        '',
     190        'text',
     191        'Enter your name'
     192    ),
     193    'propercfp_label_err_email' => array(
     194        'Error message if E-mail required and missing',
     195        'propercfp_label_err_email',
     196        '',
     197        'text',
     198        'Enter a valid email'
     199    ),
     200    'propercfp_label_err_phone' => array(
     201        'Error message if phone required and missing',
     202        'propercfp_label_err_phone',
     203        '',
     204        'text',
     205        'Please enter a phone number'
     206    ),
     207    'propercfp_label_err_no_content' => array(
     208        'Error message if post content is missing',
     209        'propercfp_label_err_no_content',
     210        '',
     211        'text',
     212        'Enter your question or comment'
     213    )
    159214);
    160215
     
    186241    }
    187242
    188     add_submenu_page('options-general.php', "Proper Contact Form Options", "Proper Contact", 'edit_themes', 'pcfp-admin', 'proper_contact_admin');
     243    add_submenu_page('options-general.php', "PROPER Contact settings", "PROPER Contact", 'edit_themes', 'pcfp-admin', 'proper_contact_admin');
    189244
    190245}
     
    200255   
    201256        <div class="wrap" id="proper-contact-options">
    202             <h1>Proper Contact Form Settings</h1>
     257
     258            <h2>PROPER Contact Form Settings</h2>
    203259           
    204260            <?php
     
    206262            if (is_readable($doc_file)) echo file_get_contents($doc_file)
    207263            ?>
    208        
    209             <?php
    210             // Show the "saved" message
    211             if ( !empty($_REQUEST['saved']) ) :
    212             ?>
    213            
    214                 <div id="message" class="updated fade">
    215                     <p><strong>Proper Contact Form <?php echo  __('settings saved.','thematic') ?></strong></p>
     264
     265            <?php if ( !empty( $_REQUEST['saved'] ) ) : ?>
     266                <div id="setting-error-settings_updated" class="updated settings-error">
     267                    <p><strong>PROPER Contact Form <?php echo  __( 'settings saved.', 'properwp' ) ?></strong></p>
    216268                </div>
    217        
    218269            <?php endif ?>
    219            
     270
    220271            <form method="post">
    221272                <table cellpadding="0" cellspacing="0">
     273                    <tr>
     274                        <td>
     275                            <p><input name="save" type="submit" value="Save changes" class="button-primary"></p>
     276                        </td>
     277                    </tr>
    222278
    223279            <?php
     
    264320                    <tr>
    265321                        <td colspan="2" class="header">
    266                             <h3><?php  echo $opt_name ?></h3>
     322                            <h3 style="font-size: 1.6em"><?php  echo $opt_name ?></h3>
    267323                        </td>
    268324                    </tr>
     
    419475                            <input name="save" type="submit" value="Save changes" class="button-primary">
    420476                            <input type="hidden" name="action" value="save" >
    421                            
    422                             <?php if (isset($propercfp_options['last-panel'])) : ?>
    423                             <input type="hidden" id="proper-show-panel" name="panel" value="<?php echo $propercfp_options['last-panel'] ?>" >
    424                             <?php else : ?>
    425                             <input type="hidden" id="proper-show-panel" name="panel" value="header" >
    426                             <?php endif; ?>
    427477                        </p>
    428478                       
Note: See TracChangeset for help on using the changeset viewer.