Advanced Contact form 7 DB - Version 1.1.1

Version Description

  • Made changes to resolve issue of user feasibility when editing the form fields.
  • Minor tweak related to export functionality and attachment download functionality.
Download this release

Release Info

Developer vsourz1td
Plugin Icon 128x128 Advanced Contact form 7 DB
Version 1.1.1
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.1

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vsourz1td
3
  Tags: contact form 7 db, advanced cf7 db, contact form 7 database, contact form db, contact form 7, database, cf7db, save-contact-form, Save-Forms-Data, import-cf7, export-contact-data, view-cf7-entry
4
  Requires at least: 3.5
5
  Tested up to: 4.8
6
- Stable tag: 1.1.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -91,6 +91,10 @@ If you think, that you found a bug in our plugin or have any question contact us
91
 
92
 
93
  == Changelog ==
 
 
 
 
94
  = 1.1.0 =
95
  * Update Import Functionality.
96
  * Fix CF7 Version related issue.
3
  Tags: contact form 7 db, advanced cf7 db, contact form 7 database, contact form db, contact form 7, database, cf7db, save-contact-form, Save-Forms-Data, import-cf7, export-contact-data, view-cf7-entry
4
  Requires at least: 3.5
5
  Tested up to: 4.8
6
+ Stable tag: 1.1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
91
 
92
 
93
  == Changelog ==
94
+ = 1.1.1 =
95
+ * Made changes to resolve issue of user feasibility when editing the form fields.
96
+ * Minor tweak related to export functionality and attachment download functionality.
97
+
98
  = 1.1.0 =
99
  * Update Import Functionality.
100
  * Fix CF7 Version related issue.
