This commit is contained in:
2026-10-06 18:51:23 -06:00
parent 8424dacd03
commit e2c26b7f21
4223 changed files with 737986 additions and 53 deletions
@@ -0,0 +1,326 @@
<?php
/*
Plugin name: Contact Form CFDB7
Plugin URI: https://ciphercoin.com/
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.
Author: Arshid
Author URI: http://ciphercoin.com/
Text Domain: contact-form-cfdb7
License: GPL v2 or later
Domain Path: /languages/
Version: 1.4.0
*/
define('CFDB7_PLUGIN_FILE', __FILE__ );
function cfdb7_create_table(){
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
if( $cfdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name ) {
$charset_collate = $cfdb->get_charset_collate();
$sql = "CREATE TABLE $table_name (
form_id bigint(20) NOT NULL AUTO_INCREMENT,
form_post_id bigint(20) NOT NULL,
form_value longtext NOT NULL,
form_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
PRIMARY KEY (form_id)
) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
}
$upload_dir = wp_upload_dir();
$cfdb7_dirname = $upload_dir['basedir'].'/cfdb7_uploads';
if ( ! file_exists( $cfdb7_dirname ) ) {
wp_mkdir_p( $cfdb7_dirname );
$fp = fopen( $cfdb7_dirname.'/index.php', 'w');
fwrite($fp, "<?php \n\t // Silence is golden.");
fclose( $fp );
}
add_option( 'cfdb7_view_install_date', date('Y-m-d G:i:s'), '', 'yes');
}
function cfdb7_on_activate( $network_wide ){
global $wpdb;
if ( is_multisite() && $network_wide ) {
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
cfdb7_create_table();
restore_current_blog();
}
} else {
cfdb7_create_table();
}
$role = get_role( 'administrator' );
$role->add_cap( 'cfdb7_access' );
}
register_activation_hook( __FILE__, 'cfdb7_on_activate' );
function cfdb7_upgrade_function( $upgrader_object, $options ) {
$upload_dir = wp_upload_dir();
$cfdb7_dirname = $upload_dir['basedir'].'/cfdb7_uploads';
if ( file_exists( $cfdb7_dirname.'/index.php' ) ) return;
if ( file_exists( $cfdb7_dirname ) ) {
$fp = fopen( $cfdb7_dirname.'/index.php', 'w');
fwrite($fp, "<?php \n\t // Silence is golden.");
fclose( $fp );
}
}
add_action( 'upgrader_process_complete', 'cfdb7_upgrade_function',10, 2);
function cfdb7_on_deactivate() {
global $wp_roles;
foreach( array_keys( $wp_roles->roles ) as $role ) {
$wp_roles->remove_cap( $role, 'cfdb7_access' );
}
}
register_deactivation_hook( __FILE__, 'cfdb7_on_deactivate' );
function cfdb7_before_send_mail( $form_tag ) {
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
$upload_dir = wp_upload_dir();
$cfdb7_dirname = $upload_dir['basedir'].'/cfdb7_uploads';
$bytes = random_bytes(5);
$time_now = time().bin2hex($bytes);
$submission = WPCF7_Submission::get_instance();
$contact_form = $submission->get_contact_form();
$tags_names = array();
$strict_keys = apply_filters('cfdb7_strict_keys', false);
if ( $submission ) {
$allowed_tags = array();
$bl = array('\"',"\'",'/','\\','"',"'");
$wl = array('&quot;','&#039;','&#047;', '&#092;','&quot;','&#039;');
if( $strict_keys ){
$tags = $contact_form->scan_form_tags();
foreach( $tags as $tag ){
if( ! empty($tag->name) ) $tags_names[] = $tag->name;
}
$allowed_tags = $tags_names;
}
$not_allowed_tags = apply_filters( 'cfdb7_not_allowed_tags', array( 'g-recaptcha-response' ) );
$allowed_tags = apply_filters( 'cfdb7_allowed_tags', $allowed_tags );
$data = $submission->get_posted_data();
$files = $submission->uploaded_files();
$uploaded_files = array();
foreach ($_FILES as $file_key => $file) {
array_push($uploaded_files, $file_key);
}
$files = apply_filters( 'cfdb7_before_file_copy', $files );
foreach ($files as $file_key => $file) {
$file = is_array( $file ) ? reset( $file ) : $file;
if( empty($file) ) continue;
copy($file, $cfdb7_dirname.'/'.$time_now.'-'.$file_key.'-'.basename($file));
}
$form_data = array();
$form_data['cfdb7_status'] = 'unread';
foreach ($data as $key => $d) {
if( $strict_keys && !in_array($key, $allowed_tags) ) continue;
if ( !in_array($key, $not_allowed_tags ) && !in_array($key, $uploaded_files ) ) {
$tmpD = $d;
if ( ! is_array($d) ){
$tmpD = str_replace($bl, $wl, $tmpD );
}else{
$tmpD = array_map(function($item) use($bl, $wl){
return str_replace($bl, $wl, $item );
}, $tmpD);
}
$key = sanitize_text_field( $key );
$form_data[$key] = $tmpD;
}
if ( in_array($key, $uploaded_files ) ) {
$file = is_array( $files[ $key ] ) ? reset( $files[ $key ] ) : $files[ $key ];
$file_name = empty( $file ) ? '' : $time_now.'-'.$key.'-'.basename( $file );
$key = sanitize_text_field( $key );
$form_data[$key.'cfdb7_file'] = sanitize_text_field($file_name);
}
}
$form_data = apply_filters('cfdb7_before_save_data', $form_data);
do_action( 'cfdb7_before_save', $form_data );
$form_post_id = $form_tag->id();
$form_value = serialize( $form_data );
$form_date = current_time('Y-m-d H:i:s');
$cfdb->insert( $table_name, array(
'form_post_id' => $form_post_id,
'form_value' => $form_value,
'form_date' => $form_date
) );
$insert_id = $cfdb->insert_id;
do_action( 'cfdb7_after_save_data', $insert_id, $form_data );
}
}
add_action( 'wpcf7_before_send_mail', 'cfdb7_before_send_mail' );
add_action( 'init', 'cfdb7_init');
/**
* CFDB7 cfdb7_init and cfdb7_admin_init
* Admin setting
*/
function cfdb7_init(){
do_action( 'cfdb7_init' );
if( is_admin() ){
require_once 'inc/admin-mainpage.php';
require_once 'inc/admin-subpage.php';
require_once 'inc/admin-form-details.php';
require_once 'inc/export-csv.php';
require_once 'inc/settings.php';
do_action( 'cfdb7_admin_init' );
$csv = new CFDB7_Export_CSV();
if( isset($_REQUEST['csv']) && ( $_REQUEST['csv'] == true ) && isset( $_REQUEST['nonce'] ) ) {
$nonce = $_REQUEST['nonce'];
if ( ! wp_verify_nonce( $nonce, 'dnonce' ) ) wp_die('Invalid nonce..!!');
$csv->download_csv_file();
}
Cfdb7_Wp_Main_Page::getInstance();
CFDB7_Settings::getInstance();
}
}
add_action( 'admin_notices', 'cfdb7_admin_notice' );
add_action('admin_init', 'cfdb7_view_ignore_notice' );
function cfdb7_admin_notice() {
if( get_option('cfdb7_view_ignore_notice') ){
return;
}
if( empty($_GET['page']) || empty($_GET['fid']) || $_GET['page'] != 'cfdb7-list.php'){
return;
}
global $wpdb;
$form_post_id = (int) $_GET['fid'];
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
$totalItems = $cfdb->get_var("SELECT COUNT(*) FROM $table_name WHERE form_post_id = '$form_post_id'");
if($totalItems < 1){
return;
}
$message = _n(
'🎉 Nice! CFDB7 has successfully saved your form entry.',
'🎉 Nice! CFDB7 has successfully saved your form entries.',
$totalItems,
'contact-form-cfdb7'
);
echo '<div class="notice notice-success is-dismissible"><p>';
printf(
__(
'%1$s If it\'s helpful, would you consider leaving a <strong>5-star review</strong> on WordPress?<br><br>
<a href="%3$s" class="button button-primary" target="_blank">⭐ Leave a review</a>
<a href="%2$s" class="button-link-delete">I already did</a> |
<a href="%2$s" class="button-link-delete">No, thanks</a>',
'contact-form-cfdb7'
),
esc_html( $message ),
esc_url( add_query_arg(
[
'page' => 'cfdb7-list.php',
'fid' => (int) $form_post_id,
'cfdb7-ignore-notice' => 1,
],
admin_url( 'admin.php' )
) ),
esc_url( 'https://wordpress.org/plugins/contact-form-cfdb7/' )
);
echo '</p></div>';
}
function cfdb7_view_ignore_notice() {
if ( isset($_GET['cfdb7-ignore-notice']) && '1' == $_GET['cfdb7-ignore-notice'] ) {
update_option( 'cfdb7_view_ignore_notice', 'true' );
}
}
/**
* Plugin settings link
* @param array $links list of links
* @return array of links
*/
function cfdb7_settings_link( $links ) {
$forms_link = '<a href="admin.php?page=cfdb7-list.php">' . __( 'Submissions', 'contact-form-cfdb7' ) . '</a>';
array_unshift($links, $forms_link);
return $links;
}
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'cfdb7_settings_link' );
/**
* Load language files to enable plugin translation
*
* @since 1.2.4.1
*/
function cfdb7_load_textdomain() {
load_plugin_textdomain( 'contact-form-cfdb7', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
add_action( 'plugins_loaded', 'cfdb7_load_textdomain' );
@@ -0,0 +1,42 @@
.cfdb7 .extension {
width: 29.7%;
border: 1px #888 solid;
padding: 7px;
margin: 5px;
float: left;
text-align: center;
min-height: 330px;
}
.cfdb7 h3{
text-align: center;
}
.cfdb7 .button{
text-align: center;
}
.cfdb7-panel{
position: relative;
overflow: auto;
margin: 16px 0;
padding: 23px 10px 0;
border: 1px solid #c3c4c7;
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
background: #fff;
font-size: 13px;
line-height: 1.7;
padding-bottom:15px
}
.cfdb7-panel-content{
margin-left: 15px;
}
.cfdb7-panel-content h3{
margin-top: 0;
}
@media (max-width: 767.98px) {
.cfdb7 .extension{
width:93%;
}
}
@@ -0,0 +1,112 @@
/* Premium feature cards */
.cfdb7-premium-setting {
background: #fff;
border: 1px solid #dcdcde;
border-radius: 8px;
padding: 18px 20px;
margin: 15px 0;
max-width: 720px;
box-shadow: 0 1px 2px rgba(0,0,0,.04);
transition: all .2s ease;
}
.cfdb7-premium-setting:hover {
border-color: #2271b1;
box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.cfdb7-premium-setting label {
display: flex;
align-items: center;
gap: 10px;
font-size: 15px;
font-weight: 600;
margin-bottom: 10px;
}
.cfdb7-premium-setting input[type="checkbox"] {
cursor: not-allowed;
}
.cfdb7-premium-setting .description {
margin: 0 0 15px;
color: #50575e;
line-height: 1.6;
}
.cfdb7-premium-setting .cfdb7-lock {
display: inline-flex;
align-items: center;
gap: 6px;
color: #d63638;
font-weight: 600;
margin-bottom: 12px;
}
.cfdb7-premium-setting .cfdb7-installed {
display: inline-flex;
align-items: center;
gap: 6px;
color: #00a32a;
font-weight: 600;
margin-bottom: 12px;
}
.cfdb7-premium-setting .button {
margin-top: 6px;
}
/* Premium section heading */
#cfdb7_premium_section {
margin-top: 35px;
}
#cfdb7_premium_section h2 {
margin-bottom: 6px;
}
.cfdb7-premium-note {
color: #646970;
margin-bottom: 20px;
}
/* Disabled appearance */
.cfdb7-premium-setting.disabled {
opacity: .85;
}
.cfdb7-premium-setting.disabled input,
.cfdb7-premium-setting.disabled select {
pointer-events: none;
}
/* Small badge */
.cfdb7-badge {
display: inline-block;
margin-left: 8px;
padding: 2px 8px;
border-radius: 999px;
background: #2271b1;
color: #fff;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
vertical-align: middle;
}
/* Installed badge */
.cfdb7-badge-success {
background: #00a32a;
}
/* Responsive */
@media (max-width: 782px) {
.cfdb7-premium-setting {
max-width: 100%;
padding: 15px;
}
.cfdb7-premium-setting label {
align-items: flex-start;
}
}
@@ -0,0 +1,64 @@
<?php
if (!defined( 'ABSPATH')) exit;
add_action('admin_menu', 'register_addon_submenu', 99);
function register_addon_submenu(){
add_submenu_page(
'cfdb7-list.php',
__( 'Extensions', 'contact-form-cfdb7' ),
'<span style="color:#f18500">' . esc_html__( 'Addons', 'contact-form-cfdb7' ) . '</span>',
'manage_options', 'cfdb7-extensions',
'cfdb7_extensions',
);
}
/**
* Extensions page
*/
function cfdb7_extensions(){
?>
<div class="wrap">
<h2><?php _e( 'Extensions for CFDB7', 'contact-form-cfdb7' ); ?>
<span>
<a class="button-primary" href="https://ciphercoin.com/contact-form-7-database-cfdb7-add-ons/"><?php _e( 'Browse All Extensions', 'contact-form-cfdb7' ); ?></a>
</span>
</h2>
<p><?php _e( 'Add extra features to CFDB7 with these extensions.', 'contact-form-cfdb7' ); ?></p>
<?php echo cfdb7_add_ons_get_feed(); ?>
</div>
<?php
}
/**
* Add-ons Get Feed
*
* Gets the add-ons page feed.
*
* @since 1.0
* @return void
*/
function cfdb7_add_ons_get_feed(){
$cache = get_transient( 'cfdb7_add_ons_feed' );
if ( false === $cache ) {
$url = 'https://ciphercoin.com/cfdb7/?feed=true';
$feed = wp_remote_get( esc_url_raw( $url ), array(
'sslverify' => false,
'timeout' => 30,
) );
if ( ! is_wp_error( $feed ) ) {
if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
$cache = wp_remote_retrieve_body( $feed );
set_transient( 'cfdb7_add_ons_feed', $cache, 3600 );
}
} else {
$cache = '<div class="error"><p>' . __( 'There was an error retrieving the extensions list from the server. Please try again later.', 'contact-form-cfdb7' ) . '</div>';
}
}
return $cache;
}
// delete_transient('cfdb7_add_ons_feed');
@@ -0,0 +1,113 @@
<?php
if (!defined( 'ABSPATH')) exit;
/**
* Details Page
*/
class CFDB7_Form_Details
{
private $form_id;
private $form_post_id;
public function __construct()
{
$this->form_post_id = isset( $_GET['fid'] ) ? (int) $_GET['fid'] : 0;
$this->form_id = isset( $_GET['ufid'] ) ? (int) $_GET['ufid'] : 0;
$this->form_details_page();
}
public function form_details_page(){
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
$upload_dir = wp_upload_dir();
$cfdb7_dir_url = $upload_dir['baseurl'].'/cfdb7_uploads';
$rm_underscore = apply_filters('cfdb7_remove_underscore_data', true);
$result = $cfdb->get_row( "SELECT * FROM $table_name WHERE form_post_id = $this->form_post_id AND form_id = $this->form_id LIMIT 1", OBJECT );
if ( empty($result) ) {
wp_die( 'Not valid contact form' );
}
?>
<div class="wrap">
<div id="welcome-panel" class="cfdb7-panel">
<div class="cfdb7-panel-content">
<div class="welcome-panel-column-container">
<?php do_action('cfdb7_before_formdetails_title',$this->form_post_id ); ?>
<h3><?php esc_html_e( get_the_title( $this->form_post_id ), 'contact-form-cfdb7' )?></h3>
<?php do_action('cfdb7_after_formdetails_title', $this->form_post_id ); ?>
<p></span><?php esc_html_e( $result->form_date, 'contact-form-cfdb7' ) ?></p>
<?php $form_data = unserialize( $result->form_value, ['allowed_classes' => false] );
foreach ($form_data as $key => $data):
$matches = array();
$key = esc_html( $key );
if ( $key == 'cfdb7_status' ) continue;
if( $rm_underscore ) preg_match('/^_.*$/m', $key, $matches);
if( ! empty($matches[0]) ) continue;
if ( strpos($key, 'cfdb7_file') !== false ){
$key_val = str_replace('cfdb7_file', '', $key);
$key_val = str_replace('your-', '', $key_val);
$key_val = str_replace( array('-','_'), ' ', $key_val);
$key_val = ucwords( $key_val );
echo '<p><b>'.esc_html($key_val).'</b>: <a href="'.esc_url($cfdb7_dir_url.'/'.$data).'">'
.esc_html($data).'</a></p>';
}else{
if ( is_array($data) ) {
$key_val = str_replace('your-', '', $key);
$key_val = str_replace( array('-','_'), ' ', $key_val);
$key_val = ucwords( $key_val );
$arr_str_data = implode(', ',$data);
$arr_str_data = esc_html( $arr_str_data );
echo '<p><b>'.esc_html($key_val).'</b>: '. nl2br($arr_str_data) .'</p>';
}else{
$key_val = str_replace('your-', '', $key);
$key_val = str_replace( array('-','_'), ' ', $key_val);
$key_val = ucwords( $key_val );
$data = esc_html( $data );
echo '<p><b>'.esc_html($key_val).'</b>: '.nl2br($data).'</p>';
}
}
endforeach;
$form_data['cfdb7_status'] = 'read';
$form_data = serialize( $form_data );
$form_id = $result->form_id;
$sql = $cfdb->prepare(
"UPDATE {$table_name} SET form_value = %s WHERE form_id = %d",
$form_data,
$form_id
);
$cfdb->query( $sql );
?>
</div>
</div>
</div>
</div>
<?php
do_action('cfdb7_after_formdetails', $this->form_post_id );
}
}
@@ -0,0 +1,202 @@
<?php
/**
* CFDB7 Admin section
*/
if (!defined( 'ABSPATH')) exit;
/**
* Cfdb7_Wp_List_Table class will create the page to load the table
*/
class CFDB7_Wp_Main_Page
{
private static $instance = null;
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor will create the menu item
*/
private function __construct()
{
add_action( 'admin_menu', array($this, 'admin_list_table_page' ) );
}
/**
* Menu item will allow us to load the page to display the table
*/
public function admin_list_table_page()
{
wp_enqueue_style( 'cfdb7-admin-style', plugin_dir_url(dirname(__FILE__)).'css/admin-style.css' );
// Fallback: Make sure admin always has access
$cfdb7_cap = ( current_user_can( 'cfdb7_access') ) ? 'cfdb7_access' : 'manage_options';
add_menu_page( __( 'Contact Forms', 'contact-form-cfdb7' ), __( 'Contact Forms', 'contact-form-cfdb7' ), $cfdb7_cap, 'cfdb7-list.php', array($this, 'list_table_page'), 'dashicons-list-view' );
require_once 'add-ons.php';
}
/**
* Display the list table page
*
* @return Void
*/
public function list_table_page()
{
if ( ! class_exists('WPCF7_ContactForm') ) {
wp_die( 'Please activate <a href="https://wordpress.org/plugins/contact-form-7/" target="_blank">contact form 7</a> plugin.' );
}
$fid = empty($_GET['fid']) ? 0 : (int) $_GET['fid'];
$ufid = empty($_GET['ufid']) ? 0 : (int) $_GET['ufid'];
if ( !empty($fid) && empty($_GET['ufid']) ) {
new CFDB7_Wp_Sub_Page();
return;
}
if( !empty($ufid) && !empty($fid) ){
new CFDB7_Form_Details();
return;
}
$ListTable = new CFDB7_Main_List_Table();
$ListTable->prepare_items();
?>
<div class="wrap">
<div id="icon-users" class="icon32"></div>
<h2><?php _e( 'Contact Forms', 'contact-form-cfdb7' ); ?></h2>
<?php $ListTable->display(); ?>
</div>
<?php
}
}
// WP_List_Table is not loaded automatically so we need to load it in our application
if( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
/**
* Create a new table class that will extend the WP_List_Table
*/
class CFDB7_Main_List_Table extends WP_List_Table
{
/**
* Prepare the items for the table to process
*
* @return Void
*/
public function prepare_items()
{
$columns = $this->get_columns();
$hidden = $this->get_hidden_columns();
$data = $this->table_data();
$perPage = 10;
$currentPage = $this->get_pagenum();
$count_forms = wp_count_posts('wpcf7_contact_form');
$totalItems = $count_forms->publish;
$this->set_pagination_args( array(
'total_items' => $totalItems,
'per_page' => $perPage
) );
$this->_column_headers = array($columns, $hidden );
$this->items = $data;
}
/**
* Override the parent columns method. Defines the columns to use in your listing table
*
* @return Array
*/
public function get_columns()
{
$columns = array(
'name' => __( 'Name', 'contact-form-cfdb7' ),
'count'=> __( 'Count', 'contact-form-cfdb7' )
);
return $columns;
}
/**
* Define which columns are hidden
*
* @return Array
*/
public function get_hidden_columns()
{
return array();
}
/**
* Get the table data
*
* @return Array
*/
private function table_data()
{
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$data = array();
$table_name = $cfdb->prefix.'db7_forms';
$page = $this->get_pagenum();
$page = $page - 1;
$start = $page * 10;
$args = array(
'post_type'=> 'wpcf7_contact_form',
'order' => 'ASC',
'posts_per_page' => 10,
'offset' => $start
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) : $the_query->the_post();
$form_post_id = get_the_id();
$totalItems = $cfdb->get_var("SELECT COUNT(*) FROM $table_name WHERE form_post_id = $form_post_id");
$title = get_the_title();
$link = "<a class='row-title' href=admin.php?page=cfdb7-list.php&fid=$form_post_id>%s</a>";
$data_value['name'] = sprintf( $link, $title );
$data_value['count'] = sprintf( $link, $totalItems );
$data[] = $data_value;
endwhile;
return $data;
}
/**
* Define what data to show on each column of the table
*
* @param Array $item Data
* @param String $column_name - Current column name
*
* @return Mixed
*/
public function column_default( $item, $column_name )
{
return $item[ $column_name ];
}
}
@@ -0,0 +1,477 @@
<?php
/**
* CFDB7 Admin subpage
*/
if (!defined( 'ABSPATH')) exit;
/**
* Cfdb7_Wp_List_Table class will create the page to load the table
*/
class CFDB7_Wp_Sub_Page
{
private $form_post_id;
/**
* Constructor start subpage
*/
public function __construct()
{
$this->form_post_id = (int) $_GET['fid'];
$this->list_table_page();
}
/**
* Display the list table page
*
* @return Void
*/
public function list_table_page()
{
$ListTable = new CFDB7_List_Table();
$ListTable->prepare_items();
?>
<div class="wrap">
<div id="icon-users" class="icon32"></div>
<h2><?php echo get_the_title( $this->form_post_id ); ?></h2>
<form method="post" action="">
<?php $ListTable->search_box(__( 'Search', 'contact-form-cfdb7' ), 'search'); ?>
<?php $ListTable->display(); ?>
</form>
</div>
<?php
}
}
// WP_List_Table is not loaded automatically so we need to load it in our application
if( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
/**
* Create a new table class that will extend the WP_List_Table
*/
class CFDB7_List_Table extends WP_List_Table
{
private $form_post_id;
private $column_titles = array();
public function __construct() {
parent::__construct(
array(
'singular' => 'contact_form',
'plural' => 'contact_forms',
'ajax' => false
)
);
}
/**
* Prepare the items for the table to process
*
* @return Void
*/
public function prepare_items()
{
$this->form_post_id = (int) $_GET['fid'];
$search = empty( $_REQUEST['s'] ) ? false : esc_sql( $_REQUEST['s'] );
$form_post_id = $this->form_post_id;
global $wpdb;
$this->process_bulk_action();
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
$columns = $this->get_columns();
$hidden = $this->get_hidden_columns();
$sortable = $this->get_sortable_columns();
$data = $this->table_data();
//usort( $data, array( &$this, 'sort_data' ) );
$perPage = 100;
$currentPage = $this->get_pagenum();
if ( ! empty($search) ) {
$totalItems = $cfdb->get_var("SELECT COUNT(*) FROM $table_name WHERE form_value LIKE '%$search%' AND form_post_id = '$form_post_id' ");
}else{
$totalItems = $cfdb->get_var("SELECT COUNT(*) FROM $table_name WHERE form_post_id = '$form_post_id'");
}
$this->set_pagination_args( array(
'total_items' => $totalItems,
'per_page' => $perPage
) );
$this->_column_headers = array($columns, $hidden ,$sortable);
$this->items = $data;
}
/**
* Override the parent columns method. Defines the columns to use in your listing table
*
* @return Array
*/
public function get_columns()
{
$form_post_id = $this->form_post_id;
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
$results = $cfdb->get_results( "
SELECT * FROM $table_name
WHERE form_post_id = $form_post_id ORDER BY form_id DESC LIMIT 1", OBJECT
);
$first_row = isset($results[0]) ? unserialize( $results[0]->form_value, ['allowed_classes' => false] ): 0 ;
$columns = array();
$rm_underscore = apply_filters('cfdb7_remove_underscore_data', true);
if( !empty($first_row) ){
//$columns['form_id'] = $results[0]->form_id;
$columns['cb'] = '<input type="checkbox" />';
foreach ($first_row as $key => $value) {
$matches = array();
$key = esc_html( $key );
if ( $key == 'cfdb7_status' ) continue;
if( $rm_underscore ) preg_match('/^_.*$/m', $key, $matches);
if( ! empty($matches[0]) ) continue;
$key_val = str_replace( array('your-', 'cfdb7_file'), '', $key);
$key_val = str_replace( array('_', '-'), ' ', $key_val);
$columns[$key] = ucwords( $key_val );
$this->column_titles[] = $key_val;
if ( sizeof($columns) > 4) break;
}
$columns['form-date'] = 'Date';
}
return apply_filters('cfdb7_admin_subpage_columns', $columns, $form_post_id);
}
/**
* Define check box for bulk action (each row)
* @param $item
* @return checkbox
*/
public function column_cb($item){
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
$this->_args['singular'],
$item['form_id']
);
}
/**
* Define which columns are hidden
*
* @return Array
*/
public function get_hidden_columns()
{
return array('form_id');
}
/**
* Define the sortable columns
*
* @return Array
*/
public function get_sortable_columns()
{
return array('form-date' => array('form-date', true));
}
/**
* Define bulk action
* @return Array
*/
public function get_bulk_actions() {
return array(
'read' => __( 'Read', 'contact-form-cfdb7' ),
'unread' => __( 'Unread', 'contact-form-cfdb7' ),
'delete' => __( 'Delete', 'contact-form-cfdb7' )
);
}
/**
* Get the table data
*
* @return Array
*/
private function table_data()
{
$data = array();
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$search = empty( $_REQUEST['s'] ) ? false : esc_sql( $_REQUEST['s'] );
$table_name = $cfdb->prefix.'db7_forms';
$page = $this->get_pagenum();
$page = $page - 1;
$start = $page * 100;
$form_post_id = $this->form_post_id;
$orderby = isset($_GET['orderby']) ? 'form_date' : 'form_id';
$order = isset($_GET['order']) && $_GET['order'] == 'asc' ? 'ASC' : 'DESC';
if ( ! empty($search) ) {
$results = $cfdb->get_results( "SELECT * FROM $table_name
WHERE form_value LIKE '%$search%'
AND form_post_id = '$form_post_id'
ORDER BY $orderby $order
LIMIT $start,100", OBJECT
);
}else{
$results = $cfdb->get_results( "SELECT * FROM $table_name
WHERE form_post_id = $form_post_id
ORDER BY $orderby $order
LIMIT $start,100", OBJECT
);
}
foreach ( $results as $result ) {
$form_value = unserialize( $result->form_value, ['allowed_classes' => false] );
$link = "<b><a href=admin.php?page=cfdb7-list.php&fid=%s&ufid=%s>%s</a></b>";
if(isset($form_value['cfdb7_status']) && ( $form_value['cfdb7_status'] === 'read' ) )
$link = "<a href=admin.php?page=cfdb7-list.php&fid=%s&ufid=%s>%s</a>";
$fid = $result->form_post_id;
$form_values['form_id'] = $result->form_id;
foreach ( $this->column_titles as $col_title) {
$form_value[ $col_title ] = isset( $form_value[ $col_title ] ) ?
$form_value[ $col_title ] : '';
}
foreach ($form_value as $k => $value) {
$ktmp = $k;
$can_foreach = is_array($value) || is_object($value);
if ( $can_foreach ) {
foreach ($value as $k_val => $val):
$val = esc_html( $val );
$form_values[$ktmp] = ( strlen($val) > 150 ) ? substr($val, 0, 150).'...': $val;
$form_values[$ktmp] = sprintf($link, $fid, $result->form_id, $form_values[$ktmp]);
endforeach;
}else{
$value = esc_html( $value );
$form_values[$ktmp] = ( strlen($value) > 150 ) ? substr($value, 0, 150).'...': $value;
$form_values[$ktmp] = sprintf($link, $fid, $result->form_id, $form_values[$ktmp]);
}
}
$form_values['form-date'] = sprintf($link, $fid, $result->form_id, $result->form_date );
$data[] = $form_values;
}
return $data;
}
/**
* Define bulk action
*
*/
public function process_bulk_action(){
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
$action = $this->current_action();
if ( !empty( $action ) ) {
$nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : '';
$nonce_action = 'bulk-' . $this->_args['plural'];
if ( !wp_verify_nonce( $nonce, $nonce_action ) ){
wp_die( 'Not valid..!!' );
}
}
$form_ids = isset( $_POST['contact_form'] ) ? $_POST['contact_form'] : array();
if( 'delete' === $action ) {
foreach ($form_ids as $form_id):
$form_id = (int) $form_id;
$results = $cfdb->get_results( "SELECT * FROM $table_name WHERE form_id = '$form_id' LIMIT 1", OBJECT );
$result_value = $results[0]->form_value;
$result_values = unserialize($result_value, ['allowed_classes' => false]);
$upload_dir = wp_upload_dir();
$cfdb7_dirname = $upload_dir['basedir'].'/cfdb7_uploads';
foreach ($result_values as $key => $result) {
if ( ( strpos($key, 'cfdb7_file') !== false ) &&
! empty( $result ) &&
file_exists($cfdb7_dirname.'/'.$result) ) {
unlink($cfdb7_dirname.'/'.$result);
}
}
$cfdb->delete(
$table_name ,
array( 'form_id' => $form_id ),
array( '%d' )
);
endforeach;
}else if( 'read' === $action ){
foreach ($form_ids as $form_id):
$form_id = (int) $form_id;
$results = $cfdb->get_results( "SELECT * FROM $table_name WHERE form_id = '$form_id' LIMIT 1", OBJECT );
$result_value = $results[0]->form_value;
$result_values = unserialize( $result_value, ['allowed_classes' => false] );
$result_values['cfdb7_status'] = 'read';
$form_data = serialize( $result_values );
$sql = $cfdb->prepare(
"UPDATE {$table_name} SET form_value = %s WHERE form_id = %d",
$form_data,
$form_id
);
$cfdb->query( $sql );
endforeach;
}else if( 'unread' === $action ){
foreach ($form_ids as $form_id):
$form_id = (int) $form_id;
$results = $cfdb->get_results( "SELECT * FROM $table_name WHERE form_id = '$form_id' LIMIT 1", OBJECT );
$result_value = $results[0]->form_value;
$result_values = unserialize( $result_value, ['allowed_classes' => false] );
$result_values['cfdb7_status'] = 'unread';
$form_data = serialize( $result_values );
$sql = $cfdb->prepare(
"UPDATE {$table_name} SET form_value = %s WHERE form_id = %d",
$form_data,
$form_id
);
$cfdb->query( $sql );
endforeach;
}
}
/**
* Define what data to show on each column of the table
*
* @param Array $item Data
* @param String $column_name - Current column name
*
* @return Mixed
*/
public function column_default( $item, $column_name )
{
return isset( $item[ $column_name ] ) ? $item[ $column_name ]: '';
}
/**
* Allows you to sort the data by the variables set in the $_GET
*
* @return Mixed
*/
private function sort_data( $a, $b )
{
// Set defaults
$orderby = 'form_date';
$order = 'ASC';
// If orderby is set, use this as the sort column
if(!empty($_GET['orderby']))
{
$orderby = $_GET['orderby'] === 'form_id' ? 'form_id' : 'form_date';
}
// If order is set use this as the order
if(!empty($_GET['order']))
{
$order = $_GET['order'] === 'asc' ? 'ASC' : 'DESC';
}
$result = strcmp( $a[$orderby], $b[$orderby] );
if($order === 'asc')
{
return $result;
}
return -$result;
}
/**
* Display the bulk actions dropdown.
*
* @since 3.1.0
* @access protected
*
* @param string $which The location of the bulk actions: 'top' or 'bottom'.
* This is designated as optional for backward compatibility.
*/
protected function bulk_actions( $which = '' ) {
if ( is_null( $this->_actions ) ) {
$this->_actions = $this->get_bulk_actions();
/**
* Filters the list table Bulk Actions drop-down.
*
* The dynamic portion of the hook name, `$this->screen->id`, refers
* to the ID of the current screen, usually a string.
*
* This filter can currently only be used to remove bulk actions.
*
* @since 3.5.0
*
* @param array $actions An array of the available bulk actions.
*/
$this->_actions = apply_filters( "cfdb7_bulk_actions-{$this->screen->id}", $this->_actions );
$two = '';
} else {
$two = '2';
}
if ( empty( $this->_actions ) )
return;
echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action', 'contact-form-cfdb7' ) . '</label>';
echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
echo '<option value="-1">' . __( 'Bulk Actions', 'contact-form-cfdb7' ) . "</option>\n";
foreach ( $this->_actions as $name => $title ) {
$class = 'edit' === $name ? ' class="hide-if-no-js"' : '';
echo "\t" . '<option value="' . $name . '"' . $class . '>' . $title . "</option>\n";
}
echo "</select>\n";
submit_button( __( 'Apply', 'contact-form-cfdb7' ), 'action', '', false, array( 'id' => "doaction$two" ) );
echo "\n";
$nonce = wp_create_nonce( 'dnonce' );
echo "<a href='".esc_html($_SERVER['REQUEST_URI'])."&csv=true&nonce=".$nonce."' style='float:right; margin:0;' class='button'>";
_e( 'Export CSV', 'contact-form-cfdb7' );
echo '</a>';
do_action('cfdb7_after_export_button');
}
}
@@ -0,0 +1,179 @@
<?php
/**
* CFDB7 csv
*/
if (!defined( 'ABSPATH')) exit;
class CFDB7_Export_CSV{
public function __construct(){
add_filter('cfdb7_csv_delimiter', array($this, 'set_delimiter'));
}
public function set_delimiter( $delimiter ){
$delimiter = get_option('cfdb7_csv_delimiter', ',');
return $delimiter;
}
/**
* Download csv file
* @param String $filename
* @return file
*/
public function download_send_headers( $filename ) {
// disable caching
$now = gmdate("D, d M Y H:i:s");
header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
header("Last-Modified: {$now} GMT");
header("Content-Type: text/csv; charset=UTF-8");
header("Content-Disposition: attachment;filename={$filename}");
// disposition / encoding on response body
header("Content-Disposition: attachment;filename={$filename}");
header("Content-Transfer-Encoding: binary");
}
/**
* Convert array to csv format
* @param array &$array
*/
public function array2csv(array &$array, $df){
if (count($array) == 0) {
return null;
}
$array_keys = array_keys($array);
$heading = array();
$unwanted = array('cfdb7_file', 'cfdb7_', 'your-');
$delimiter = apply_filters('cfdb7_csv_delimiter', ',');
foreach ( $array_keys as $aKeys ) {
if( $aKeys == 'form_date' ) $aKeys = 'Date';
if( $aKeys == 'form_id' ) $aKeys = 'Id';
$tmp = str_replace( $unwanted, '', $aKeys );
$tmp = str_replace( array('-','_'), ' ', $tmp );
$heading[] = ucwords( $tmp );
}
fputs( $df, ( chr(0xEF) . chr(0xBB) . chr(0xBF) ) );
fputcsv( $df, $heading, $delimiter);
foreach ( $array['form_id'] as $line => $form_id ) {
$line_values = array();
foreach($array_keys as $array_key ) {
$val = isset( $array[ $array_key ][ $line ] ) ? $array[ $array_key ][ $line ] : '';
$line_values[ $array_key ] = $val;
}
fputcsv($df, $line_values, $delimiter);
}
}
/**
* Download file
* @return csv file
*/
public function download_csv_file(){
global $wpdb;
$cfdb = apply_filters( 'cfdb7_database', $wpdb );
$table_name = $cfdb->prefix.'db7_forms';
if( isset($_REQUEST['csv']) && isset( $_REQUEST['nonce'] ) ){
$nonce = $_REQUEST['nonce'];
if ( ! wp_verify_nonce( $nonce, 'dnonce')) {
wp_die( 'Not Valid.. Download nonce..!! ' );
}
$fid = (int)$_REQUEST['fid'];
$heading_row = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
WHERE form_post_id = '$fid' ORDER BY form_id DESC LIMIT 1",OBJECT);
$heading_row = reset( $heading_row );
$heading_row = unserialize( $heading_row->form_value, ['allowed_classes' => false] );
$heading_key = array_keys( $heading_row );
$rm_underscore = apply_filters('cfdb7_remove_underscore_data', true);
$total_rows = $cfdb->get_var("SELECT COUNT(*) FROM $table_name WHERE form_post_id = '$fid' ");
$per_query = 1000;
$total_query = ( $total_rows / $per_query );
$this->download_send_headers( "cfdb7-" . date("Y-m-d") . ".csv" );
$df = fopen("php://output", 'w');
ob_start();
for( $p = 0; $p <= $total_query; $p++ ){
$offset = $p * $per_query;
$results = $cfdb->get_results("SELECT form_id, form_value, form_date FROM $table_name
WHERE form_post_id = '$fid' ORDER BY form_id DESC LIMIT $offset, $per_query",OBJECT);
$data = array();
$i = 0;
foreach ($results as $result) :
$i++;
$data['form_id'][$i] = $result->form_id;
$data['form_date'][$i] = $result->form_date;
$resultTmp = unserialize( $result->form_value, ['allowed_classes' => false] );
$upload_dir = wp_upload_dir();
$cfdb7_dir_url = $upload_dir['baseurl'].'/cfdb7_uploads';
foreach ($resultTmp as $key => $value):
$matches = array();
if ( ! in_array( $key, $heading_key ) ) continue;
if( $rm_underscore ) preg_match('/^_.*$/m', $key, $matches);
if( ! empty($matches[0]) ) continue;
$value = str_replace(
array('&quot;','&#039;','&#047;','&#092;'),
array('"',"'",'/','\\'), $value
);
if (strpos($key, 'cfdb7_file') !== false ){
$data[$key][$i] = empty( $value ) ? '' : $cfdb7_dir_url.'/'.$value;
continue;
}
if ( is_array($value) ){
$data[$key][$i] = implode(', ', $value);
continue;
}
$data[$key][$i] = $value;
$data[$key][$i] = $this->escape_data( $data[$key][$i] );
endforeach;
endforeach;
echo $this->array2csv( $data, $df );
}
echo ob_get_clean();
fclose( $df );
die();
}
}
/**
* Escape a string to be used in a CSV context
* @param string $data CSV field to escape.
* @return string
*/
public function escape_data( $data ) {
$active_content_triggers = array( '=', '+', '-', '@', ';' );
if ( in_array( mb_substr( $data, 0, 1 ), $active_content_triggers, true ) ) {
$data = '"'. $data.'"';
}
return $data;
}
}
@@ -0,0 +1,230 @@
<?php
if (!defined('ABSPATH')) {
exit;
}
class CFDB7_Settings
{
private static $instance = null;
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
private function __construct()
{
add_action('admin_menu', array($this, 'register_menu'));
add_action('admin_init', array($this, 'register_settings'));
add_action('admin_enqueue_scripts', array($this, 'admin_assets'));
}
public function admin_assets($hook)
{
if ($hook !== 'contact-forms_page_cfdb7-settings') {
return;
}
wp_enqueue_style(
'cfdb7-settings',
plugins_url('css/settings.css', CFDB7_PLUGIN_FILE),
array(),
'1.4.0'
);
}
public function register_menu()
{
add_submenu_page(
'cfdb7-list.php',
__('CFDB7 Settings', 'contact-form-cfdb7'),
__('Settings', 'contact-form-cfdb7'),
'manage_options',
'cfdb7-settings',
array($this, 'settings_page')
);
}
public function register_settings()
{
register_setting(
'cfdb7_settings',
'cfdb7_csv_delimiter',
array(
'type' => 'string',
'sanitize_callback' => array($this, 'sanitize_delimiter'),
'default' => ',',
)
);
add_settings_section(
'cfdb7_export_section',
__('CSV Export', 'contact-form-cfdb7'),
'__return_false',
'cfdb7_settings'
);
add_settings_field(
'cfdb7_csv_delimiter',
__('Delimiter', 'contact-form-cfdb7'),
array($this, 'delimiter_field'),
'cfdb7_settings',
'cfdb7_export_section'
);
/* Premium Features */
add_settings_section(
'cfdb7_premium_section',
__('Premium Features', 'contact-form-cfdb7'),
'__return_false',
'cfdb7_settings'
);
add_settings_field(
'cfdb7_entry_automation',
__('Entry Automation', 'contact-form-cfdb7'),
array($this, 'entry_automation_field'),
'cfdb7_settings',
'cfdb7_premium_section'
);
add_settings_field(
'cfdb7_pdf_export',
__('PDF Export', 'contact-form-cfdb7'),
array($this, 'pdf_export_field'),
'cfdb7_settings',
'cfdb7_premium_section'
);
add_settings_field(
'cfdb7_csv_import',
__('CSV Import', 'contact-form-cfdb7'),
array($this, 'csv_import_field'),
'cfdb7_settings',
'cfdb7_premium_section'
);
}
public function sanitize_delimiter($value)
{
$allowed = array(',', ';', '|', "\t");
return in_array($value, $allowed, true) ? $value : ',';
}
public function delimiter_field()
{
$value = get_option('cfdb7_csv_delimiter', ',');
$options = array(
',' => __('Comma (,)', 'contact-form-cfdb7'),
';' => __('Semicolon (;)', 'contact-form-cfdb7'),
'|' => __('Pipe (|)', 'contact-form-cfdb7'),
);
?>
<select name="cfdb7_csv_delimiter">
<?php foreach ($options as $delimiter => $label) : ?>
<option value="<?php echo esc_attr($delimiter); ?>" <?php selected($value, $delimiter); ?>>
<?php echo esc_html($label); ?>
</option>
<?php endforeach; ?>
</select>
<?php
}
public function settings_page()
{
?>
<div class="wrap">
<h1><?php esc_html_e('CFDB7 Settings', 'contact-form-cfdb7'); ?></h1>
<form method="post" action="options.php">
<?php
settings_fields('cfdb7_settings');
do_settings_sections('cfdb7_settings');
submit_button();
?>
</form>
</div>
<?php
}
private function premium_feature($title, $description, $url, $installed = false){
?>
<fieldset class="cfdb7-premium-setting">
<label>
<input type="checkbox" disabled <?php checked($installed); ?> />
<strong><?php echo esc_html($title); ?></strong>
</label>
<p class="description">
<?php echo esc_html($description); ?>
</p>
<?php if (!$installed) : ?>
<p style="margin:8px 0;color:#d63638;">
🔒 <?php esc_html_e('Requires the premium add-on.', 'contact-form-cfdb7'); ?>
</p>
<a class="button button-secondary"
target="_blank"
href="<?php echo esc_url($url); ?>">
<?php esc_html_e('Install Add-on', 'contact-form-cfdb7'); ?>
</a>
<?php else : ?>
<span style="color:#00a32a;">
✓ <?php esc_html_e('Installed', 'contact-form-cfdb7'); ?>
</span>
<?php endif; ?>
</fieldset>
<?php
}
public function entry_automation_field(){
$installed = class_exists('CFDB7_Public_Export_CSV');
$this->premium_feature(
__('Automatically export entries', 'contact-form-cfdb7'),
__('Automatically export Contact Form 7 submissions to CSV on schedule or when new entries arrive.', 'contact-form-cfdb7'),
'https://ciphercoin.com/downloads/public-export-csv/',
$installed
);
}
public function pdf_export_field(){
$installed = function_exists('cfdb7_pdf_on_activate');
$this->premium_feature(
__('Export entries as PDF', 'contact-form-cfdb7'),
__('Generate professional PDF reports from Contact Form 7 submissions.', 'contact-form-cfdb7'),
'https://ciphercoin.com/downloads/cfdb7-export-pdf-addon/',
$installed
);
}
public function csv_import_field(){
$installed = class_exists('CFDB7_csv_import_page');
$this->premium_feature(
__('Import CSV into database', 'contact-form-cfdb7'),
__('Import existing CSV files directly into the Contact Form 7 database.', 'contact-form-cfdb7'),
'https://ciphercoin.com/downloads/cfdb7-import-csv-to-database/',
$installed
);
}
}
@@ -0,0 +1,104 @@
=== Database Addon for Contact Form 7 - CFDB7 ===
Contributors: arshidkv12
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
Tags: cf7, contact form 7, contact form 7 db, cf7 database, wpcf7
Requires at least: 4.8
Tested up to: 7.1
Stable tag: 1.4.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Requires PHP: 7.0
Save and manage Contact Form 7 messages. Never lose important data. It is a lightweight contact form 7 database plugin.
== Description ==
The "CFDB7" plugin saves contact form 7 submissions to your WordPress database. Export the data to a CSV file.
By simply installing the plugin, it will automatically begin to capture form submissions from contact form 7.
= Features of CFDB 7 =
* No configuration is needed
* Save Contact Form 7 form submitted data to the database.
* Single database table for all contact form 7 forms
* Easy to use and lightweight plugin
* Developer friendly & easy to customize
* Display all created contact form 7 form list.
* Export CF7 DB (CF7 Database - cf7db) data in CSV file
= Form Email Testing Tool =
* [MailMug - SMTP Sandbox](https://mailmug.net)
= Plugins =
* [PostBox Email Log](https://wordpress.org/plugins/postbox-email-logs/)
* [WP mail smtp](https://wordpress.org/plugins/wp-mail-smtp-mailer/)
= Pro Addons =
* [Entry Automation](https://ciphercoin.com/downloads/public-export-csv/)
Automatically export CFDB7 form entries to CSV on a schedule
* [Advanced MYSQL DB](https://ciphercoin.com/downloads/contact-form-7-column-base-mysql-database-addon/)
Separate MySQL column for each cf7 input field
* [Excel Spreadsheet (XLSX) Extension](https://ciphercoin.com/downloads/excel-xlsx-spreadsheet/)
Connect CFDB7 to an external database or another DB
* [Drag & Drop File Upload](https://ciphercoin.com/downloads/filedrop-contact-form-7/)
Contact form 7 drag and drop files upload plugin.
* [Already Submitted?](https://ciphercoin.com/downloads/cfdb7-unique-field/)
Trigger error if a field is already submitted
* [Popup Message](https://ciphercoin.com/downloads/cf7-popup-message/)
Replace your validation and success messages with beautiful popup messages to attract visitors.
* [Export PDF File](https://ciphercoin.com/downloads/cfdb7-export-pdf-addon/)
Easy to export contact forms from database to PDF file
* [Import CSV to Database](https://ciphercoin.com/downloads/cfdb7-import-csv-to-database/)
Import data from the CSV file to the CFDB7 database
Support : [http://www.ciphercoin.com/contact/](https://www.ciphercoin.com/contact/)
Extensions : [Contact form 7 more Add-ons](https://ciphercoin.com/contact-form-7-database-cfdb7-add-ons/)
== Frequently Asked Questions ==
= 1. How do you change the CSV delimiter to a semicolon? =
To change the CSV delimiter to a semicolon, go to WP Admin > Contact Forms > Settings, select "Semicolon (;)" from the Delimiter dropdown, and save your changes.
== Installation ==
1. Download and extract plugin files to a wp-content/plugin directory.
2. Activate the plugin through the WordPress admin interface.
3. Done!
== Screenshots ==
1. Admin
== Changelog ==
= 1.4.0 =
Settings page is added
= 1.3.6 =
New hooks added
= 1.3.3 =
Security improvements
= 1.3.2 =
Added esc_html
= 1.3.1 =
Changed the text
= 1.3.0 =
Hooks are modified
= 1.2.10 =
Fixed csv header issues
= 1.2.9 =
Changed csv delimiter to comma with filter
= 1.2.8 =
Changed csv delimiter to semicolon