Contact Form Email - Version 1.2.80

Version Description

  • Better auto-config and easier publishing process
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Contact Form Email
Version 1.2.80
Comparing to
See all releases

Code changes from version 1.2.79 to 1.2.80

README.txt CHANGED
@@ -456,6 +456,9 @@ When you click a field already added into the contact form builder area, you can
456
 
457
  == Changelog ==
458
 
 
 
 
459
  = 1.2.79 =
460
  * Fixed Gutemberg editor conflict
461
 
@@ -997,5 +1000,5 @@ When you click a field already added into the contact form builder area, you can
997
 
998
  == Upgrade Notice ==
999
 
1000
- = 1.2.79 =
1001
- * Fixed Gutemberg editor conflict
456
 
457
  == Changelog ==
458
 
459
+ = 1.2.80 =
460
+ * Better auto-config and easier publishing process
461
+
462
  = 1.2.79 =
463
  * Fixed Gutemberg editor conflict
464
 
1000
 
1001
  == Upgrade Notice ==
1002
 
1003
+ = 1.2.80 =
1004
+ * Better auto-config and easier publishing process
cp-admin-int.inc.php CHANGED
@@ -137,7 +137,7 @@ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST[$this->prefix.'_post_
137
  <tr valign="top">
138
  <th scope="row">On submit action</th>
139
  <td>
140
- <?php $option = $this->get_option('onsubmitaction', '0'); ?>
141
  <select name="onsubmitaction" onchange="javascript:fte_action_display();">
142
  <option value="0"<?php if ($option == '0' || $option == '') echo ' selected'; ?>>Redirect to a "Thank you" page</option>
143
  <option value="1"<?php if ($option == '1') echo ' selected'; ?>>Stay on the page, display a classic JavaScript alert box with a message</option>
@@ -152,7 +152,7 @@ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST[$this->prefix.'_post_
152
  </tr>
153
  <tr valign="top" id="opmsg">
154
  <th scope="row">Message to display after submission</th>
155
- <td><textarea name="fp_return_message" cols="80" rows="3"><?php echo esc_attr($this->get_option('fp_return_message', 'Thank you.')); ?></textarea></td>
156
  </tr>
157
 
158
  <tr><td colspan="2"><hr /></td></tr>
@@ -380,15 +380,15 @@ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST[$this->prefix.'_post_
380
  <th scope="row">Submit button label (text):</th>
381
  <td><input type="text" name="vs_text_submitbtn" size="40" value="<?php $label = esc_attr($this->get_option('vs_text_submitbtn', 'Submit')); echo ($label==''?'Submit':$label); ?>" /></td>
382
  </tr>
383
- <tr valign="top">
384
  <th scope="row">Previous button label (text):</th>
385
  <td><input type="text" name="vs_text_previousbtn" size="40" value="<?php $label = esc_attr($this->get_option('vs_text_previousbtn', 'Previous')); echo ($label==''?'Previous':$label); ?>" /></td>
386
  </tr>
387
- <tr valign="top">
388
  <th scope="row">Next button label (text):</th>
389
  <td><input type="text" name="vs_text_nextbtn" size="40" value="<?php $label = esc_attr($this->get_option('vs_text_nextbtn', 'Next')); echo ($label==''?'Next':$label); ?>" /></td>
390
  </tr>
391
- <tr valign="top">
392
  <th scope="row">Page {0} of {0} (text):</th>
393
  <td><input type="text" name="vs_text_page" size="6" value="<?php $label = esc_attr($this->get_option('vs_text_page', 'Page')); echo ($label==''?'Page':$label); ?>" />
394
  X
137
  <tr valign="top">
138
  <th scope="row">On submit action</th>
139
  <td>
140
+ <?php $option = $this->get_option('onsubmitaction', '3'); ?>
141
  <select name="onsubmitaction" onchange="javascript:fte_action_display();">
142
  <option value="0"<?php if ($option == '0' || $option == '') echo ' selected'; ?>>Redirect to a "Thank you" page</option>
143
  <option value="1"<?php if ($option == '1') echo ' selected'; ?>>Stay on the page, display a classic JavaScript alert box with a message</option>
152
  </tr>
153
  <tr valign="top" id="opmsg">
154
  <th scope="row">Message to display after submission</th>
155
+ <td><textarea name="fp_return_message" cols="80" rows="3"><?php echo esc_attr($this->get_option('fp_return_message', 'Your message has been successfully sent. Thank you!')); ?></textarea></td>
156
  </tr>
157
 
158
  <tr><td colspan="2"><hr /></td></tr>
380
  <th scope="row">Submit button label (text):</th>
381
  <td><input type="text" name="vs_text_submitbtn" size="40" value="<?php $label = esc_attr($this->get_option('vs_text_submitbtn', 'Submit')); echo ($label==''?'Submit':$label); ?>" /></td>
382
  </tr>
383
+ <tr valign="top" class="cftesoft">
384
  <th scope="row">Previous button label (text):</th>
385
  <td><input type="text" name="vs_text_previousbtn" size="40" value="<?php $label = esc_attr($this->get_option('vs_text_previousbtn', 'Previous')); echo ($label==''?'Previous':$label); ?>" /></td>
386
  </tr>
387
+ <tr valign="top" class="cftesoft">
388
  <th scope="row">Next button label (text):</th>
389
  <td><input type="text" name="vs_text_nextbtn" size="40" value="<?php $label = esc_attr($this->get_option('vs_text_nextbtn', 'Next')); echo ($label==''?'Next':$label); ?>" /></td>
390
  </tr>
391
+ <tr valign="top" class="cftesoft">
392
  <th scope="row">Page {0} of {0} (text):</th>
393
  <td><input type="text" name="vs_text_page" size="6" value="<?php $label = esc_attr($this->get_option('vs_text_page', 'Page')); echo ($label==''?'Page':$label); ?>" />
394
  X
cp-main-class.inc.php CHANGED
@@ -109,7 +109,17 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
109
  $count = $wpdb->get_var( "SELECT COUNT(id) FROM ".$wpdb->prefix.$this->table_items );
110
  if (!$count)
111
  {
112
- define('CP_CFEMAIL_DEFAULT_fp_from_email', get_the_author_meta('user_email', get_current_user_id()) );
 
 
 
 
 
 
 
 
 
 
113
  define('CP_CFEMAIL_DEFAULT_fp_destination_emails', CP_CFEMAIL_DEFAULT_fp_from_email);
114
  $wpdb->insert( $wpdb->prefix.$this->table_items, array( 'id' => 1,
115
  'form_name' => 'Form 1',
@@ -130,8 +140,8 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
130
  'cu_message' => $this->get_option('cu_message', CP_CFEMAIL_DEFAULT_cu_message),
131
  'cu_emailformat' => $this->get_option('cu_emailformat', CP_CFEMAIL_DEFAULT_email_format),
132
 
133
- 'fp_return_message' => 'Thank you.',
134
- 'onsubmitaction' => '0',
135
  'fp_enableemail' => 'true',
136
 
137
  'vs_use_validation' => $this->get_option('vs_use_validation', CP_CFEMAIL_DEFAULT_vs_use_validation),
@@ -271,8 +281,8 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
271
  document.getElementById("refpage<?php echo '_'.$this->print_counter; ?>").value = document.location;
272
  cfte_blink(".pbSubmit");
273
  document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '2';<?php
274
- $option = $this->get_option('onsubmitaction', '0');
275
- $message = str_replace("\n","\\n",str_replace("\r","",str_replace("'","\'", __($this->get_option('fp_return_message', 'Thank you.')) )));
276
  if ($option == '1' || $option == '2' || $option == '3')
277
  {
278
  ?>document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '1';
@@ -526,7 +536,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
526
  if ($action == "wizard")
527
  {
528
  $shortcode = '['.$this->shorttag.' id="'.$this->item .'"]';
529
- $this->postURL = $this->publish_on($_POST["whereto"], $_POST["publishpage"], $_POST["publishpost"], $shortcode, $_POST["posttitle"]);
530
  return;
531
  }
532
 
@@ -546,8 +556,8 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
546
  $my_post = array(
547
  'post_title' => $posttitle,
548
  'post_type' => ($whereto == '0'?'page':'post'),
549
- 'post_content' => 'This is a <b>preview</b> page, remember to publish it if needed. You can edit the full form settings into the admin settings page.<br /><br /> '.$content,
550
- 'post_status' => 'draft'
551
  );
552
 
553
  // Insert the post into the database
109
  $count = $wpdb->get_var( "SELECT COUNT(id) FROM ".$wpdb->prefix.$this->table_items );
110
  if (!$count)
111
  {
112
+ $default_from = strtolower(get_the_author_meta('user_email', get_current_user_id()));
113
+ $domain = str_replace('www.','', strtolower($_SERVER["HTTP_HOST"]));
114
+ while (substr_count($domain,".") > 1)
115
+ $domain = substr($domain, strpos(".", $domain));
116
+ $pos = strpos($default_from, $domain);
117
+ if (substr_count($domain,".") == 1 && $pos === false)
118
+ define('CP_CFEMAIL_DEFAULT_fp_from_email', 'admin@'.$domain );
119
+ else
120
+ define('CP_CFEMAIL_DEFAULT_fp_from_email', $default_from );
121
+
122
+
123
  define('CP_CFEMAIL_DEFAULT_fp_destination_emails', CP_CFEMAIL_DEFAULT_fp_from_email);
124
  $wpdb->insert( $wpdb->prefix.$this->table_items, array( 'id' => 1,
125
  'form_name' => 'Form 1',
140
  'cu_message' => $this->get_option('cu_message', CP_CFEMAIL_DEFAULT_cu_message),
141
  'cu_emailformat' => $this->get_option('cu_emailformat', CP_CFEMAIL_DEFAULT_email_format),
142
 
143
+ 'fp_return_message' => 'Your message has been sent. Thank you!',
144
+ 'onsubmitaction' => '3',
145
  'fp_enableemail' => 'true',
146
 
147
  'vs_use_validation' => $this->get_option('vs_use_validation', CP_CFEMAIL_DEFAULT_vs_use_validation),
281
  document.getElementById("refpage<?php echo '_'.$this->print_counter; ?>").value = document.location;
282
  cfte_blink(".pbSubmit");
283
  document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '2';<?php
284
+ $option = $this->get_option('onsubmitaction', '3');
285
+ $message = str_replace("\n","\\n",str_replace("\r","",str_replace("'","\'", __($this->get_option('fp_return_message', 'Your message has been successfully sent.')) )));
286
  if ($option == '1' || $option == '2' || $option == '3')
287
  {
288
  ?>document.<?php echo $this->prefix; ?>_pform<?php echo '_'.$this->print_counter; ?>.<?php echo $this->prefix; ?>_pform_status.value = '1';
536
  if ($action == "wizard")
537
  {
538
  $shortcode = '['.$this->shorttag.' id="'.$this->item .'"]';
539
+ $this->postURL = $this->publish_on($_POST["whereto"], @$_POST["publishpage"], @$_POST["publishpost"], $shortcode, $_POST["posttitle"]);
540
  return;
541
  }
542
 
556
  $my_post = array(
557
  'post_title' => $posttitle,
558
  'post_type' => ($whereto == '0'?'page':'post'),
559
+ 'post_content' => $content, // 'This is a <b>preview</b> page, remember to publish it if needed. You can edit the full form settings into the admin settings page.<br /><br /> '.
560
+ 'post_status' => 'publish'
561
  );
562
 
563
  // Insert the post into the database
cp-publish-wizzard.inc.php CHANGED
@@ -51,7 +51,7 @@ if ($this->get_param('cp_contactformtoemail_do_action_loaded') == 'wizard') {
51
  <div style="clear:both"></div>
52
  <button class="button button-primary cpmvcontainer" type="button" id="nextBtn" onclick="window.open('<?php echo $this->postURL; ?>');">View the Published Contact Form</button>
53
  <div style="clear:both"></div>
54
- <p class="cpmvcontainer">* Note: If the form was published in a new page or post it will be a 'draft', you have to publish the page/post in the future if needed.</p>
55
  <div style="clear:both"></div>
56
  <button class="button button-primary cpmvcontainer" type="button" id="nextBtn" onclick="window.open('?page=<?php echo $this->prefix; ?>&cal=<?php echo $this->get_param("cp_contactformtoemail_id"); ?>');">Edit the contact form settings</button>
57
  <div style="clear:both"></div>
51
  <div style="clear:both"></div>
52
  <button class="button button-primary cpmvcontainer" type="button" id="nextBtn" onclick="window.open('<?php echo $this->postURL; ?>');">View the Published Contact Form</button>
53
  <div style="clear:both"></div>
54
+ <!--<p class="cpmvcontainer">* Note: If the form was published in a new page or post it will be a 'draft', you have to publish the page/post in the future if needed.</p>--><br />
55
  <div style="clear:both"></div>
56
  <button class="button button-primary cpmvcontainer" type="button" id="nextBtn" onclick="window.open('?page=<?php echo $this->prefix; ?>&cal=<?php echo $this->get_param("cp_contactformtoemail_id"); ?>');">Edit the contact form settings</button>
57
  <div style="clear:both"></div>
css/newadminlayout.css CHANGED
@@ -241,4 +241,6 @@ label {font-weight:600;}
241
  color: #25530F;
242
  }
243
  #facceptance span{padding-left: 0; padding-right:0;}
244
- */
 
 
241
  color: #25530F;
242
  }
243
  #facceptance span{padding-left: 0; padding-right:0;}
244
+ */
245
+
246
+ .cftesoft, .cftesoft th, .cftesoft input {color: #cccccc; }
form-to-email.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Contact Form Email
4
  Plugin URI: https://form2email.dwbooster.com/download
5
  Description: Contact form that sends the data to email and also to a database list and CSV file.
6
- Version: 1.2.79
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
@@ -12,7 +12,7 @@ License: GPL
12
 
13
  define('CP_CFEMAIL_DEFER_SCRIPTS_LOADING', (get_option('CP_CFTE_LOAD_SCRIPTS',"1") == "1"?true:false));
14
 
15
- define('CP_CFEMAIL_DEFAULT_form_structure', '[[{"name":"email","index":0,"title":"Email","ftype":"femail","userhelp":"","csslayout":"","required":true,"predefined":"","size":"medium"},{"name":"subject","index":1,"title":"Subject","required":true,"ftype":"ftext","userhelp":"","csslayout":"","predefined":"","size":"medium"},{"name":"message","index":2,"size":"large","required":true,"title":"Message","ftype":"ftextarea","userhelp":"","csslayout":"","predefined":""}],[{"title":"Contact Form","description":"","formlayout":"top_aligned"}]]');
16
 
17
  define('CP_CFEMAIL_DEFAULT_fp_subject', 'Contact from the website...');
18
  define('CP_CFEMAIL_DEFAULT_fp_inc_additional_info', 'false');
3
  Plugin Name: Contact Form Email
4
  Plugin URI: https://form2email.dwbooster.com/download
5
  Description: Contact form that sends the data to email and also to a database list and CSV file.
6
+ Version: 1.2.80
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
12
 
13
  define('CP_CFEMAIL_DEFER_SCRIPTS_LOADING', (get_option('CP_CFTE_LOAD_SCRIPTS',"1") == "1"?true:false));
14
 
15
+ define('CP_CFEMAIL_DEFAULT_form_structure', '[[{"name":"email","index":0,"title":"Email","ftype":"femail","userhelp":"","csslayout":"","required":true,"predefined":"","size":"medium"},{"name":"subject","index":1,"title":"Subject","required":true,"ftype":"ftext","userhelp":"","csslayout":"","predefined":"","size":"medium"},{"name":"message","index":2,"size":"large","required":true,"title":"Message","ftype":"ftextarea","userhelp":"","csslayout":"","predefined":""}],[{"title":"","description":"","formlayout":"top_aligned"}]]');
16
 
17
  define('CP_CFEMAIL_DEFAULT_fp_subject', 'Contact from the website...');
18
  define('CP_CFEMAIL_DEFAULT_fp_inc_additional_info', 'false');