Plugin Directory

Changeset 988456


Ignore:
Timestamp:
09/12/2014 05:42:36 PM (11 years ago)
Author:
joshcanhelp
Message:

Version 0.9.8.5, adding a settings field for form recipients

Location:
proper-contact-form
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • proper-contact-form/trunk/inc/settings.php

    r967417 r988456  
    7272        ),
    7373        'propercfp_email'                => array(
    74             'Default contact submission email',
    75             'Email to use for the sender and receiver of the contact form',
    76             'text',
     74            'Contact notification sender email',
     75            'Email to use for the sender of the contact form emails both to the recipients below and the contact form submitter (if this is activated below). The domain for this email address should match your site\'s domain.',
     76            'email',
    7777            get_bloginfo( 'admin_email' )
    7878        ),
    7979        'propercfp_reply_to_admin'       => array(
    8080            'Use the email address above as notification sender',
    81             'When this is off, the for submitter\'s email is used to send the notification to the email above, making it
    82             easy to reply directly. This might cause your emails to be caught by your spam filter, though. If you are
    83             having trouble receiving emails from form submissions, try turning this on.',
     81            'When this is on, the notification emails sent from your site will come from the email address above. When this is off, the emails will come from the form submitter, making it easy to reply. If you are not receiving notifications from the site, then turn this option off as your email server might be marking them as spam.',
    8482            'checkbox',
    8583            '',
     84        ),
     85        'propercfp_email_recipients' => array(
     86            'Contact submission recipients',
     87            'Email address(es) to receive contact submission notifications. You can separate multiple emails with a comma.',
     88            'text',
     89            proper_contact_get_key( 'propercfp_email' ) ?
     90                proper_contact_get_key( 'propercfp_email' ) :
     91                get_bloginfo( 'admin_email' )
    8692        ),
    8793        'propercfp_result_url'           => array(
     
    232238    if (
    233239        // On the right page
    234             array_key_exists( 'page', $_GET ) &&
    235             $_GET['page'] === 'pcfp-admin' &&
    236             // We're saving options
    237             array_key_exists( 'action', $_REQUEST ) &&
    238             $_REQUEST['action'] == 'save' &&
    239             // This action is authorized
    240             current_user_can( 'manage_options' ) &&
    241             wp_verify_nonce( $_POST['proper_nonce'], $current_user->user_email )
     240        array_key_exists( 'page', $_GET ) &&
     241        $_GET['page'] === 'pcfp-admin' &&
     242        // We're saving options
     243        array_key_exists( 'action', $_REQUEST ) &&
     244        $_REQUEST['action'] == 'save' &&
     245        // This action is authorized
     246        current_user_can( 'manage_options' ) &&
     247        wp_verify_nonce( $_POST['proper_nonce'], $current_user->user_email )
    242248    ) {
    243249
     
    289295    <div class="postbox" style="margin-top: 20px; padding: 0 20px">
    290296
    291             <p>Simply configure the form below, save your changes, then add
    292                 <code>[proper_contact_form]</code> to any page or post. You can also add a
    293                 <a href="<?php echo admin_url( 'widgets.php' ); ?>">widget</a>.<br>
    294                 If you're adding this to a theme file, add
    295                 <code>&lt;?php echo do_shortcode( '[proper_contact_form]' ) ?&gt;</code>
    296             </p>
     297        <p>Simply configure the form below, save your changes, then add
     298            <code>[proper_contact_form]</code> to any page or post. You can also add a
     299            <a href="<?php echo admin_url( 'widgets.php' ); ?>">widget</a>.<br>
     300            If you're adding this to a theme file, add
     301            <code>&lt;?php echo do_shortcode( '[proper_contact_form]' ) ?&gt;</code>
     302        </p>
    297303
    298304    </div>
     
    306312    <?php endif ?>
    307313
    308     <form method="post">
     314    <div class="proper_contact_promo_sidebar">
     315        <p>I hope you are using and loving the PROPER Contact Form! This plugin was brought to you by:</p>
     316        <p>
     317            <a href="http://theproperweb.com/?ref=pcf-settings" target="_blank">
     318                <img src="<?php echo PROPER_CONTACT_URL . 'images/proper-logo.png' ?>" class="aligncenter">
     319            </a>
     320        </p>
     321        <p>If you use and enjoy the plugin, you can show support by
     322            <a href="http://theproperweb.com/product/proper-contact-form/" target="_blank">donating</a> or
     323            <a href="https://wordpress.org/support/view/plugin-reviews/proper-contact-form?filter=5#postform" target="_blank">giving it a positive review</a> on WordPress.org. If you're having any trouble,
     324            <a href="https://wordpress.org/support/plugin/proper-contact-form" target="_blank">post a support request here</a>.
     325        </p>
     326        <hr>
     327        <p>Like what you see and want more?</p>
     328
     329        <p><strong>Premium Themes and Plugins:</strong></p>
     330        <ul>
     331            <li><a href="http://wpdrudge.com/?ref=pcf-settings" target="_blank">WP-Drudge curation theme</a></li>
     332            <li><a href="http://www.wpwritersblock.com/?ref=pcf-settings" target="_blank">WP Writer's Block writer's theme</a></li>
     333            <li><a href="http://theproperweb.com/product/google-news-wordpress/?ref=pcf-settings" target="_blank">Google News for WordPress</a></li>
     334        </ul>
     335        <p><strong>Free Plugins:</strong></p>
     336        <ul>
     337            <li><a href="https://wordpress.org/plugins/proper-widgets/" target="_blank">PROPER Widgets</a></li>
     338            <li><a href="https://wordpress.org/plugins/proper-shortcodes/" target="_blank">PROPER Shortcodes</a></li>
     339        </ul>
     340        <hr>
     341        <p>
     342            By the way, I'm Josh, the developer of this plugin. Nice to meet you!</p>
     343        <p>
     344            <a href="https://twitter.com/joshcanhelp" class="twitter-follow-button" data-show-count="false" data-dnt="true">Follow @joshcanhelp</a>
     345            <script>!function (d, s, id) {
     346                    var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
     347                    if (!d.getElementById(id)) {
     348                        js = d.createElement(s);
     349                        js.id = id;
     350                        js.src = p + '://platform.twitter.com/widgets.js';
     351                        fjs.parentNode.insertBefore(js, fjs);
     352                    }
     353                }(document, 'script', 'twitter-wjs');</script></p>
     354
     355    </div>
     356
     357    <form method="post" class="proper_contact_settings_form">
    309358    <table class="form-table">
    310359    <tr>
     
    363412            </tr>
    364413
    365             <?php
    366 
    367             // Displays correct inputs for "text" type
     414        <?php
     415
     416        // Displays correct inputs for "text" type
    368417        elseif ( $opt_type == 'text' || $opt_type == 'number' || $opt_type == 'email' || $opt_type == 'url' ) :
    369418            ?>
     
    374423                </th>
    375424                <td>
    376                     <input name="<?php echo $opt_id ?>" id="<?php echo $opt_id ?>" type="<?php echo $opt_type ?>" value="<?php echo stripslashes( $opt_val ) ?>" class="regular-text">
     425                    <input name="<?php echo $opt_id ?>" id="<?php echo $opt_id ?>" type="<?php echo $opt_type ?>" value="<?php echo stripslashes( $opt_val ) ?>" class="widefat">
    377426
    378427                    <p class="description"><?php _e( $opt_desc, 'proper-contact' ) ?></p>
     
    554603add_filter( 'plugin_action_links_proper-contact-form/proper-contact-form.php',
    555604    'proper_contact_form_plugin_links', 10, 2 );
     605
     606/**
     607 * Enqueue CSS and JS needed in the admin
     608 */
     609function proper_contact_admin_css_js() {
     610    global $pagenow;
     611
     612    if (
     613        ( $pagenow == 'options-general.php' || $pagenow == 'admin.php' )
     614        && isset( $_GET['page'] ) && $_GET['page'] == 'pcfp-admin'
     615    ) {
     616        wp_enqueue_style( 'proper-contact', PROPER_CONTACT_URL . 'css/wp-admin.css' );
     617    }
     618}
     619
     620add_action( 'admin_enqueue_scripts', 'proper_contact_admin_css_js' );
  • proper-contact-form/trunk/proper-contact-form.php

    r967417 r988456  
    55Plugin URI: http://theproperweb.com/shipped/wp/proper-contact-form
    66Description: A better contact form processor
    7 Version: 0.9.8.4
     7Version: 0.9.8.5
    88Author: PROPER Web Development
    99Author URI: http://theproperweb.com
     
    1818
    1919// Important constants
    20 define( 'PROPER_CONTACT_VERSION', '0.9.8.4' );
     20define( 'PROPER_CONTACT_VERSION', '0.9.8.5' );
    2121define( 'PROPER_CONTACT_URL', plugin_dir_url( __FILE__ ) );
    2222
     
    408408        $site_name  = htmlspecialchars_decode( get_bloginfo( 'name' ) );
    409409
    410         // No name? Use the email address, if one is present
     410        // Notification recipients
     411        $site_recipients = sanitize_text_field( proper_contact_get_key( 'propercfp_email_recipients' ) );
     412        $site_recipients = explode(',', $site_recipients);
     413        $site_recipients = array_map( 'trim', $site_recipients );
     414        $site_recipients = array_map( 'sanitize_email', $site_recipients );
     415        $site_recipients = implode( ',', $site_recipients );
     416
     417        // No name? Use the submitter email address, if one is present
    411418        if ( empty( $contact_name ) ) {
    412419            $contact_name = ! empty( $contact_email ) ? $contact_email : '[None given]';
     
    414421
    415422        // Need an email address for the email notification
    416         $send_from = ! empty( $contact_email ) ? $contact_email : $site_email;
    417423        if ( proper_contact_get_key( 'propercfp_reply_to_admin' ) == 'yes' ) {
    418424            $send_from = $site_email;
     425            $send_from_name = $site_name;
     426        } else {
     427            $send_from = ! empty( $contact_email ) ? $contact_email : $site_email;
     428            $send_from_name = $contact_name;
    419429        }
    420430
    421431        // Sent an email notification to the correct address
    422         $headers   = array();
    423 
    424         $headers[] = "From: $contact_name <$send_from>";
    425         $headers[] = "Reply-To: $contact_name <$send_from>";
    426 
    427         wp_mail( $site_email, 'Contact on ' . $site_name, $body, $headers );
    428        
    429        
     432        $headers   = "From: $send_from_name <$send_from>\r\nReply-To: $send_from_name <$send_from>";
     433
     434        wp_mail( $site_recipients, 'Contact on ' . $site_name, $body, $headers );
     435
    430436        // Should a confirm email be sent?
    431437        $confirm_body = stripslashes( trim( proper_contact_get_key( 'propercfp_confirm_email' ) ) );
     
    437443            $confirm_body = str_replace( '&#39;', "'", $confirm_body );
    438444
    439             // Send the email
    440             $headers   = array();
    441             $headers[] = "From: $site_name <$site_email>";
    442             $headers[] = "Reply-To: $site_email";
    443             wp_mail( $contact_email, proper_contact_get_key( 'propercfp_label_submit' ) . ' - ' . $site_name,
    444                 $confirm_body, $headers );
     445            $headers = "From: $site_name <$site_email>\r\nReply-To: $site_name <$site_email>";
     446
     447            wp_mail(
     448                $contact_email,
     449                proper_contact_get_key( 'propercfp_label_submit' ) . ' - ' . $site_name,
     450                $confirm_body,
     451                $headers
     452            );
    445453        }
    446454
  • proper-contact-form/trunk/readme.txt

    r967417 r988456  
    55Requires at least: 3.0
    66Tested up to: 4.0
    7 Stable tag: 0.9.8.4
     7Stable tag: 0.9.8.5
    88
    99Creates a flexible, secure contact form on your WP site
     
    4949== Changelog ==
    5050
     51= 0.9.8.5 =
     52* Added a settings field for submission notification emails
     53
    5154= 0.9.8.4 =
    5255* Changed capability required for the settings page to `manage_options` from `edit_themes`
     
    5558* Upgraded PhpFormBuilder class to latest version; added check to make sure the class doesn't exist
    5659* Added an option to send notification emails from a different address
    57 * Removed id array element, using aray key instead
     60* Removed id array element, using array key instead
    5861
    5962= 0.9.8.2 =
Note: See TracChangeset for help on using the changeset viewer.