Contact Form Email - Version 1.3.05

Version Description

  • New hooks and improved CSV formatting
Download this release

Release Info

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

Code changes from version 1.3.04 to 1.3.05

Files changed (3) hide show
  1. README.txt +5 -2
  2. cp-main-class.inc.php +36 -6
  3. form-to-email.php +1 -1
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.3.04 =
460
  * Interface improvements
461
 
@@ -1069,5 +1072,5 @@ When you click a field already added into the contact form builder area, you can
1069
 
1070
  == Upgrade Notice ==
1071
 
1072
- = 1.3.04 =
1073
- * Interface improvements
456
 
457
  == Changelog ==
458
 
459
+ = 1.3.05 =
460
+ * New hooks and improved CSV formatting
461
+
462
  = 1.3.04 =
463
  * Interface improvements
464
 
1072
 
1073
  == Upgrade Notice ==
1074
 
1075
+ = 1.3.05 =
1076
+ * New hooks and improved CSV formatting
cp-main-class.inc.php CHANGED
@@ -7,7 +7,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
7
  private $plugin_name = 'Contact Form to Email';
8
  private $plugin_URL = 'https://form2email.dwbooster.com';
9
  public $table_items = "cftemail_forms";
10
- private $table_messages = "cftemail_messages";
11
  public $print_counter = 1;
12
  private $include_user_data_csv = false;
13
 
@@ -23,7 +23,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
23
  if (!count($results))
24
  {
25
  $sql = "CREATE TABLE ".$wpdb->prefix.$this->table_messages." (
26
- id mediumint(9) NOT NULL AUTO_INCREMENT,
27
  formid INT NOT NULL,
28
  time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
29
  ipaddr VARCHAR(250) DEFAULT '' NOT NULL,
@@ -822,6 +822,13 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
822
  setCookie('rand_code'.$sequence, '', time()+36000,"/");
823
 
824
  $saveipaddr = ('true' == $this->get_option('fp_inc_additional_info', CP_CFEMAIL_DEFAULT_fp_inc_additional_info));
 
 
 
 
 
 
 
825
  // insert into database
826
  //---------------------------
827
  $wpdb->query("ALTER TABLE ".$wpdb->prefix.$this->table_messages." CHANGE `ipaddr` `ipaddr` VARCHAR(250)");
@@ -861,6 +868,17 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
861
  $item_number = $myrows[0]->max_id;
862
  }
863
 
 
 
 
 
 
 
 
 
 
 
 
864
  $this->ready_to_go_reservation($item_number, "", $params);
865
 
866
  if (is_admin())
@@ -1208,7 +1226,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1208
  $end = count($fields);
1209
  for ($i=0; $i<$end; $i++)
1210
  {
1211
- $hlabel = iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form));
1212
  echo '"'.str_replace('"','""', $hlabel).'",';
1213
  }
1214
  echo "\n";
@@ -1220,7 +1238,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1220
  $item[$i] = '';
1221
  if (is_array($item[$i]))
1222
  $item[$i] = implode($item[$i],',');
1223
- $item[$i] = iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $item[$i]);
1224
  echo '"'.str_replace('"','""', $item[$i]).'",';
1225
  }
1226
  echo "\n";
@@ -1228,6 +1246,18 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1228
 
1229
  exit;
1230
  }
 
 
 
 
 
 
 
 
 
 
 
 
1231
 
1232
  public function setId($id)
1233
  {
@@ -1319,7 +1349,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1319
  $end = count($fields);
1320
  for ($i=0; $i<$end; $i++)
1321
  {
1322
- $hlabel = $this->iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form));
1323
  $buffer .= '"'.str_replace('"','""', $hlabel).'",';
1324
  }
1325
  $buffer .= "\n";
@@ -1331,7 +1361,7 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
1331
  $item[$i] = '';
1332
  if (is_array($item[$i]))
1333
  $item[$i] = implode($item[$i],',');
1334
- $item[$i] = $this->iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $item[$i]);
1335
  $buffer .= '"'.str_replace('"','""', $item[$i]).'",';
