Version Description
- Fixed untranslated strings. Thanks to Abdullah Manaz!
Download this release
Release Info
Developer | megnicholas |
Plugin | Contact Form Clean and Simple |
Version | 4.6.1 |
Comparing to | |
See all releases |
Code changes from version 4.6.0 to 4.6.1
- class.cscf_contact.php +155 -145
- class.cscf_settings.php +5 -5
- clean-and-simple-contact-form-by-meg-nicholas.php +2 -2
- readme.txt +3 -1
class.cscf_contact.php
CHANGED
@@ -4,169 +4,179 @@
|
|
4 |
* class for holding and validating data captured from the contact form
|
5 |
*/
|
6 |
|
7 |
-
class cscf_Contact
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
// $this->Errors['recaptcha'] = __('Sorry the code wasn\'t entered correctly please try again.', 'clean-and-simple-contact-form-by-meg-nicholas');
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
apply_filters('cscf_spamfilter', $this);
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
-
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
|
121 |
-
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
|
127 |
-
|
128 |
-
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
|
136 |
-
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
|
152 |
-
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
|
163 |
-
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
|
170 |
-
|
171 |
-
|
172 |
}
|
4 |
* class for holding and validating data captured from the contact form
|
5 |
*/
|
6 |
|
7 |
+
class cscf_Contact {
|
8 |
+
var $Name;
|
9 |
+
var $Email;
|
10 |
+
var $ConfirmEmail;
|
11 |
+
var $Message;
|
12 |
+
var $EmailToSender;
|
13 |
+
var $ErrorMessage;
|
14 |
+
var $RecaptchaPublicKey;
|
15 |
+
var $RecaptchaPrivateKey;
|
16 |
+
var $Errors;
|
17 |
+
var $PostID;
|
18 |
+
var $IsSpam;
|
19 |
+
|
20 |
+
function __construct() {
|
21 |
+
$this->Errors = array();
|
22 |
+
|
23 |
+
if ( cscf_PluginSettings::UseRecaptcha() ) {
|
24 |
+
$this->RecaptchaPublicKey = cscf_PluginSettings::PublicKey();
|
25 |
+
$this->RecaptchaPrivateKey = cscf_PluginSettings::PrivateKey();
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset( $_POST['cscf'] ) ) {
|
29 |
+
$cscf = $_POST['cscf'];
|
30 |
+
$this->Name = filter_var( $cscf['name'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES );
|
31 |
+
$this->Email = filter_var( $cscf['email'], FILTER_SANITIZE_EMAIL );
|
32 |
+
|
33 |
+
if ( isset( $cscf['confirm-email'] ) ) {
|
34 |
+
$this->ConfirmEmail = filter_var( $cscf['confirm-email'], FILTER_SANITIZE_EMAIL );
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->EmailToSender = isset( $cscf['email-sender'] );
|
38 |
+
|
39 |
+
$this->Message = filter_var( $cscf['message'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES );
|
40 |
+
if ( isset( $_POST['post-id'] ) ) {
|
41 |
+
$this->PostID = $_POST['post-id'];
|
42 |
+
}
|
43 |
+
unset( $_POST['cscf'] );
|
44 |
+
}
|
45 |
+
|
46 |
+
$this->IsSpam = false;
|
47 |
+
}
|
48 |
+
|
49 |
+
public
|
50 |
+
function IsValid() {
|
51 |
+
$this->Errors = array();
|
52 |
+
|
53 |
+
if ( $_SERVER['REQUEST_METHOD'] != 'POST' ) {
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
//check nonce
|
58 |
+
|
59 |
+
if ( ! wp_verify_nonce( $_POST['cscf_nonce'], 'cscf_contact' ) ) {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
// email and confirm email are the same
|
64 |
+
if ( cscf_PluginSettings::ConfirmEmail() ) {
|
65 |
+
if ( $this->Email != $this->ConfirmEmail ) {
|
66 |
+
$this->Errors['confirm-email'] = __( 'Sorry the email addresses do not match.', 'clean-and-simple-contact-form-by-meg-nicholas' );
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
//email
|
71 |
+
|
72 |
+
if ( strlen( $this->Email ) == 0 ) {
|
73 |
+
$this->Errors['email'] = __( 'Please give your email address.', 'clean-and-simple-contact-form-by-meg-nicholas' );
|
74 |
+
}
|
75 |
+
|
76 |
+
//confirm email
|
77 |
+
if ( cscf_PluginSettings::ConfirmEmail() ) {
|
78 |
+
if ( strlen( $this->ConfirmEmail ) == 0 ) {
|
79 |
+
$this->Errors['confirm-email'] = __( 'Please confirm your email address.', 'clean-and-simple-contact-form-by-meg-nicholas' );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
//name
|
84 |
+
|
85 |
+
if ( strlen( $this->Name ) == 0 ) {
|
86 |
+
$this->Errors['name'] = __( 'Please give your name.', 'clean-and-simple-contact-form-by-meg-nicholas' );
|
87 |
+
}
|
88 |
+
|
89 |
+
//message
|
90 |
+
|
91 |
+
if ( strlen( $this->Message ) == 0 ) {
|
92 |
+
$this->Errors['message'] = __( 'Please enter a message.', 'clean-and-simple-contact-form-by-meg-nicholas' );
|
93 |
+
}
|
94 |
+
|
95 |
+
//email invalid address
|
96 |
+
|
97 |
+
if ( strlen( $this->Email ) > 0 && ! filter_var( $this->Email, FILTER_VALIDATE_EMAIL ) ) {
|
98 |
+
$this->Errors['email'] = __( 'Please enter a valid email address.', 'clean-and-simple-contact-form-by-meg-nicholas' );
|
99 |
+
}
|
100 |
+
|
101 |
+
//check recaptcha but only if we have keys
|
102 |
+
|
103 |
+
if ( $this->RecaptchaPublicKey <> '' && $this->RecaptchaPrivateKey <> '' ) {
|
104 |
+
$resp = csf_RecaptchaV2::VerifyResponse( $_SERVER["REMOTE_ADDR"], $this->RecaptchaPrivateKey, $_POST["g-recaptcha-response"] );
|
105 |
+
|
106 |
+
if ( ! $resp->success ) {
|
107 |
// $this->Errors['recaptcha'] = __('Sorry the code wasn\'t entered correctly please try again.', 'clean-and-simple-contact-form-by-meg-nicholas');
|
108 |
+
$this->Errors['recaptcha'] = __( 'Please solve the recaptcha to continue.', 'clean-and-simple-contact-form-by-meg-nicholas' );
|
109 |
+
}
|
110 |
+
}
|
111 |
|
112 |
+
return count( $this->Errors ) == 0;
|
113 |
+
}
|
114 |
|
115 |
+
public
|
116 |
+
function SendMail() {
|
117 |
+
apply_filters( 'cscf_spamfilter', $this );
|
|
|
118 |
|
119 |
+
if ( $this->IsSpam === true ) {
|
120 |
+
return true;
|
121 |
+
}
|
122 |
|
123 |
+
$filters = new cscf_Filters;
|
124 |
|
125 |
+
if ( cscf_PluginSettings::OverrideFrom() & cscf_PluginSettings::FromEmail() != "" ) {
|
126 |
+
$filters->fromEmail = cscf_PluginSettings::FromEmail();
|
127 |
+
} else {
|
128 |
+
$filters->fromEmail = $this->Email;
|
129 |
+
}
|
130 |
|
131 |
+
$filters->fromName = $this->Name;
|
132 |
|
133 |
+
//add filters
|
134 |
+
$filters->add( 'wp_mail_from' );
|
135 |
+
$filters->add( 'wp_mail_from_name' );
|
136 |
|
137 |
+
//headers
|
138 |
+
$header = "Reply-To: " . $this->Email . "\r\n";
|
139 |
|
140 |
+
//message
|
141 |
+
$message = __( 'From: ', 'clean-and-simple-contact-form-by-meg-nicholas' ) . $this->Name . "\n\n";
|
142 |
+
$message .= __( 'Email: ', 'clean-and-simple-contact-form-by-meg-nicholas' ) . $this->Email . "\n\n";
|
143 |
+
$message .= __( 'Page URL: ', 'clean-and-simple-contact-form-by-meg-nicholas' ) . get_permalink( $this->PostID ) . "\n\n";
|
144 |
+
$message .= __( 'Message:', 'clean-and-simple-contact-form-by-meg-nicholas' ) . "\n\n" . $this->Message;
|
145 |
|
146 |
+
$result = ( wp_mail( cscf_PluginSettings::RecipientEmails(), cscf_PluginSettings::Subject(), stripslashes( $message ), $header ) );
|
147 |
|
148 |
+
//remove filters (play nice)
|
149 |
+
$filters->remove( 'wp_mail_from' );
|
150 |
+
$filters->remove( 'wp_mail_from_name' );
|
151 |
|
152 |
+
//send an email to the form-filler
|
153 |
+
if ( $this->EmailToSender ) {
|
154 |
+
$recipients = cscf_PluginSettings::RecipientEmails();
|
155 |
|
156 |
+
if ( cscf_PluginSettings::OverrideFrom() & cscf_PluginSettings::FromEmail() != "" ) {
|
157 |
+
$filters->fromEmail = cscf_PluginSettings::FromEmail();
|
158 |
+
} else {
|
159 |
+
$filters->fromEmail = $recipients[0];
|
160 |
+
}
|
161 |
|
162 |
+
$filters->fromName = get_bloginfo( 'name' );
|
163 |
|
164 |
+
//add filters
|
165 |
+
$filters->add( 'wp_mail_from' );
|
166 |
+
$filters->add( 'wp_mail_from_name' );
|
167 |
|
168 |
+
$header = "";
|
169 |
+
$message = cscf_PluginSettings::SentMessageBody() . "\n\n";
|
170 |
+
$message .= __( "Here is a copy of your message :", "clean-and-simple-contact-form-by-meg-nicholas" ) . "\n\n";
|
171 |
+
$message .= $this->Message;
|
172 |
|
173 |
+
$result = ( wp_mail( $this->Email, cscf_PluginSettings::Subject(), stripslashes( $message ), $header ) );
|
174 |
|
175 |
+
//remove filters (play nice)
|
176 |
+
$filters->remove( 'wp_mail_from' );
|
177 |
+
$filters->remove( 'wp_mail_from_name' );
|
178 |
+
}
|
179 |
|
180 |
+
return $result;
|
181 |
+
}
|
182 |
}
|
class.cscf_settings.php
CHANGED
@@ -44,12 +44,12 @@ class cscf_settings
|
|
44 |
<div style="float:right;position: relative;width:250px;">
|
45 |
|
46 |
<div style="border:1px solid;padding:5px;margin-bottom: 8px;text-align:center;">
|
47 |
-
<h3><?php _e("Donate $10, $20 or $50!", "
|
48 |
|
49 |
<div>
|
50 |
-
<p><?php _e("If you like this plugin, please donate to support development and maintenance of:", "
|
51 |
|
52 |
-
<h3><?php _e("Clean and Simple Contact Form!", "
|
53 |
|
54 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
55 |
<input type="hidden" name="cmd" value="_s-xclick">
|
@@ -82,8 +82,8 @@ class cscf_settings
|
|
82 |
</p>
|
83 |
<?php } ?>
|
84 |
|
85 |
-
<p class="howto"><?php _e("Please Note: To add the contact form to your page please add the text", "
|
86 |
-
<code>[cscf-contact-form]</code> <?php _e("to your post or page.", "
|
87 |
|
88 |
<form method="post" action="options.php">
|
89 |
<?php
|
44 |
<div style="float:right;position: relative;width:250px;">
|
45 |
|
46 |
<div style="border:1px solid;padding:5px;margin-bottom: 8px;text-align:center;">
|
47 |
+
<h3><?php _e("Donate $10, $20 or $50!", "clean-and-simple-contact-form-by-meg-nicholas"); ?></h3>
|
48 |
|
49 |
<div>
|
50 |
+
<p><?php _e("If you like this plugin, please donate to support development and maintenance of:", "clean-and-simple-contact-form-by-meg-nicholas"); ?></p>
|
51 |
|
52 |
+
<h3><?php _e("Clean and Simple Contact Form!", "clean-and-simple-contact-form-by-meg-nicholas"); ?></h3>
|
53 |
|
54 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
55 |
<input type="hidden" name="cmd" value="_s-xclick">
|
82 |
</p>
|
83 |
<?php } ?>
|
84 |
|
85 |
+
<p class="howto"><?php _e("Please Note: To add the contact form to your page please add the text", "clean-and-simple-contact-form-by-meg-nicholas"); ?>
|
86 |
+
<code>[cscf-contact-form]</code> <?php _e("to your post or page.", "clean-and-simple-contact-form-by-meg-nicholas"); ?></p>
|
87 |
|
88 |
<form method="post" action="options.php">
|
89 |
<?php
|
clean-and-simple-contact-form-by-meg-nicholas.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
Plugin Name: Clean and Simple Contact Form
|
8 |
Plugin URI: http://www.megnicholas.co.uk/wordpress-plugins/clean-and-simple-contact-form
|
9 |
Description: A clean and simple contact form with Google reCAPTCHA and Twitter Bootstrap markup.
|
10 |
-
Version: 4.6.
|
11 |
Author: Meghan Nicholas
|
12 |
Author URI: http://www.megnicholas.co.uk
|
13 |
License: GPLv2 or later
|
@@ -54,7 +54,7 @@ if (!defined('CSCF_PLUGIN_URL')) define('CSCF_PLUGIN_URL', WP_PLUGIN_URL . '/' .
|
|
54 |
|
55 |
if (!defined('CSCF_VERSION_KEY')) define('CSCF_VERSION_KEY', 'cscf_version');
|
56 |
|
57 |
-
if (!defined('CSCF_VERSION_NUM')) define('CSCF_VERSION_NUM', '4.6.
|
58 |
|
59 |
if (!defined('CSCF_OPTIONS_KEY')) define('CSCF_OPTIONS_KEY', 'cscf_options');
|
60 |
|
7 |
Plugin Name: Clean and Simple Contact Form
|
8 |
Plugin URI: http://www.megnicholas.co.uk/wordpress-plugins/clean-and-simple-contact-form
|
9 |
Description: A clean and simple contact form with Google reCAPTCHA and Twitter Bootstrap markup.
|
10 |
+
Version: 4.6.1
|
11 |
Author: Meghan Nicholas
|
12 |
Author URI: http://www.megnicholas.co.uk
|
13 |
License: GPLv2 or later
|
54 |
|
55 |
if (!defined('CSCF_VERSION_KEY')) define('CSCF_VERSION_KEY', 'cscf_version');
|
56 |
|
57 |
+
if (!defined('CSCF_VERSION_NUM')) define('CSCF_VERSION_NUM', '4.6.1');
|
58 |
|
59 |
if (!defined('CSCF_OPTIONS_KEY')) define('CSCF_OPTIONS_KEY', 'cscf_options');
|
60 |
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
6 |
Tags: simple, contact, form, contact button, contact form, contact form plugin, akismet, contacts, contacts form plugin, contact me, feedback form, bootstrap, twitter, google, reCAPTCHA, ajax, secure
|
7 |
Requires at least: 3.3
|
8 |
Tested up to: 4.4.1
|
9 |
-
Stable tag: 4.6.
|
10 |
|
11 |
A clean and simple AJAX contact form with Google reCAPTCHA, Twitter Bootstrap markup and Akismet spam filtering.
|
12 |
|
@@ -203,6 +203,8 @@ the reCAPTCHA for the contact form will be displayed correctly but not in the co
|
|
203 |
The comments form will never validate due to no supplied reCAPTCHA code.
|
204 |
|
205 |
== Changelog ==
|
|
|
|
|
206 |
= 4.6.0 =
|
207 |
* Prevent multiple 'send message' clicks.
|
208 |
* Changed text domain to plugin slug to allow for WP translation system import
|
6 |
Tags: simple, contact, form, contact button, contact form, contact form plugin, akismet, contacts, contacts form plugin, contact me, feedback form, bootstrap, twitter, google, reCAPTCHA, ajax, secure
|
7 |
Requires at least: 3.3
|
8 |
Tested up to: 4.4.1
|
9 |
+
Stable tag: 4.6.1
|
10 |
|
11 |
A clean and simple AJAX contact form with Google reCAPTCHA, Twitter Bootstrap markup and Akismet spam filtering.
|
12 |
|
203 |
The comments form will never validate due to no supplied reCAPTCHA code.
|
204 |
|
205 |
== Changelog ==
|
206 |
+
= 4.6.1 =
|
207 |
+
* Fixed untranslated strings. Thanks to Abdullah Manaz!
|
208 |
= 4.6.0 =
|
209 |
* Prevent multiple 'send message' clicks.
|
210 |
* Changed text domain to plugin slug to allow for WP translation system import
|