admin/class-advanced-cf7-db-admin.php CHANGED
@@ -373,6 +373,7 @@ class Advanced_Cf7_Db_Admin {
373
  $obj_form = vsz_cf7_get_the_form_list($form_id);
374
  //get pre define fields information
375
  $arr_form_tag = $obj_form[0]->scan_form_tags();
 
376
  $arr_field_type = array();
377
  //Define option field type array
378
  $arr_option_type = array('checkbox','radio','select');
@@ -697,6 +698,7 @@ class Advanced_Cf7_Db_Admin {
697
 
698
  //Edit form AJAX call hadle By this function
699
  public function vsz_cf7_edit_form_ajax(){
 
700
  global $wpdb;
701
  //Check entry id set or not in current request
702
  $rid = ((isset($_POST['rid']) && !empty($_POST['rid'])) ? intval($_POST['rid']) : '');
@@ -740,8 +742,8 @@ function vsz_cf7_export_to_csv($fid, $ids_export = ''){
740
  $data_sorted = wp_unslash(vsz_cf7_sortdata($data));
741
 
742
  //Generate CSV file
743
- header("Content-type: text/x-csv");
744
- header("Content-Disposition: attachment; filename=$form_title.csv");
745
  $fp = fopen('php://output', 'w');
746
  fputs($fp, "\xEF\xBB\xBF");
747
  fputcsv($fp, array_values(array_map('sanitize_text_field',$fields)));
373
  $obj_form = vsz_cf7_get_the_form_list($form_id);
374
  //get pre define fields information
375
  $arr_form_tag = $obj_form[0]->scan_form_tags();
376
+
377
  $arr_field_type = array();
378
  //Define option field type array
379
  $arr_option_type = array('checkbox','radio','select');
698
 
699
  //Edit form AJAX call hadle By this function
700
  public function vsz_cf7_edit_form_ajax(){
701
+ if(!current_user_can( 'manage_options' )) return;
702
  global $wpdb;
703
  //Check entry id set or not in current request
704
  $rid = ((isset($_POST['rid']) && !empty($_POST['rid'])) ? intval($_POST['rid']) : '');
742
  $data_sorted = wp_unslash(vsz_cf7_sortdata($data));
743
 
744
  //Generate CSV file
745
+ header('Content-Type: text/csv; charset=UTF-8');
746
+ header('Content-Disposition: attachment;filename="'.$form_title.'.csv";');
747
  $fp = fopen('php://output', 'w');
748
  fputs($fp, "\xEF\xBB\xBF");
749
  fputcsv($fp, array_values(array_map('sanitize_text_field',$fields)));
admin/partials/contact_form_listing.php CHANGED
@@ -281,6 +281,8 @@ else{
281
  <tbody><?php
282
  //Add character count functionalirty here
283
  $display_character = (int) apply_filters('vsz_display_character_count',30);
 
 
284
  //Get all fields related information
285
  foreach ($data_sorted as $k => $v) {
286
  $k = (int)$k;
@@ -297,8 +299,15 @@ else{
297
  if (!filter_var($_value, FILTER_VALIDATE_URL) === false) {
298
  $_value = esc_url($_value);
299
  //If value is url then setup anchor tag with value
300
- $_value = sprintf('<a href="%s" target="_blank">%s</a>', $_value, basename($_value));
301
- echo '<td data-head="'.vsz_cf7_admin_get_field_name($v2).'">'.$_value.'</td>';
 
 
 
 
 
 
 
302
  }
303
  else{
304
  $_value = esc_html($_value);
281
  <tbody><?php
282
  //Add character count functionalirty here
283
  $display_character = (int) apply_filters('vsz_display_character_count',30);
284
+ $arr_field_type_info = vsz_field_type_info($fid);
285
+
286
  //Get all fields related information
287
  foreach ($data_sorted as $k => $v) {
288
  $k = (int)$k;
299
  if (!filter_var($_value, FILTER_VALIDATE_URL) === false) {
300
  $_value = esc_url($_value);
301
  //If value is url then setup anchor tag with value
302
+ if(!empty($arr_field_type_info) && array_key_exists($k2,$arr_field_type_info) && $arr_field_type_info[$k2] == 'file'){
303
+ //Add download attributes in tag if field type is attachement
304
+ $_value = sprintf('<a href="%s" target="_blank" download >%s</a>', $_value, basename($_value));
305
+ echo '<td data-head="'.vsz_cf7_admin_get_field_name($v2).'">'.$_value.'</td>';
306
+ }
307
+ else{
308
+ $_value = sprintf('<a href="%s" target="_blank" >%s</a>', $_value, basename($_value));
309
+ echo '<td data-head="'.vsz_cf7_admin_get_field_name($v2).'">'.$_value.'</td>';
310
+ }
311
  }
312
  else{
313
  $_value = esc_html($_value);
advanced-cf7-db.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: Advanced CF7 DB
10
  * Plugin URI: https://wordpress.org/plugins/advanced-cf7-db/
11
  * Description: Save all contact form 7 submitted data to the database, View, Export, ordering, Change field labels, Import data using CSV very easily.
12
- * Version: 1.1.0
13
  * Author: Vsourz Digital
14
  * Author URI: https://www.vsourz.com
15
  * License: GPL-2.0+
9
  * Plugin Name: Advanced CF7 DB
10
  * Plugin URI: https://wordpress.org/plugins/advanced-cf7-db/
11
  * Description: Save all contact form 7 submitted data to the database, View, Export, ordering, Change field labels, Import data using CSV very easily.
12
+ * Version: 1.1.1
13
  * Author: Vsourz Digital
14
  * Author URI: https://www.vsourz.com
15
  * License: GPL-2.0+
includes/class-advanced-cf7-db.php CHANGED
@@ -69,7 +69,7 @@ class Advanced_Cf7_Db {
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'advanced-cf7-db';
72
- $this->version = '1.1.0';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
69
  public function __construct() {
70
 
71
  $this->plugin_name = 'advanced-cf7-db';
72
+ $this->version = '1.1.1';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
includes/vsz-cf7-db-function.php CHANGED
@@ -324,3 +324,26 @@ function vsz_cf7_import_date_format_callback(){
324
  );
325
  return $arr_dates;
326
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  );
325
  return $arr_dates;
326
  }
327
+
328
+ //Get field name related type information
329
+ function vsz_field_type_info($fid){
330
+
331
+ if(empty($fid) || !intval($fid)) return ;
332
+
333
+ $fid = intval($fid);
334
+ $obj_form = vsz_cf7_get_the_form_list($fid);
335
+ //get pre define fields information
336
+ $arr_form_tag = $obj_form[0]->scan_form_tags();
337
+ $arr_field_type = array();
338
+ if(!empty($arr_form_tag)){
339
+ //Get all fields related information
340
+ foreach($arr_form_tag as $key => $arr_type){
341
+ //Check if tag type is submit then ignore tag info
342
+ if($arr_type['basetype'] == 'submit') continue;
343
+ //get field type information
344
+ $arr_field_type[$arr_type['name']] = $arr_type['basetype'];
345
+ }
346
+ }
347
+
348
+ return $arr_field_type;
349
+ }