Plugin Directory

Changeset 385773


Ignore:
Timestamp:
05/17/2011 10:52:26 AM (15 years ago)
Author:
digitaldonkey
Message:

Added Option to set individual from-email

Location:
multilang-contact-form/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • multilang-contact-form/trunk/ml-contactform-options.php

    r286717 r385773  
    55add_option('mlcf_email', 'you@example.com', 'mlcf');
    66add_option('mlcf_subject', '[:en]English email from donkeymedia.eu[:de]Deutsche e-Mail von donkeymedia.eu', 'mlcf');
     7add_option('mlcf_email_from', 'contactform@yourdomain.com', 'mlcf');
    78add_option('mlcf_success_message','[:en]Thank you! <br />email successfully sent[:de]Vielen Dank<br />e-Mail erfolgreich versandt', 'mlcf');
    89add_option('mlcf_error_message', '[:en]<span class="red">Please fill in the required fields</span>[:de]<span class="red">Bitte füllen Sie alle notwendigen Felder aus</span>', 'mlcf');
     
    2425  update_option('mlcf_email', $_POST['mlcf_email']);
    2526  update_option('mlcf_subject', $_POST['mlcf_subject']);
     27  update_option('mlcf_email_from', $_POST['mlcf_email_from']);
    2628  update_option('mlcf_success_message', $_POST['mlcf_success_message']);
    2729  update_option('mlcf_error_message', $_POST['mlcf_error_message']);
     
    4042$mlcf_email = stripslashes(get_option('mlcf_email'));
    4143$mlcf_subject = stripslashes(get_option('mlcf_subject'));
     44$mlcf_email_from = stripslashes(get_option('mlcf_email_from'));
    4245$mlcf_success_message = stripslashes(get_option('mlcf_success_message'));
    4346$mlcf_error_message = stripslashes(get_option('mlcf_error_message'));
     
    6467      </tr>
    6568      <tr valign="top">
     69        <th scope="row"><?php _e('From e-mail Address:', 'mlcf') ?></th>
     70        <td><input name="mlcf_email_from" type="text" id="mlcf_email_from" value="<?php echo $mlcf_email_from; ?>" size="40" />
     71        <br />
     72<?php _e('This address will be shown in the From Field in the mails you recive via the plugin', 'mlcf') ?></td>
     73      </tr>
     74      <tr valign="top">
    6675        <th scope="row"><?php _e('Subject Suffix:', 'mlcf') ?></th>
    6776        <td><input name="mlcf_subject" type="text" id="mlcf_subject" value="<?php echo $mlcf_subject; ?>" size="50" />
     
    176185          margin-left: 8em;
    177186          margin-top: 1em;
     187          }
     188          .mailsend{
     189          color: green;
    178190          }
    179191      </pre>
  • multilang-contact-form/trunk/ml-contactform.php

    r286717 r385773  
    22/*
    33Plugin Name: Multilang Contactform
    4 Plugin URI: http://blog.digitaldonkey.de
     4Plugin URI: http://donkeymedia.eu/2010/08/26/worpress-multilingual-contactform/
    55Description: Translatable Contacform Plugin. Based Ryan Duff and Peter Westwood WP-ContactForm (http://blog.ftwr.co.uk/wordpress/) on WP Contact Form is a drop in form for users to contact you. It can be implemented on a page or a post. It currently works with WordPress 2.0+
    66Author: Thorsten Krug
    77Author URI: http://donkeymedia.eu
    8 Version: 1.1
     8Version: 1.2
    99*/
    1010
     
    125125  return preg_match("/^$regex$/",$email);
    126126}
     127
     128
     129/* Wrapper function to use in a Template .*/
     130function mlcf_form(){
     131  mlcf_callback($content, true);
     132}
     133
     134
    127135/*Wrapper function which calls the form.*/
    128 function mlcf_callback( $content ) {
     136function mlcf_callback( $content , $templateTag=false) {
    129137    global $mlcf_strings;
    130138
    131139    /* Run the input check. */     
    132     if(false === strpos($content, '<!--contact form-->')) {
     140    if(false === strpos($content, '<!--contact form-->') and !$templateTag) {
    133141        return $content;
    134142    }
     
    139147   
    140148            $recipient = get_option('mlcf_email');
     149            $from_mail = get_option('mlcf_email_from');
    141150                        $success_message = get_option('mlcf_success_message');
    142151                        $success_message = stripslashes($success_message);
     
    152161                        $headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
    153162                $header2  = "Reply-To:".$email."\n";
    154                 $header2 .= "From: webmail@donkeymedia.eu\r\n";
     163                $header2 .= "From: ".$from_mail."\r\n";
    155164           
    156165             $message = "e-Mail from ".get_bloginfo("name")." Contact Form: \n\n";
     
    165174           
    166175            mail($recipient,utf8_decode($subject),$message,$header2);
    167             $results = '<div style="font-weight: bold;">' . $success_message . '</div>';
     176            $results = '<div class="mailsend">' . $success_message . '</div>';
    168177            echo $results;
    169178    }
     
    201210            </form>
    202211        </div>';
    203         return str_replace('<!--contact form-->', $form, $content);
     212        if ($templateTag){
     213          echo $form;
     214        }else{
     215          return str_replace('<!--contact form-->', $form, $content);
     216        }
    204217    }
    205218}
  • multilang-contact-form/trunk/readme.txt

    r286717 r385773  
    44Requires at least: 1.5
    55Tested up to: 3.1
    6 Stable tag: 1.1
     6Stable tag: Trunk
    77Donate link: http://donkeymedia.eu/2010/08/26/worpress-multilingual-contactform/
    88
     
    3232== Upgrade Notice ==
    3333
     34= 1.2 =
     35Added Option to set a From-Field for the received mails
     36
    3437= 1.1 =
    3538Added Delete at Plugin deactivation and an Option to Skip this.
Note: See TracChangeset for help on using the changeset viewer.