Contact Form 7 Database Addon – CFDB7 - Version 1.2.4.7

Version Description

Action hook name changed to cfdb7_before_save

Download this release

Release Info

Developer arshidkv12
Plugin Icon 128x128 Contact Form 7 Database Addon – CFDB7
Version 1.2.4.7
Comparing to
See all releases

Code changes from version 1.2.4.5 to 1.2.4.7

Files changed (3) hide show
  1. contact-form-cfdb-7.php +3 -3
  2. inc/export-csv.php +48 -36
  3. readme.txt +66 -27
contact-form-cfdb-7.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
  Plugin name: Contact Form CFDB7
4
- Plugin URI: http://ciphercoin.com/
5
  Description: Save and manage Contact Form 7 messages. Never lose important data. Contact Form CFDB7 plugin is an add-on for the Contact Form 7 plugin.
6
  Author: Arshid
7
  Author URI: http://ciphercoin.com/
8
  Text Domain: contact-form-cfdb7
9
  Domain Path: /languages/
10
- Version: 1.2.4.5
11
  */
12
 
13
  function cfdb7_create_table(){
@@ -129,7 +129,7 @@ function cfdb7_before_send_mail( $form_tag ) {
129
  /* cfdb7 before save data. */
130
  $form_data = apply_filters('cfdb7_before_save_data', $form_data);
131
 
132
- do_action( 'cfdb7_before_save_data', $form_data );
133
 
134
  $form_post_id = $form_tag->id();
135
  $form_value = serialize( $form_data );
1
  <?php
2
  /*
3
  Plugin name: Contact Form CFDB7
4
+ Plugin URI: https://ciphercoin.com/
5
  Description: Save and manage Contact Form 7 messages. Never lose important data. Contact Form CFDB7 plugin is an add-on for the Contact Form 7 plugin.
6
  Author: Arshid
7
  Author URI: http://ciphercoin.com/
8
  Text Domain: contact-form-cfdb7
9
  Domain Path: /languages/
10
+ Version: 1.2.4.7
11
  */
12
 
13
  function cfdb7_create_table(){
129
  /* cfdb7 before save data. */
130
  $form_data = apply_filters('cfdb7_before_save_data', $form_data);
131
 
132
+ do_action( 'cfdb7_before_save', $form_data );
133
 
134
  $form_post_id = $form_tag->id();
135
  $form_value = serialize( $form_data );
inc/export-csv.php CHANGED
@@ -34,14 +34,12 @@ class Expoert_CSV{
34
  * @param array &$array
35
  * @return file csv format
36
  */
37
- public function array2csv(array &$array){
38
 
39
  if (count($array) == 0) {
40
  return null;
41
  }
42
- ob_start();
43
 
44
- $df = fopen("php://output", 'w');
45
  $array_keys = array_keys($array);
46
  $heading = array();
47
  $unwanted = array('cfdb7_', 'your-');
@@ -60,8 +58,6 @@ class Expoert_CSV{
60
  }
61
  fputcsv($df, $line_values);
62
  }
63
- fclose( $df );
64
- return ob_get_clean();
65
  }
66
  /**
67
  * Download file
@@ -80,47 +76,63 @@ class Expoert_CSV{
80
 
81
  wp_die( 'Not Valid.. Download nonce..!! ' );
82
  }
83
- $fid = (int)$_REQUEST['fid'];
84
- $results = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
85
- WHERE form_post_id = '$fid' ORDER BY form_id DESC ",OBJECT);
86
  $heading_row = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
87
  WHERE form_post_id = '$fid' ORDER BY form_id DESC LIMIT 1",OBJECT);
 
88
  $heading_row = reset( $heading_row );
89
  $heading_row = unserialize( $heading_row->form_value );
90
  $heading_key = array_keys( $heading_row );
91
-
92
- $data = array();
93
- $i = 0;
94
- foreach ($results as $result) :
 
 
 
 
 
 
 
 
 
 
95
 
96
- $i++;
97
- $data['form_id'][$i] = $result->form_id;
98
- $data['form_date'][$i] = $result->form_date;
99
- $resultTmp = unserialize( $result->form_value );
100
- $upload_dir = wp_upload_dir();
101
- $cfdb7_dir_url = $upload_dir['baseurl'].'/cfdb7_uploads';
102
-
103
- foreach ($resultTmp as $key => $value):
104
- if ( ! in_array( $key, $heading_key ) ) continue;
105
- if (strpos($key, 'cfdb7_file') !== false ){
106
- $data[$key][$i] = $cfdb7_dir_url.'/'.$value;
107
- continue;
108
- }
109
- if ( is_array($value) ){
110
-
111
- $data[$key][$i] = implode(', ', $value);
112
- continue;
113
- }
114
-
115
- $data[$key][$i] = str_replace( array('&quot;','&#039;','&#047;','&#092;')
116
- , array('"',"'",'/','\\'), $value );
 
 
 
 
 
 
117
 
118
  endforeach;
119
 
120
- endforeach;
121
 
122
- $this->download_send_headers( "cfdb7-" . date("Y-m-d") . ".csv" );
123
- echo $this->array2csv( $data );
 
124
  die();
125
  }
126
  }
34
  * @param array &$array
35
  * @return file csv format
36
  */
37
+ public function array2csv(array &$array, $df){
38
 
39
  if (count($array) == 0) {
40
  return null;
41
  }
 
42
 
 
43
  $array_keys = array_keys($array);
44
  $heading = array();
45
  $unwanted = array('cfdb7_', 'your-');
58
  }
59
  fputcsv($df, $line_values);
60
  }
 
 
61
  }
62
  /**
63
  * Download file
76
 
77
  wp_die( 'Not Valid.. Download nonce..!! ' );
78
  }
79
+ $fid = (int)$_REQUEST['fid'];
 
 
80
  $heading_row = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
81
  WHERE form_post_id = '$fid' ORDER BY form_id DESC LIMIT 1",OBJECT);
82
+
83
  $heading_row = reset( $heading_row );
84
  $heading_row = unserialize( $heading_row->form_value );
85
  $heading_key = array_keys( $heading_row );
86
+
87
+ $total_rows = $cfdb->get_var("SELECT COUNT(*) FROM $table_name WHERE form_post_id = '$fid' ");
88
+ $per_query = 1000;
89
+ $total_query = ( $total_rows / $per_query );
90
+
91
+ $this->download_send_headers( "cfdb7-" . date("Y-m-d") . ".csv" );
92
+ $df = fopen("php://output", 'w');
93
+ ob_start();
94
+
95
+ for( $p = 0; $p <= $total_query; $p++ ){
96
+
97
+ $offset = $p * $per_query;
98
+ $results = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
99
+ WHERE form_post_id = '$fid' ORDER BY form_id DESC LIMIT $offset, $per_query",OBJECT);
100
 
101
+ $data = array();
102
+ $i = 0;
103
+ foreach ($results as $result) :
104
+
105
+ $i++;
106
+ $data['form_id'][$i] = $result->form_id;
107
+ $data['form_date'][$i] = $result->form_date;
108
+ $resultTmp = unserialize( $result->form_value );
109
+ $upload_dir = wp_upload_dir();
110
+ $cfdb7_dir_url = $upload_dir['baseurl'].'/cfdb7_uploads';
111
+
112
+ foreach ($resultTmp as $key => $value):
113
+ if ( ! in_array( $key, $heading_key ) ) continue;
114
+ if (strpos($key, 'cfdb7_file') !== false ){
115
+ $data[$key][$i] = $cfdb7_dir_url.'/'.$value;
116
+ continue;
117
+ }
118
+ if ( is_array($value) ){
119
+
120
+ $data[$key][$i] = implode(', ', $value);
121
+ continue;
122
+ }
123
+
124
+ $data[$key][$i] = str_replace( array('&quot;','&#039;','&#047;','&#092;')
125
+ , array('"',"'",'/','\\'), $value );
126
+
127
+ endforeach;
128
 
129
  endforeach;
130
 
131
+ echo $this->array2csv( $data, $df );
132
 
133
+ }
134
+ echo ob_get_clean();
135
+ fclose( $df );
136
  die();
137
  }
138
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: arshidkv12
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=H5F3Z6S3MNTXA&lc=IN&item_name=wp%2dlogin%2dlimit&amount=5%2e00&currency_code=USD&button_subtype=services&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHosted
4
  Tags: cf7, contact form 7, contact form 7 db, contact form db, contact form seven, contact form storage, export contact form, save contact form, wpcf7
5
  Requires at least: 4.8
6
- Tested up to: 5.0
7
- Stable tag: 1.2.4.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
@@ -14,18 +14,35 @@ Save and manage Contact Form 7 messages. Never lose important data. It is lightw
14
 
15
  == Description ==
16
 
17
- The "CFDB7" plugin saves contact form 7 submissions to your WordPress database. Export the data to a csv file.
18
  By simply installing the plugin, it will automatically begin to capture form submissions from contact form 7.
19
 
20
  = Features of CFDB 7 =
21
 
22
  * No configuration is needed
23
- * Single database table for all forms
24
- * Easy to use ang lightweight plugin
 
25
  * Developer friendly & easy to customize
26
- * No configuration is needed
27
-
28
- Support : [http://www.ciphercoin.com/contact/](http://www.ciphercoin.com/contact/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  Extensions : [Contact form 7 more Add-ons](https://ciphercoin.com/contact-form-7-database-cfdb7-add-ons/)
30
 
31
  == Installation ==
@@ -39,34 +56,56 @@ Extensions : [Contact form 7 more Add-ons](https://ciphercoin.com/contact-form-7
39
  1. Admin
40
 
41
  == Changelog ==
42
- = 1.0.0 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
- First version of plugin.
45
- = 1.1.6 =
46
- Fixed minor bugs
47
- Add action hooks
48
  = 1.1.7 =
49
  Add filter hooks
50
  Multisite support
51
 
52
- = 1.1.9 =
53
- Fixed Sorting bugs
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
- == 1.2 ==
56
- Fixed csv export bug
57
 
58
- == 1.2.1 ==
59
- Multisite network bug fixed
60
 
61
- == 1.2.2 ==
62
- Added cfdb7_access capability
63
 
64
- == 1.2.3 ==
65
- Fixed csv export issue
66
 
67
- == 1.2.4 ==
68
- Fixed admin notification bug
69
 
70
- == 1.2.4.3 ==
71
- Responsive issue fixed
72
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=H5F3Z6S3MNTXA&lc=IN&item_name=wp%2dlogin%2dlimit&amount=5%2e00&currency_code=USD&button_subtype=services&bn=PP%2dBuyNowBF%3abtn_buynowCC_LG%2egif%3aNonHosted
4
  Tags: cf7, contact form 7, contact form 7 db, contact form db, contact form seven, contact form storage, export contact form, save contact form, wpcf7
5
  Requires at least: 4.8
6
+ Tested up to: 5.2
7
+ Stable tag: 1.2.4.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  Requires PHP: 5.3
14
 
15
  == Description ==
16
 
17
+ The "CFDB7" plugin saves contact form 7 submissions to your WordPress database. Export the data to a CSV file.
18
  By simply installing the plugin, it will automatically begin to capture form submissions from contact form 7.
19
 
20
  = Features of CFDB 7 =
21
 
22
  * No configuration is needed
23
+ * Save Contact Form 7 form submitted data to the database.
24
+ * Single database table for all contact form 7 forms
25
+ * Easy to use and lightweight plugin
26
  * Developer friendly & easy to customize
27
+ * Display all created contact form 7 form list.
28
+ * Export CF7 DB (CF7 Database) data in CSV file
29
+
30
+ = Pro Addons =
31
+ * [CFDB7 DB Switcher](https://ciphercoin.com/downloads/cfdb7-database-switcher/)
32
+ Connect CFDB7 to an external database or another DB
33
+ * [Drag & Drop File Upload](https://ciphercoin.com/downloads/filedrop-contact-form-7/)
34
+ Contact form 7 drag and drop files upload plugin.
35
+ * [Already Submitted?](https://ciphercoin.com/downloads/cfdb7-unique-field/)
36
+ Trigger error if a field is already submitted
37
+ * [CF7 Repeater](https://ciphercoin.com/downloads/contact-form-7-field-repeater-download/)
38
+ CF7 Repeater plugin allows creating one or more field dynamically
39
+ * [Popup Message](https://ciphercoin.com/downloads/cf7-popup-message/)
40
+ Replace your validation and success messages into beautiful popup message to attract visitors.
41
+ * [Export PDF File](https://ciphercoin.com/downloads/cfdb7-export-pdf-addon/)
42
+ Easy to export contact forms from database to PDF file
43
+
44
+
45
+ Support : [http://www.ciphercoin.com/contact/](https://www.ciphercoin.com/contact/)
46
  Extensions : [Contact form 7 more Add-ons](https://ciphercoin.com/contact-form-7-database-cfdb7-add-ons/)
47
 
48
  == Installation ==
56
  1. Admin
57
 
58
  == Changelog ==
59
+ = 1.2.4.7 =
60
+ Action hook name changed to cfdb7_before_save
61
+
62
+ = 1.2.4.6 =
63
+ Optimized csv export memory usage
64
+
65
+ = 1.2.4.3 =
66
+ Responsive issue fixed
67
+
68
+ = 1.2.4 =
69
+ Fixed admin notification bug
70
+
71
+ = 1.2.3 =
72
+ Fixed csv export issue
73
+
74
+ = 1.2.2 =
75
+ Added cfdb7_access capability
76
+
77
+ = 1.2.1 =
78
+ Multisite network bug fixed
79
+
80
+ = 1.2 =
81
+ Fixed csv export bug
82
+
83
+ = 1.1.9 =
84
+ Fixed Sorting bugs
85
 
 
 
 
 
86
  = 1.1.7 =
87
  Add filter hooks
88
  Multisite support
89
 
90
+ = 1.1.6 =
91
+ Fixed minor bugs
92
+ Add action hooks
93
+
94
+ = 1.0.0 =
95
+ First version of plugin.
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
 
 
 
106
 
 
 
107
 
 
 
108
 
 
 
109
 
 
 
110
 
 
 
111