1336
  }
1337
  $buffer .= "\n";
7
  private $plugin_name = 'Contact Form to Email';
8
  private $plugin_URL = 'https://form2email.dwbooster.com';
9
  public $table_items = "cftemail_forms";
10
+ public $table_messages = "cftemail_messages";
11
  public $print_counter = 1;
12
  private $include_user_data_csv = false;
13
 
23
  if (!count($results))
24
  {
25
  $sql = "CREATE TABLE ".$wpdb->prefix.$this->table_messages." (
26
+ id int(10) NOT NULL AUTO_INCREMENT,
27
  formid INT NOT NULL,
28
  time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
29
  ipaddr VARCHAR(250) DEFAULT '' NOT NULL,
822
  setCookie('rand_code'.$sequence, '', time()+36000,"/");
823
 
824
  $saveipaddr = ('true' == $this->get_option('fp_inc_additional_info', CP_CFEMAIL_DEFAULT_fp_inc_additional_info));
825
+
826
+ /**
827
+ * Action called before insert the data into database.
828
+ * To the function is passed an array with submitted data.
829
+ */
830
+ do_action_ref_array( 'cfte_process_data_before_insert', array(&$params) );
831
+
832
  // insert into database
833
  //---------------------------
834
  $wpdb->query("ALTER TABLE ".$wpdb->prefix.$this->table_messages." CHANGE `ipaddr` `ipaddr` VARCHAR(250)");
868
  $item_number = $myrows[0]->max_id;
869
  }
870
 
871
+
872
+ // Call action for data processing
873
+ //---------------------------------
874
+ $params[ 'itemnumber' ] = $item_number;
875
+
876
+ /**
877
+ * Action called after inserted the data into database.
878
+ * To the function is passed an array with submitted data.
879
+ */
880
+ do_action( 'cfte_process_data', $params );
881
+
882
  $this->ready_to_go_reservation($item_number, "", $params);
883
 
884
  if (is_admin())
1226
  $end = count($fields);
1227
  for ($i=0; $i<$end; $i++)
1228
  {
1229
+ $hlabel = $this->encodeFormula(iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form)));
1230
  echo '"'.str_replace('"','""', $hlabel).'",';
1231
  }
1232
  echo "\n";
1238
  $item[$i] = '';
1239
  if (is_array($item[$i]))
1240
  $item[$i] = implode($item[$i],',');
1241
+ $item[$i] = $this->encodeFormula(iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $item[$i]));
1242
  echo '"'.str_replace('"','""', $item[$i]).'",';
1243
  }
1244
  echo "\n";
1246
 
1247
  exit;
1248
  }
1249
+
1250
+
1251
+ public function encodeFormula($text)
1252
+ {
1253
+ $text = trim($text);
1254
+ if ( strlen($text) > 1 && (in_array(substr($text,0,1), array('=','@','+','-'))) )
1255
+ {
1256
+ if (substr($text,0,1) != '-' || floatval($text)."" != $text)
1257
+ $text = chr(9).$text;
1258
+ }
1259
+ return $text;
1260
+ }
1261
 
1262
  public function setId($id)
1263
  {
1349
  $end = count($fields);
1350
  for ($i=0; $i<$end; $i++)
1351
  {
1352
+ $hlabel = $this->encodeFormula($this->iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $this->get_form_field_label($fields[$i],$form)));
1353
  $buffer .= '"'.str_replace('"','""', $hlabel).'",';
1354
  }
1355
  $buffer .= "\n";
1361
  $item[$i] = '';
1362
  if (is_array($item[$i]))
1363
  $item[$i] = implode($item[$i],',');
1364
+ $item[$i] = $this->encodeFormula($this->iconv("utf-8", "ISO-8859-1//TRANSLIT//IGNORE", $item[$i]));
1365
  $buffer .= '"'.str_replace('"','""', $item[$i]).'",';
1366
  }
1367
  $buffer .= "\n";
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.3.04
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
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.3.05
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email