ws-form.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * WS Form LITE - Drag & Drop Contact Form Builder |
| 5 | * |
| 6 | * @link https://wsform.com/ |
| 7 | * @since 1.0.0 |
| 8 | * @package WS_Form |
| 9 | * |
| 10 | * @wordpress-plugin |
| 11 | * Plugin Name: WS Form LITE - Drag & Drop Contact Form Builder |
| 12 | * Plugin URI: https://wsform.com/ |
| 13 | * Description: Smart. Fast. Forms. |
| 14 | * Version: 1.12.3 |
| 15 | * Requires at least: 5.5 |
| 16 | * Requires PHP: 7.2 |
| 17 | * Author: WS Form |
| 18 | * Author URI: https://wsform.com/ |
| 19 | * License: GPL-3.0+ |
| 20 | * License URI: http://www.gnu.org/licenses/gpl-3.0.txt |
| 21 | * Text Domain: ws-form |
| 22 | * Domain Path: /languages |
| 23 | */ |
| 24 | |
| 25 | // If this file is called directly, abort. |
| 26 | if(!defined('WPINC')) { |
| 27 | |
| 28 | die; |
| 29 | } |
| 30 | |
| 31 | // Load plugin.php |
| 32 | if(!function_exists('is_plugin_active')) { |
| 33 | |
| 34 | include_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
| 35 | } |
| 36 | |
| 37 | if(!is_plugin_active('ws-form-pro/ws-form.php')) { |
| 38 | // Constants |
| 39 | define('WS_FORM_NAME', 'ws-form'); |
| 40 | define('WS_FORM_VERSION', '1.12.3'); |
| 41 | define('WS_FORM_NAME_GENERIC', 'WS Form'); |
| 42 | define('WS_FORM_NAME_PRESENTABLE', 'WS Form LITE'); |
| 43 | define('WS_FORM_EDITION', 'basic'); |
| 44 | define('WS_FORM_PLUGIN_FOLDER', 'ws-form'); |
| 45 | define('WS_FORM_URL_HOME', 'https://wordpress.org/plugins/ws-form/'); |
| 46 | define('WS_FORM_URL_DOWNLOAD', 'https://downloads.wordpress.org/plugin/ws-form.zip'); |
| 47 | define('WS_FORM_UPLOAD_DIR', 'ws-form'); |
| 48 | define('WS_FORM_IDENTIFIER', 'ws_form'); |
| 49 | define('WS_FORM_DB_TABLE_PREFIX', 'wsf_'); |
| 50 | define('WS_FORM_OPTION_NAME', 'ws_form'); |
| 51 | define('WS_FORM_OPTION_SEPARATE_ACTION', false); |
| 52 | define('WS_FORM_OPTION_SEPARATE_CSS', true); |
| 53 | define('WS_FORM_OPTION_SEPARATE_TRANSLATE', true); |
| 54 | define('WS_FORM_SHORTCODE', 'ws_form'); |
| 55 | define('WS_FORM_WIDGET', 'ws_form_widget'); |
| 56 | define('WS_FORM_CAPABILITY_PREFIX', 'wsf_'); |
| 57 | define('WS_FORM_USER_REQUEST_IDENTIFIER', 'ws-form'); |
| 58 | define('WS_FORM_AUTHOR', 'Westguard Solutions'); |
| 59 | |
| 60 | // Paths |
| 61 | define('WS_FORM_PLUGIN_ROOT_FILE', __FILE__); |
| 62 | define('WS_FORM_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__)); |
| 63 | define('WS_FORM_PLUGIN_DIR_URL', plugin_dir_url(__FILE__)); |
| 64 | define('WS_FORM_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 65 | |
| 66 | // NONCE |
| 67 | define('WS_FORM_POST_NONCE_FIELD_NAME', 'wsf_nonce'); |
| 68 | define('WS_FORM_POST_NONCE_ACTION_NAME', 'wsf_post'); |
| 69 | |
| 70 | // REST API |
| 71 | define('WS_FORM_RESTFUL_NAMESPACE', 'ws-form/v1'); |
| 72 | |
| 73 | // Framework |
| 74 | define('WS_FORM_DEFAULT_FRAMEWORK', 'ws-form'); |
| 75 | |
| 76 | // caniuse.com |
| 77 | define('WS_FORM_COMPATIBILITY_NAME', 'caniuse.com'); |
| 78 | define('WS_FORM_COMPATIBILITY_URL', 'https://caniuse.com'); |
| 79 | define('WS_FORM_COMPATIBILITY_MASK', 'https://caniuse.com/#feat=#compatibility_id'); |
| 80 | |
| 81 | // Captchas / Spam |
| 82 | define('WS_FORM_RECAPTCHA_ENDPOINT', 'https://www.google.com/recaptcha/api/siteverify'); |
| 83 | define('WS_FORM_RECAPTCHA_QUERY_VAR', 'g-recaptcha-response'); |
| 84 | define('WS_FORM_HCAPTCHA_ENDPOINT', 'https://hcaptcha.com/siteverify'); |
| 85 | define('WS_FORM_HCAPTCHA_QUERY_VAR', 'h-captcha-response'); |
| 86 | define('WS_FORM_TURNSTILE_ENDPOINT', 'https://challenges.cloudflare.com/turnstile/v0/siteverify'); |
| 87 | define('WS_FORM_TURNSTILE_QUERY_VAR', 'cf-turnstile-response'); |
| 88 | define('WS_FORM_CAPTCHAFOX_ENDPOINT', 'https://api.captchafox.com/siteverify'); |
| 89 | define('WS_FORM_CAPTCHAFOX_QUERY_VAR', 'cf-captcha-response'); |
| 90 | define('WS_FORM_SPAM_LEVEL_MAX', 100); // 0 = Not spam, 100 = Spam |
| 91 | |
| 92 | // Labels |
| 93 | define('WS_FORM_LABEL_MAX_LENGTH', 1024); |
| 94 | |
| 95 | // Sections |
| 96 | define('WS_FORM_SECTION_REPEATABLE_DELIMITER_SECTION', ','); |
| 97 | define('WS_FORM_SECTION_REPEATABLE_DELIMITER_ROW', ';'); |
| 98 | define('WS_FORM_SECTION_REPEATABLE_DELIMITER_SUBMIT', '<br />'); |
| 99 | |
| 100 | // Fields |
| 101 | define('WS_FORM_FIELD_PREFIX', 'field_'); |
| 102 | define('WS_FORM_FIELD_PREFIX_PUBLIC_', 'wsf_field_'); |
| 103 | |
| 104 | // Settings - Email |
| 105 | define('WS_FORM_SETTINGS_IMAGE_PREVIEW_SIZE', 'full'); |
| 106 | |
| 107 | // Settings - System |
| 108 | define('WS_FORM_MIN_VERSION_WORDPRESS', '5.5'); |
| 109 | define('WS_FORM_MIN_VERSION_PHP', '7.2'); |
| 110 | define('WS_FORM_MIN_VERSION_MYSQL', '5.6'); |
| 111 | define('WS_FORM_MIN_INPUT_VARS', 100); |
| 112 | define('WS_FORM_MAX_MYSQL_ALLOWED_PACKET', 4194304); |
| 113 | |
| 114 | // wp_remote_* settings |
| 115 | define('WS_FORM_API_CALL_TIMEOUT', 15); |
| 116 | define('WS_FORM_API_CALL_SSL_VERIFY', true); |
| 117 | |
| 118 | // Review nag |
| 119 | define('WS_FORM_REVIEW_NAG_DURATION', 14); |
| 120 | |
| 121 | // Data sources |
| 122 | define('WS_FORM_DATA_SOURCE_SCHEDULE_ID_PREFIX', 'wsf_'); |
| 123 | define('WS_FORM_DATA_SOURCE_SCHEDULE_HOOK', 'ws_form_wp_cron_data_source'); |
| 124 | |
| 125 | // Reports |
| 126 | define('WS_FORM_REPORT_SCHEDULE_HOOK', 'ws_form_wp_cron_report'); |
| 127 | define('WS_FORM_REPORT_ID_FORM_STATISTICS', 'ws_form_form_statistics'); |
| 128 | |
| 129 | // CSV imports for data grids |
| 130 | define('WS_FORM_UTF32_BIG_ENDIAN_BOM' , chr(0x00) . chr(0x00) . chr(0xFE) . chr(0xFF)); |
| 131 | define('WS_FORM_UTF32_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE) . chr(0x00) . chr(0x00)); |
| 132 | define('WS_FORM_UTF16_BIG_ENDIAN_BOM' , chr(0xFE) . chr(0xFF)); |
| 133 | define('WS_FORM_UTF16_LITTLE_ENDIAN_BOM', chr(0xFF) . chr(0xFE)); |
| 134 | define('WS_FORM_UTF8_BOM' , chr(0xEF) . chr(0xBB) . chr(0xBF)); |
| 135 | |
| 136 | // Templates |
| 137 | define('WS_FORM_TEMPLATE_SVG_WIDTH_FORM', 140); |
| 138 | define('WS_FORM_TEMPLATE_SVG_HEIGHT_FORM', 180); |
| 139 | define('WS_FORM_TEMPLATE_SVG_WIDTH_SECTION', 140); |
| 140 | define('WS_FORM_TEMPLATE_SVG_HEIGHT_SECTION', 85); |
| 141 | define('WS_FORM_TEMPLATE_CHECKSUM_REPAIR', false); |
| 142 | |
| 143 | // Collapse settings/template integrations under Integrations when count exceeds this |
| 144 | define('WS_FORM_INTEGRATIONS_COLLAPSE_THRESHOLD', 5); |
| 145 | |
| 146 | // Submission exports |
| 147 | define('WS_FORM_SUBMIT_EXPORT_PAGE_SIZE', 200); |
| 148 | define('WS_FORM_SUBMIT_EXPORT_FILE_SIZE_ZIP', 524288); |
| 149 | define('WS_FORM_SUBMIT_EXPORT_TMP_DIR', 'submit/export/tmp'); |
| 150 | |
| 151 | // File uploads |
| 152 | define('WS_FORM_DROPZONEJS_IMAGE_SIZE', 'thumbnail'); |
| 153 | |
| 154 | // Styler / CSS |
| 155 | define('WS_FORM_STYLER', true); |
| 156 | define('WS_FORM_CSS_CACHE_DURATION_DEFAULT', 31536000); |
| 157 | define('WS_FORM_CSS_FILE_PATH', 'css/public'); |
| 158 | define('WS_FORM_CSS_SKIN_DEFAULT', 'ws_form'); |
| 159 | |
| 160 | // AI |
| 161 | define('WS_FORM_ABILITY_API', true); |
| 162 | define('WS_FORM_ABILITY_API_NAMESPACE', 'ws-form/'); |
| 163 | define('WS_FORM_MCP_ADAPTER', true); |
| 164 | define('WS_FORM_ANGIE', true); |
| 165 | define('WS_FORM_WP_AI_CLIENT', true); |
| 166 | |
| 167 | // Resizable sidebar (layout editor) |
| 168 | define('WS_FORM_SIDEBAR_WIDTH_MIN', 400); |
| 169 | define('WS_FORM_SIDEBAR_WIDTH_MAX', 1000); |
| 170 | define('WS_FORM_SIDEBAR_WIDTH_DEFAULT', 400); |
| 171 | |
| 172 | // Resizable sidebar (submissions) |
| 173 | define('WS_FORM_SIDEBAR_WIDTH_MIN_SUBMIT', 350); |
| 174 | define('WS_FORM_SIDEBAR_WIDTH_MAX_SUBMIT', 1000); |
| 175 | define('WS_FORM_SIDEBAR_WIDTH_DEFAULT_SUBMIT', 350); |
| 176 | } |
| 177 | |
| 178 | function ws_form_activate() { |
| 179 | |
| 180 | if(is_plugin_active('ws-form-pro/ws-form.php')) { |
| 181 | |
| 182 | deactivate_plugins('ws-form-pro/ws-form.php'); |
| 183 | } |
| 184 | |
| 185 | require_once WS_FORM_PLUGIN_DIR_PATH . 'includes/class-ws-form-activator.php'; |
| 186 | WS_Form_Activator::activate(); |
| 187 | } |
| 188 | |
| 189 | // Deactivate |
| 190 | function ws_form_deactivate() { |
| 191 | |
| 192 | require_once WS_FORM_PLUGIN_DIR_PATH . 'includes/class-ws-form-deactivator.php'; |
| 193 | WS_Form_Deactivator::deactivate(); |
| 194 | } |
| 195 | |
| 196 | // Uninstall |
| 197 | function ws_form_uninstall() { |
| 198 | |
| 199 | require_once WS_FORM_PLUGIN_DIR_PATH . 'includes/class-ws-form-uninstaller.php'; |
| 200 | WS_Form_Uninstaller::uninstall(); |
| 201 | } |
| 202 | |
| 203 | // Register hooks for plugin activation, deactivation and uninstall |
| 204 | register_activation_hook(__FILE__, 'ws_form_activate'); |
| 205 | register_deactivation_hook(__FILE__, 'ws_form_deactivate'); |
| 206 | register_uninstall_hook(__FILE__, 'ws_form_uninstall'); |
| 207 | |
| 208 | if(!is_plugin_active('ws-form-pro/ws-form.php')) { |
| 209 | |
| 210 | require WS_FORM_PLUGIN_DIR_PATH . 'includes/class-ws-form.php'; |
| 211 | |
| 212 | function ws_form_run() { |
| 213 | |
| 214 | $plugin = new WS_Form(); |
| 215 | $plugin->run(); |
| 216 | } |
| 217 | ws_form_run(); |
| 218 | } |
| 219 |