| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Custom Contact Forms |
| 4 |
* Plugin URI: https://customformspro.com/ |
| 5 |
* Description: Build beautiful custom forms and manage submissions the WordPress way. Gutenberg block, Cloudflare Turnstile, anti-spam protection, and email diagnostics. |
| 6 |
* Author: Dmitry Alexander |
| 7 |
* Version: 7.16.1 |
| 8 |
* Text Domain: custom-contact-forms |
| 9 |
* Domain Path: /languages |
| 10 |
* Author URI: https://oiopublisher.com/ |
| 11 |
* Requires PHP: 7.4 |
| 12 |
* Requires at least: 5.0 |
| 13 |
* License: GPLv2 or later |
| 14 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 15 |
* |
| 16 |
* Copyright 2013-2018 Taylor Lovett |
| 17 |
* Copyright 2026 Dmitry Alexander |
| 18 |
* |
| 19 |
* Originally developed by Taylor Lovett. Now maintained by Dmitry Alexander. |
| 20 |
*/ |
| 21 |
|
| 22 |
if ( ! defined( 'ABSPATH' ) ) { |
| 23 |
exit; |
| 24 |
} |
| 25 |
|
| 26 |
define( 'CCF_VERSION', '7.16.1' ); |
| 27 |
define( 'CCF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 28 |
define( 'CCF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 29 |
|
| 30 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-constants.php'; |
| 31 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-custom-contact-forms.php'; |
| 32 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-form-cpt.php'; |
| 33 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-submission-cpt.php'; |
| 34 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-form-mail.php'; |
| 35 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-field-cpt.php'; |
| 36 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-choice-cpt.php'; |
| 37 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-form-manager.php'; |
| 38 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-field-renderer.php'; |
| 39 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-form-renderer.php'; |
| 40 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-form-handler.php'; |
| 41 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-upgrader.php'; |
| 42 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-widget.php'; |
| 43 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-export.php'; |
| 44 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-ads.php'; |
| 45 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-settings.php'; |
| 46 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-gutenberg-block.php'; |
| 47 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-turnstile.php'; |
| 48 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-anti-spam.php'; |
| 49 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-email-logger.php'; |
| 50 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-csv-importer.php'; |
| 51 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-form-templates.php'; |
| 52 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-importer.php'; |
| 53 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-importer-cf7.php'; |
| 54 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-importer-wpforms.php'; |
| 55 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-form-importer-admin.php'; |
| 56 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-review-request.php'; |
| 57 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-feedback.php'; |
| 58 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-pro-notice.php'; |
| 59 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-dashboard-widget.php'; |
| 60 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-pro-modal.php'; |
| 61 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-ai-form-builder.php'; |
| 62 |
require_once CCF_PLUGIN_DIR . 'classes/class-ccf-ai-admin.php'; |
| 63 |
|
| 64 |
CCF_Custom_Contact_Forms::factory(); |
| 65 |
CCF_Constants::factory(); |
| 66 |
CCF_Form_CPT::factory(); |
| 67 |
CCF_Submission_CPT::factory(); |
| 68 |
CCF_Field_CPT::factory(); |
| 69 |
CCF_Choice_CPT::factory(); |
| 70 |
CCF_Form_Manager::factory(); |
| 71 |
CCF_Pro_Notice::factory(); |
| 72 |
CCF_Dashboard_Widget::factory(); |
| 73 |
|
| 74 |
// Only ever surfaces on WordPress 7.0+ with an AI provider configured; the |
| 75 |
// class checks for itself and stays invisible otherwise. |
| 76 |
if ( is_admin() ) { |
| 77 |
CCF_AI_Admin::factory(); |
| 78 |
CCF_Pro_Modal::factory(); |
| 79 |
} |
| 80 |
CCF_Form_Renderer::factory(); |
| 81 |
CCF_Field_Renderer::factory(); |
| 82 |
CCF_Form_Handler::factory(); |
| 83 |
CCF_Upgrader::factory(); |
| 84 |
CCF_Export::factory(); |
| 85 |
CCF_Ads::factory(); |
| 86 |
CCF_Settings::factory(); |
| 87 |
CCF_Gutenberg_Block::factory(); |
| 88 |
CCF_Turnstile::factory(); |
| 89 |
CCF_Anti_Spam::factory(); |
| 90 |
CCF_Email_Logger::factory(); |
| 91 |
CCF_CSV_Importer::factory(); |
| 92 |
CCF_Form_Templates::factory(); |
| 93 |
CCF_Form_Importer_Admin::factory(); |
| 94 |
CCF_Review_Request::factory(); |
| 95 |
CCF_Feedback::factory(); |
| 96 |
|
| 97 |
/** |
| 98 |
* Setup the widget |
| 99 |
* |
| 100 |
* @since 6.4 |
| 101 |
*/ |
| 102 |
function ccf_register_widget() { |
| 103 |
register_widget( 'CCF_Widget' ); |
| 104 |
} |
| 105 |
add_action( 'widgets_init', 'ccf_register_widget' ); |
| 106 |
|
| 107 |
/** |
| 108 |
* Flush the rewrites at the end of init after the plugin has been activated. |
| 109 |
* |
| 110 |
* @since 6.0 |
| 111 |
*/ |
| 112 |
function ccf_flush_rewrites() { |
| 113 |
update_option( 'ccf_flush_rewrites', true ); |
| 114 |
} |
| 115 |
|
| 116 |
/** |
| 117 |
* Upgrade CCF DB information |
| 118 |
* |
| 119 |
* @since 7.1 |
| 120 |
*/ |
| 121 |
/** |
| 122 |
* Build the Pro upgrade URL, tagged so its source is identifiable in analytics. |
| 123 |
* |
| 124 |
* Every prompt in the plugin previously linked to the same bare URL, so a |
| 125 |
* click from the deactivation survey and a click from the form builder were |
| 126 |
* indistinguishable once they arrived — there was no way to learn which |
| 127 |
* prompts actually work. The tag travels in the URL only; nothing is sent |
| 128 |
* anywhere from the user's site. |
| 129 |
* |
| 130 |
* @param string $source Short identifier for the prompt, e.g. 'form-builder'. |
| 131 |
* @param string $path Optional path on the site. |
| 132 |
* @return string |
| 133 |
*/ |
| 134 |
function ccf_pro_url( $source, $path = '/' ) { |
| 135 |
$url = 'https://customformspro.com' . $path; |
| 136 |
|
| 137 |
$url = add_query_arg( |
| 138 |
array( |
| 139 |
'utm_source' => 'ccf-free', |
| 140 |
'utm_medium' => 'plugin', |
| 141 |
'utm_campaign' => 'pro', |
| 142 |
'utm_content' => sanitize_key( $source ), |
| 143 |
), |
| 144 |
$url |
| 145 |
); |
| 146 |
|
| 147 |
/** |
| 148 |
* Filter the Pro upgrade URL. |
| 149 |
* |
| 150 |
* @param string $url Tagged URL. |
| 151 |
* @param string $source Prompt identifier. |
| 152 |
*/ |
| 153 |
return apply_filters( 'ccf_pro_upgrade_url', $url, $source ); |
| 154 |
} |
| 155 |
|
| 156 |
function ccf_upgrade() { |
| 157 |
$version = get_option( 'ccf_db_version' ); |
| 158 |
|
| 159 |
if ( empty( $version ) || version_compare( $version, '7.1', '<' ) ) { |
| 160 |
CCF_Upgrader::factory()->notifications_upgrade_71(); |
| 161 |
} |
| 162 |
|
| 163 |
update_option( 'ccf_db_version', '7.9' ); |
| 164 |
} |
| 165 |
|
| 166 |
register_activation_hook( __FILE__, 'ccf_flush_rewrites' ); |
| 167 |
register_activation_hook( __FILE__, 'ccf_upgrade' ); |
| 168 |
|