Changeset 3339262
- Timestamp:
- 08/04/2025 08:46:57 PM (7 months ago)
- Location:
- clean-and-simple-contact-form-by-meg-nicholas
- Files:
-
- 6 added
- 36 edited
- 1 copied
-
tags/4.11 (copied) (copied from clean-and-simple-contact-form-by-meg-nicholas/trunk)
-
tags/4.11/ajax.php (modified) (1 diff)
-
tags/4.11/changelog.txt (modified) (3 diffs)
-
tags/4.11/class.cscf.php (modified) (2 diffs)
-
tags/4.11/class.cscf_contact.php (modified) (8 diffs)
-
tags/4.11/class.cscf_pluginsettings.php (modified) (1 diff)
-
tags/4.11/class.cscf_rest_api.php (added)
-
tags/4.11/class.cscf_settings.php (modified) (4 diffs)
-
tags/4.11/clean-and-simple-contact-form-by-meg-nicholas.php (modified) (4 diffs)
-
tags/4.11/js/jquery.validate.contact.form.js (modified) (3 diffs)
-
tags/4.11/languages/clean-and-simple-contact-form-by-meg-nicholas-pl_PL.po (modified) (16 diffs)
-
tags/4.11/languages/clean-and-simple-contact-form-by-meg-nicholas.pot (modified) (7 diffs)
-
tags/4.11/readme.txt (modified) (5 diffs)
-
tags/4.11/shortcodes/contact-form.php (modified) (1 diff)
-
tags/4.11/vendor/alanef/free_plugin_lib/.gitattributes (added)
-
tags/4.11/vendor/autoload.php (modified) (1 diff)
-
tags/4.11/vendor/composer/InstalledVersions.php (modified) (5 diffs)
-
tags/4.11/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/4.11/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/4.11/vendor/composer/installed.php (modified) (2 diffs)
-
tags/4.11/vendor/composer/installers/.gitignore (added)
-
tags/4.11/vendor/composer/platform_check.php (modified) (1 diff)
-
trunk/ajax.php (modified) (1 diff)
-
trunk/changelog.txt (modified) (3 diffs)
-
trunk/class.cscf.php (modified) (2 diffs)
-
trunk/class.cscf_contact.php (modified) (8 diffs)
-
trunk/class.cscf_pluginsettings.php (modified) (1 diff)
-
trunk/class.cscf_rest_api.php (added)
-
trunk/class.cscf_settings.php (modified) (4 diffs)
-
trunk/clean-and-simple-contact-form-by-meg-nicholas.php (modified) (4 diffs)
-
trunk/js/jquery.validate.contact.form.js (modified) (3 diffs)
-
trunk/languages/clean-and-simple-contact-form-by-meg-nicholas-pl_PL.po (modified) (16 diffs)
-
trunk/languages/clean-and-simple-contact-form-by-meg-nicholas.pot (modified) (7 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/shortcodes/contact-form.php (modified) (1 diff)
-
trunk/vendor/alanef/free_plugin_lib/.gitattributes (added)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (5 diffs)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/vendor/composer/installers/.gitignore (added)
-
trunk/vendor/composer/platform_check.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/ajax.php
r2551686 r3339262 14 14 if ( $result['valid'] ) { 15 15 $result['sent'] = $contact->SendMail(); 16 17 // Action hook for AJAX form submission 18 if ( $result['sent'] ) { 19 do_action( 'cscf_form_submitted_ajax', $contact ); 20 } 16 21 } 17 22 -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/changelog.txt
r3146820 r3339262 1 = 4.11 = 2 * Added REST API support for headless WordPress implementations 3 - New endpoint at /wp-json/cscf/v1/submit with authentication 4 - Configurable user capability requirements 5 - Full form validation (excluding reCAPTCHA for authenticated requests) 6 * Added SMTP configuration via wp-config constants 7 - Support for all major email services (Gmail, SendGrid, Mailgun, etc.) 8 - Useful for development with tools like Mailpit 9 - No UI needed - server-level configuration 10 * Added developer hooks for extensibility 11 - Action hooks: cscf_before_send_email, cscf_after_send_email, cscf_form_submitted (plus type-specific variants) 12 - Filter hook: cscf_form_data for REST API data modification 13 * Added comprehensive developer documentation 14 - Hooks and filters guide with examples 15 - REST API implementation guide 16 - SMTP configuration guide 17 * Improved extensibility for third-party integrations (CRMs, webhooks, mailing lists) 18 * Improved phone number validation 19 - Now validates format (only allows digits, +, (), -, and spaces) 20 - Format validation applies even when phone field is optional 21 - Fixed bug where phone validation error used wrong error key 22 * Improved form validation user experience 23 - reCAPTCHA validation now skipped if other form errors exist 24 - Prevents users from being blocked by reCAPTCHA when fixing validation errors 25 * Fixed JavaScript bugs 26 - Fixed server-side validation errors not displaying when using AJAX submission 27 - Fixed jQuery selector looking for div instead of span elements for error display 28 - Fixed deprecated jQuery .selector usage for jQuery 3.0+ compatibility 29 * Added comprehensive unit tests for form validation 30 * Removed deprecated load_plugin_textdomain() function - WordPress handles translations automatically since v4.6 31 32 = 4.10 = 33 * Added opt in 34 * Added code to comply with current plugin guidelines 35 1 36 = 4.9.1 = 2 * corrected link markup in settings pag 37 * corrected link markup in settings page 3 38 4 39 = 4.9 = … … 45 80 46 81 = 4.7.1 = 47 * Tested with Word press version 5.382 * Tested with WordPress version 5.3 48 83 Fixed XSS vulnerability in GDPR consent message 49 84 = 4.7.0 = 50 * Tested with Word press version 4.9.685 * Tested with WordPress version 4.9.6 51 86 * Added consent to contact checkbox for GDPR compliance 52 87 = 4.6.2 = … … 167 202 = 4.1.2 = 168 203 * Added some FAQs 169 * Added alternative shortcode [cscf-contact-form] for use when conflicts could occur. 170 * Updated the documentation. 171 * Recaptcha form now responds to language changes 172 * Updated pot file to reflect new name space 173 * Changed name space from cff to cscf 174 * Settings screen: recaptcha theme and key inputs are immediately enabled/disabled as the 'Use reCAPTCHA' box is clicked. 175 * Corrected some html seen as invalid by http://validator.w3.org/ 176 * removed '<?=' and replaced with '<?php echo' in cscf_settings, thanks go to andrewbacon 177 * Added notice to setting screen when JetPack's contact form is active 178 * Fixed problem where 'Please enter a valid email address' was not translating in the 'confirm email address' input 179 = 4.1.1 = 180 * Fixed potential conflicts with themes that use bootstrap 181 * Enabled internationalisation, this plugin will now work with multiple languages 182 * Added German translation file for my German friends, thanks to faktorzweinet for the translation 183 = 4.1.0 = 184 * Fixed a bug in class.cff_settings.php where php opening tag had got missed off. This problem caused the settings screen not to display correctly but only occurred with some versions of php. Please upgrade if you have this problem. 185 = 4.0.9 = 186 * Switched header argument of wp_mail over to a filter to remove any potential conflicts with other emailing plugins or themes 187 * The ability to set a different recipient email address. Previously all email was sent to the WordPress administrator email address. 188 * Allow the email subject to be customised. 189 = 4.0.8 = 190 * Fixed a bug: When using reCAPTCHA ajax did not work. 191 * Fixed a bug: Ajax validation was not checking email address were equal (server side was doing it instead) 192 * Improvement: Ajax now works better. 193 * Documentation update: nicer links (worked how to do them in markdown!), changelog and upgrade notice sections now correctly formatted. 194 = 4.0.7 = 195 * Fixed a bug: Plugin name is actually clean-and-simple-contact-form now (not contact-form) but this new name needed to be updated in the plugin settings definitions. I also needed to rename contact-form.php to clean-and-simple-contact-form.php. My thanks to Jakub for finding this bug. 196 * If your webpage is ssl then reCAPTCHA will now also use ssl mode. 197 198 199 == Upgrade Notice == 200 = 4.7.0 = 201 Tested with Wordpress version 4.9.6. Added 'consent to contact' GDPR compliance message 202 = 4.6.2 = 203 Updated translations. Tested up to WordPress 4.6.1. 204 = 4.6.0 = 205 Updated translations. Correct textdomain. Prevent multiple clicks. 206 = 4.5.1 = 207 Translation updates 208 = 4.5.0 = 209 Added support for Google Recaptcha2. Updated translation. Fixed layout bug. 210 = 4.4.4 = 211 Added languages, css fix for twenty fifteen theme, remove 'notice' errors, remove empty divs 212 = 4.4.3 = 213 Tested up to 4.1 214 = 4.4.2 = 215 Akismet tweak and translation updates 216 = 4.4.1 = 217 Fixed XSS issue 218 = 4.4.0 = 219 Added option for enquiry to email themselves a copy of the message plus Polish translation updated 220 = 4.3.4 = 221 Email now includes page url of contact form, removed link in main contact form view 222 = 4.3.3 = 223 Hebrew Language added, name field moved to top of form, added 'reply-to' 224 = 4.3.2 = 225 Added Norwegian and Brazilian Portugese Translations 226 = 4.3.1 = 227 Checked compatibility with WP 3.8 and TwentyFourteen theme, translation updates, defaults for new installations 228 = 4.3.0 = 229 Contact form is now filtered for spam when the Akismet plugin is present. 230 [Learn more](http://www.megnicholas.co.uk/articles/contact-form-plugin-can-detect-spam/ "Learn More"). 231 = 4.2.5 = 232 Small bug fix 233 = 4.2.4 = 234 'Confirm Email' can now be turned off. Arabic translation added. 235 = 4.2.3 = 236 Multiple recipients are now possible 237 = 4.2.2 = 238 Remove ALL possibility of conflicts with other plugins that also include Google reCAPTCHA library 239 = 4.2.1 = 240 Translation and housekeeping updates 241 = 4.2.0 = 242 Translation and documentation updates 243 = 4.1.9 = 244 Support for [Bootstrap 3](http://www.megnicholas.co.uk/articles/version-4-1-9-supports-bootstrap-3/ "More information on 4.1.9") 245 = 4.1.8 = 246 Added Russian translation and some modifications to Estonian and Spanish translations 247 = 4.1.7 248 More translations. A helpful note about the short code to use has been put on the settings screen 249 = 4.1.6 = 250 Ability to specify a 'From' address. This email will be used to send the mail instead of the form filler's email address. 251 = 4.1.5 = 252 Works with themes that pre-process the html. 253 = 4.1.4 = 254 New translations - Slovak and Catalan 255 = 4.1.3 = 256 Form now submits via ajax! 257 = 4.1.2 = 258 Alternative shortcode, recaptcha internationalisation, Jetpack conflict warning notice 259 = 4.1.1 = 260 Internationalisation, fixed conflict with some bootstrapped themes. 261 = 4.1.0 = 262 Please upgrade if your settings screen is not displaying. 263 = 4.0.9 = 264 More customisation: recipient email address, and email subject. 265 = 4.0.8 = 266 Ajax now works when your form has reCAPTCHA on it. Ajax validation is now cleaner. 267 = 4.0.7 = 268 Fixed a bug which occurred when plugin name was changed. reCAPTCHA will now use ssl if your webpage is ssl. 204 * Added alternative shortcode -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/class.cscf.php
r3254319 r3339262 21 21 $this, 22 22 'RegisterAdminStyles', 23 ) );24 25 add_action( 'init', array(26 $this,27 'RegisterTextDomain',28 23 ) ); 29 24 … … 44 39 //create the settings page 45 40 $settings = new cscf_settings(); 46 }47 48 49 function RegisterTextDomain() {50 //$path = CSCF_PLUGIN_DIR . '/languages';51 $path = '/' . CSCF_PLUGIN_NAME . '/languages';52 load_plugin_textdomain( 'clean-and-simple-contact-form-by-meg-nicholas', false, $path );53 41 } 54 42 -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/class.cscf_contact.php
r3254319 r3339262 19 19 var $PostID; 20 20 var $IsSpam; 21 var $IsRestApi = false; 21 22 22 23 function __construct() { … … 28 29 } 29 30 $request_method = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD']??'' ) ); 30 if ( $request_method === 'POST' ) {31 if ( $request_method === 'POST' && ! $this->IsRestApi ) { 31 32 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- No action, nonce is not required for $_POST['cscf_nonce'] check later, array sanitized 32 33 if ( isset( $_POST['cscf'] ) ) { … … 73 74 } 74 75 76 /** 77 * Set contact data from array (used by REST API) 78 * 79 * @param array $data Contact form data 80 * @param int $post_id Post ID where form was submitted from 81 * @param bool $is_rest_api Whether this is a REST API request 82 */ 83 public function set_from_array( $data, $post_id = null, $is_rest_api = false ) { 84 $this->IsRestApi = $is_rest_api; 85 86 // Filter to allow modification of form data before processing 87 $data = apply_filters( 'cscf_form_data', $data, $post_id, $is_rest_api ); 88 89 if ( isset( $data['name'] ) ) { 90 $this->Name = sanitize_text_field( $data['name'] ); 91 } 92 if ( isset( $data['email'] ) ) { 93 $this->Email = sanitize_email( $data['email'] ); 94 } 95 if ( isset( $data['confirm-email'] ) ) { 96 $this->ConfirmEmail = sanitize_email( $data['confirm-email'] ); 97 } 98 if ( isset( $data['email-sender'] ) ) { 99 $this->EmailToSender = $data['email-sender'] ? true : false; 100 } 101 if ( isset( $data['message'] ) ) { 102 $this->Message = sanitize_textarea_field( $data['message'] ); 103 } 104 if ( isset( $data['phone-number'] ) ) { 105 $this->PhoneNumber = sanitize_text_field( $data['phone-number'] ); 106 } 107 if ( isset( $data['contact-consent'] ) ) { 108 $this->ContactConsent = $data['contact-consent'] ? true : false; 109 } 110 if ( $post_id !== null ) { 111 $this->PostID = absint( $post_id ); 112 } 113 } 114 75 115 public function IsValid() { 76 116 $this->Errors = array(); 77 117 $request_method = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD']??'' ) ); 78 if ( $request_method !== 'POST' ) {118 if ( $request_method !== 'POST' && ! $this->IsRestApi ) { 79 119 return false; 80 120 } 81 121 82 //check nonce 83 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- No action, not stored just a nonce check 84 if ( ! wp_verify_nonce( $_POST['cscf_nonce'] ?? '', 'cscf_contact' ) ) { 85 return false; 122 //check nonce (skip for REST API as it uses WordPress authentication) 123 if ( ! $this->IsRestApi ) { 124 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- No action, not stored just a nonce check 125 if ( ! wp_verify_nonce( $_POST['cscf_nonce'] ?? '', 'cscf_contact' ) ) { 126 return false; 127 } 86 128 } 87 129 … … 120 162 } 121 163 122 //mandatory phone number 123 if ( cscf_PluginSettings::PhoneNumber() && cscf_PluginSettings::PhoneNumberMandatory() ) { 124 if ( strlen( $this->PhoneNumber ) < 8 ) { 125 $this->Errors['confirm-email'] = esc_html__( 'Please enter a valid phone number.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 126 } 164 //phone number validation 165 if ( cscf_PluginSettings::PhoneNumber() && strlen( $this->PhoneNumber ) > 0 ) { 166 // Validate format - only allow digits, +, (), -, and spaces 167 if ( ! preg_match( '/^[0-9\+\(\)\-\s]+$/', $this->PhoneNumber ) ) { 168 $this->Errors['phone-number'] = esc_html__( 'Phone number can only contain numbers, +, (), - and spaces.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 169 } 170 // Check length for mandatory fields 171 elseif ( cscf_PluginSettings::PhoneNumberMandatory() && strlen( $this->PhoneNumber ) < 8 ) { 172 $this->Errors['phone-number'] = esc_html__( 'Please enter a valid phone number (minimum 8 characters).', 'clean-and-simple-contact-form-by-meg-nicholas' ); 173 } 174 } 175 // Check if phone is mandatory but not provided 176 elseif ( cscf_PluginSettings::PhoneNumber() && cscf_PluginSettings::PhoneNumberMandatory() && strlen( $this->PhoneNumber ) == 0 ) { 177 $this->Errors['phone-number'] = esc_html__( 'Please enter your phone number.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 127 178 } 128 179 … … 134 185 } 135 186 136 //check recaptcha but only if we have keys 137 if ( $this->RecaptchaPublicKey <> '' && $this->RecaptchaPrivateKey <> '' ) { 187 //check recaptcha but only if we have keys, not REST API, and no other validation errors 188 //This prevents reCAPTCHA from blocking users who need to fix other form errors 189 if ( $this->RecaptchaPublicKey <> '' && $this->RecaptchaPrivateKey <> '' && ! $this->IsRestApi && count( $this->Errors ) == 0 ) { 138 190 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- No action, no form fields are being saved 139 191 $resp = csf_RecaptchaV2::VerifyResponse( sanitize_text_field($_SERVER["REMOTE_ADDR"]??''), $this->RecaptchaPrivateKey, sanitize_text_field($_POST["g-recaptcha-response"]??'')); … … 153 205 return true; 154 206 } 207 208 // Action hook before sending email 209 do_action( 'cscf_before_send_email', $this ); 155 210 156 211 $filters = new cscf_Filters; … … 194 249 $filters->remove( 'wp_mail_from_name' ); 195 250 251 // Action hook after sending email 252 do_action( 'cscf_after_send_email', $this, $result ); 253 196 254 //send an email to the form-filler 197 255 if ( $this->EmailToSender ) { … … 228 286 } 229 287 288 // Action hook for successful form submission 289 if ( $result ) { 290 do_action( 'cscf_form_submitted', $this ); 291 } 292 230 293 return $result; 231 294 } -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/class.cscf_pluginsettings.php
r2561035 r3339262 193 193 return isset($options['confirm-email']) ? true : false; 194 194 } 195 196 static function RestApiEnabled() 197 { 198 $options = get_option(CSCF_OPTIONS_KEY); 199 return isset($options['enable_rest_api']) ? true : false; 200 } 201 202 static function RestApiCapability() 203 { 204 $options = get_option(CSCF_OPTIONS_KEY); 205 return isset($options['rest_api_capability']) ? $options['rest_api_capability'] : 'edit_posts'; 206 } 195 207 } 196 208 -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/class.cscf_settings.php
r3254319 r3339262 215 215 'recaptcha_private_key', 216 216 'class' => 'recaptcha-field', 217 ) ); 218 219 // REST API Settings 220 add_settings_section( 221 'section_rest_api', 222 '<h3>' . esc_html__( 'REST API Settings', 'clean-and-simple-contact-form-by-meg-nicholas' ) . '</h3>', 223 array( 224 $this, 225 'print_section_info_rest_api', 226 ), 227 'contact-form-settings' 228 ); 229 add_settings_field( 'enable_rest_api', esc_html__( 'Enable REST API :', 'clean-and-simple-contact-form-by-meg-nicholas' ), array( 230 $this, 231 'create_fields', 232 ), 'contact-form-settings', 'section_rest_api', array( 233 'enable_rest_api', 234 ) ); 235 add_settings_field( 'rest_api_capability', esc_html__( 'Required User Capability :', 'clean-and-simple-contact-form-by-meg-nicholas' ), array( 236 $this, 237 'create_fields', 238 ), 'contact-form-settings', 'section_rest_api', array( 239 'rest_api_capability', 217 240 ) ); 218 241 } … … 317 340 } 318 341 342 // REST API settings 343 if ( isset( $input['rest_api_capability'] ) ) { 344 $input['rest_api_capability'] = sanitize_text_field( $input['rest_api_capability'] ); 345 // Validate capability exists 346 if ( empty( $input['rest_api_capability'] ) ) { 347 $input['rest_api_capability'] = 'edit_posts'; 348 } 349 } 350 319 351 //tidy up the keys 320 352 $tidiedRecipients = array(); … … 343 375 //print 'Enter your styling settings below:'; 344 376 377 } 378 379 public function print_section_info_rest_api() { 380 echo '<p>'; 381 print esc_html__( 'Enable REST API support for headless WordPress implementations.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 382 echo '</p><p>'; 383 print esc_html__( 'When enabled, authenticated users can submit the form via: POST /wp-json/cscf/v1/submit', 'clean-and-simple-contact-form-by-meg-nicholas' ); 384 echo '</p>'; 345 385 } 346 386 … … 516 556 name="<?php echo esc_attr( CSCF_OPTIONS_KEY ); ?>[use_client_validation]"><?php 517 557 break; 558 case 'enable_rest_api': 559 $checked = cscf_PluginSettings::RestApiEnabled() === true ? 'checked' : ''; 560 ?><label for="enable_rest_api" class="screen-reader-text"> 561 <?php esc_html_e('enable REST API', 'clean-and-simple-contact-form-by-meg-nicholas'); ?> 562 </label><input type="checkbox" <?php echo esc_attr( $checked ); ?> id="enable_rest_api" 563 name="<?php echo esc_attr( CSCF_OPTIONS_KEY ); ?>[enable_rest_api]"><?php 564 break; 565 case 'rest_api_capability': 566 $capability = cscf_PluginSettings::RestApiCapability(); 567 ?><label for="rest_api_capability" class="screen-reader-text"> 568 <?php esc_html_e('REST API required capability', 'clean-and-simple-contact-form-by-meg-nicholas'); ?> 569 </label><input type="text" size="40" id="rest_api_capability" 570 name="<?php echo esc_attr( CSCF_OPTIONS_KEY ); ?>[rest_api_capability]" 571 value="<?php echo esc_attr( $capability ); ?>" /> 572 <p class="description"><?php esc_html_e( 'Default: edit_posts. Common capabilities: edit_posts, publish_posts, manage_options', 'clean-and-simple-contact-form-by-meg-nicholas' ); ?></p><?php 573 break; 518 574 default: 519 575 break; -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/clean-and-simple-contact-form-by-meg-nicholas.php
r3254319 r3339262 8 8 Plugin URI: https://fullworks.net/products/clean-and-simple-contact-form 9 9 Description: A clean and simple contact form with Google reCAPTCHA and Twitter Bootstrap markup. 10 Version: 4.1 010 Version: 4.11 11 11 Requires at least: 5.6 12 12 Requires PHP: 7.4 … … 50 50 require 'class.view.php'; 51 51 require 'class.cscf_filters.php'; 52 require 'class.cscf_rest_api.php'; 52 53 require 'ajax.php'; 53 54 require 'recaptchav2.php'; … … 75 76 76 77 if ( ! defined( 'CSCF_VERSION_NUM' ) ) { 77 define( 'CSCF_VERSION_NUM', '4.1 0' );78 define( 'CSCF_VERSION_NUM', '4.11' ); 78 79 } 79 80 … … 91 92 92 93 $cscf = new cscf(); 94 $cscf_rest_api = new cscf_rest_api(); 95 96 // Configure SMTP if constants are defined 97 if ( defined( 'CSCF_USE_SMTP' ) && CSCF_USE_SMTP ) { 98 add_action( 'phpmailer_init', function( $phpmailer ) { 99 $phpmailer->isSMTP(); 100 101 // Required settings 102 if ( defined( 'CSCF_SMTP_HOST' ) ) { 103 $phpmailer->Host = CSCF_SMTP_HOST; 104 } 105 106 if ( defined( 'CSCF_SMTP_PORT' ) ) { 107 $phpmailer->Port = (int) CSCF_SMTP_PORT; 108 } 109 110 // Authentication settings 111 if ( defined( 'CSCF_SMTP_AUTH' ) && CSCF_SMTP_AUTH ) { 112 $phpmailer->SMTPAuth = true; 113 114 if ( defined( 'CSCF_SMTP_USER' ) ) { 115 $phpmailer->Username = CSCF_SMTP_USER; 116 } 117 118 if ( defined( 'CSCF_SMTP_PASS' ) ) { 119 $phpmailer->Password = CSCF_SMTP_PASS; 120 } 121 } else { 122 $phpmailer->SMTPAuth = false; 123 } 124 125 // Security settings 126 if ( defined( 'CSCF_SMTP_SECURE' ) ) { 127 $phpmailer->SMTPSecure = CSCF_SMTP_SECURE; // 'tls' or 'ssl' or empty string 128 } 129 130 // Optional: From email override 131 if ( defined( 'CSCF_SMTP_FROM' ) ) { 132 $phpmailer->From = CSCF_SMTP_FROM; 133 } 134 135 // Optional: From name override 136 if ( defined( 'CSCF_SMTP_FROM_NAME' ) ) { 137 $phpmailer->FromName = CSCF_SMTP_FROM_NAME; 138 } 139 140 // Debug mode 141 if ( defined( 'CSCF_SMTP_DEBUG' ) && CSCF_SMTP_DEBUG ) { 142 $phpmailer->SMTPDebug = 2; 143 } 144 }); 145 } 93 146 94 147 /*get the current version and update options to the new option*/ -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/js/jquery.validate.contact.form.js
r2551686 r3339262 7 7 $form.find("#recaptcha_response_field").focus(function () { 8 8 9 $errele = $form.find(" div[for='cscf_recaptcha']");9 $errele = $form.find("span[for='cscf_recaptcha']"); 10 10 $errele.html(''); 11 11 … … 56 56 jQuery('html,body') 57 57 .animate({ 58 scrollTop: jQuery($div.selector) 59 .offset().top 58 scrollTop: $div.offset().top 60 59 }, 'slow'); 61 60 } … … 63 62 64 63 else { 64 // Clear any previous errors first 65 $form.find("span.help-inline.help-block.error").html('').css('display', 'none'); 66 $form.find('.form-group').removeClass('has-error').addClass('has-success'); 67 $form.find('.control-group').removeClass('error').addClass('success'); 68 65 69 $.each(response.errorlist, function (name, value) { 66 $errele = $form.find("div[for='cscf_" + name + "']"); 67 $errele.html(value); 68 $errele.closest('.form-group').removeClass('has-success').addClass('has-error'); 69 $errele.closest('.control-group').removeClass('success').addClass('error'); // support for bootstrap 2 70 // Debug logging 71 if (window.console) { 72 console.log("Error for field: " + name + ", message: " + value); 73 } 74 75 $errele = $form.find("span[for='cscf_" + name + "']"); 76 if ($errele.length > 0) { 77 $errele.html(value); 78 $errele.css('display', 'block'); 79 $errele.closest('.form-group').removeClass('has-success').addClass('has-error'); 80 $errele.closest('.control-group').removeClass('success').addClass('error'); // support for bootstrap 2 81 } else if (window.console) { 82 console.log("Could not find error element for: cscf_" + name); 83 } 70 84 }); 71 85 $button.removeAttr("disabled"); -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/languages/clean-and-simple-contact-form-by-meg-nicholas-pl_PL.po
r3142234 r3339262 7 7 "PO-Revision-Date: 2024-08-27 12:26+0100\n" 8 8 "Last-Translator: \n" 9 "Language-Team: Kacper Ruciński <kacper.rucinski@gmail.com>\n"9 "Language-Team: Kacper Ruciński\n" 10 10 "Language: pl_PL\n" 11 11 "MIME-Version: 1.0\n" … … 42 42 #: clean-and-simple-contact-form-by-meg-nicholas/views/contact-form.view.php:34 43 43 msgid "Please give your name." 44 msgstr "Prosimy wpisać imię i nazwisko."44 msgstr "Prosimy się przedstawić." 45 45 46 46 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:110 47 47 msgid "Please enter a message." 48 msgstr "Prosimy wp isać wiadomość."48 msgstr "Prosimy wprowadzić wiadomość." 49 49 50 50 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:115, … … 52 52 #: clean-and-simple-contact-form-by-meg-nicholas/views/contact-form.view.php:93 53 53 msgid "Please enter a valid email address." 54 msgstr "Prosimy wp isać poprawny adres e-mail."54 msgstr "Prosimy wprowadzić poprawny adres e-mail." 55 55 56 56 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:121 57 57 msgid "Please enter a valid phone number." 58 msgstr "Pros zęwprowadzić poprawny numer telefonu."58 msgstr "Prosimy wprowadzić poprawny numer telefonu." 59 59 60 60 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:128, … … 65 65 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:137 66 66 msgid "Please solve the recaptcha to continue." 67 msgstr "Pros zę rozwiązać recaptcha, aby kontynuować."67 msgstr "Prosimy rozwiązać reCAPTCHA, aby kontynuować." 68 68 69 69 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:170 … … 82 82 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:175 83 83 msgid "Page URL" 84 msgstr " Strona URL"84 msgstr "URL strony" 85 85 86 86 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:176, … … 129 129 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:30 130 130 msgid "Contact Form Settings" 131 msgstr "Ustawienia Contact Form"131 msgstr "Ustawienia formularza kontaktowego" 132 132 133 133 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:31 134 134 msgid "Contact Form" 135 msgstr " Contact Form"135 msgstr "Formularz kontaktowy" 136 136 137 137 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:43 138 138 msgid "Clean and Simple Contact Form Settings" 139 msgstr "Ustawienia Clean and Simple Contact Form"139 msgstr "Ustawienia wtyczki Przejrzysty i prosty formularz kontaktowy" 140 140 141 141 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:52 … … 223 223 "Use the plugin default stylesheet (un-tick to use your theme style sheet " 224 224 "instead) :" 225 msgstr "Użyj domyślnego stylu wtyczki (odznacz, aby użyć stylów motywu "225 msgstr "Użyj domyślnego stylu wtyczki (odznacz, aby użyć stylów motywu):" 226 226 227 227 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:168 … … 235 235 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:187 236 236 msgid "Use reCAPTCHA :" 237 msgstr "Użyj reCAPTCHA :"237 msgstr "Użyj reCAPTCHA:" 238 238 239 239 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:194 … … 255 255 msgstr "" 256 256 "Najlepszym sposobem na okazanie uznania dla tej darmowej wtyczki i " 257 " utrzymanie jejjest wsparcie jej poprzez zainstalowanie Fullworks Anti Spam "257 "jej utrzymanie jest wsparcie jej poprzez zainstalowanie Fullworks Anti Spam " 258 258 "Pro" 259 259 … … 263 263 "compare it with Akismet, yet extremely effective." 264 264 msgstr "" 265 " Dzięki 14-dniowemu bezpłatnemu okresowi próbnemu jest on zaskakująco"266 " przystępnycenowo w porównaniu z Akismet, a jednocześnie niezwykle skuteczny."265 "Oferując darmowy 14-dniowy okres próbny, jest on zaskakująco przystępny " 266 "cenowo w porównaniu z Akismet, a jednocześnie niezwykle skuteczny." 267 267 268 268 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:226, … … 273 273 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:221 274 274 msgid "Congratulations: you are protected by Fullworks Anti Spam" 275 msgstr "Gratulacje : jesteś chroniony przezFullworks Anti Spam"275 msgstr "Gratulacje! Ochronę zapewnia Ci Fullworks Anti Spam" 276 276 277 277 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:222 278 278 msgid "Configure" 279 msgstr " Konfiguracja"279 msgstr "Skonfiguruj" 280 280 281 281 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:222 … … 291 291 "With a 14 day free trial, will automatically log all messages from this form." 292 292 msgstr "" 293 " Dzięki 14-dniowemu bezpłatnemu okresowi próbnemu automatycznie rejestruje "294 "w szystkie wiadomości z tego formularza."293 "Oferując darmowy 14-dniowy okres próbny, automatycznie rejestruje wszystkie " 294 "wiadomości z tego formularza." 295 295 296 296 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:243 … … 402 402 403 403 #~ msgid "Clean and Simple Contact Form!" 404 #~ msgstr " Clean and Simple Contact Form!"404 #~ msgstr "Przejrzysty i prosty formularz kontaktowy!" 405 405 406 406 #~ msgid "You are using version" … … 420 420 421 421 #~ msgid "*New*" 422 #~ msgstr "*Now e*"422 #~ msgstr "*Nowość*" 423 423 424 424 #~ msgid "Clean and Simple Contact Form" 425 #~ msgstr " Czyste i proste Formularz kontaktowy"425 #~ msgstr "Przejrzysty i prosty formularz kontaktowy" 426 426 427 427 #~ msgid "" … … 436 436 #~ "Bootstrap markup." 437 437 #~ msgstr "" 438 #~ " Czysty i prosty formularz kontaktowy z Google i Twitter Bootstrap"439 #~ "reCAPTCHA znaczników."438 #~ "Przejrzysty i prosty formularz kontaktowy z Google reCAPTCHA i znacznikami " 439 #~ Twitter Bootstrap." 440 440 441 441 #~ msgid "Meghan Nicholas" … … 446 446 447 447 #~ msgid "Sorry the code wasn't entered correctly please try again." 448 #~ msgstr "" 449 #~ "Przepraszamy, kod nie został wprowadzony poprawnie. Spróbuj ponownie." 448 #~ msgstr "Przepraszamy, kod nie został wprowadzony poprawnie. Spróbuj ponownie." 450 449 451 450 #~ msgid "Red" -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/languages/clean-and-simple-contact-form-by-meg-nicholas.pot
r3254319 r3339262 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: C lean and Simple Contact Form 4.10\n"5 "Project-Id-Version: Contact Form Clean and Simple 4.11\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/clean-and-simple-contact-form-by-meg-nicholas\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-0 3-10T17:28:16+00:00\n"12 "POT-Creation-Date: 2025-08-04T19:28:59+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.10.0\n" … … 17 17 #. Plugin Name of the plugin 18 18 #: clean-and-simple-contact-form-by-meg-nicholas.php 19 msgid "C lean and Simple Contact Form"19 msgid "Contact Form Clean and Simple" 20 20 msgstr "" 21 21 … … 40 40 msgstr "" 41 41 42 #: class.cscf.php:68 43 msgid "Settings" 44 msgstr "" 45 46 #: class.cscf_contact.php:91 42 #: class.cscf_contact.php:133 47 43 msgid "Sorry the email addresses do not match." 48 44 msgstr "" 49 45 50 #: class.cscf_contact.php: 9746 #: class.cscf_contact.php:139 51 47 #: views/contact-form.view.php:63 52 48 msgid "Please give your email address." 53 49 msgstr "" 54 50 55 #: class.cscf_contact.php:1 0351 #: class.cscf_contact.php:145 56 52 msgid "Please confirm your email address." 57 53 msgstr "" 58 54 59 #: class.cscf_contact.php:1 0955 #: class.cscf_contact.php:151 60 56 #: views/contact-form.view.php:34 61 57 msgid "Please give your name." 62 58 msgstr "" 63 59 64 #: class.cscf_contact.php:1 1460 #: class.cscf_contact.php:156 65 61 msgid "Please enter a message." 66 62 msgstr "" 67 63 68 #: class.cscf_contact.php:1 1964 #: class.cscf_contact.php:161 69 65 #: views/contact-form.view.php:64 70 66 #: views/contact-form.view.php:93 … … 72 68 msgstr "" 73 69 74 #: class.cscf_contact.php:1 2570 #: class.cscf_contact.php:167 75 71 msgid "Please enter a valid phone number." 76 72 msgstr "" 77 73 78 #: class.cscf_contact.php:1 3274 #: class.cscf_contact.php:174 79 75 #: views/contact-form.view.php:198 80 76 msgid "Please give your consent." 81 77 msgstr "" 82 78 83 #: class.cscf_contact.php:1 4279 #: class.cscf_contact.php:184 84 80 msgid "Please solve the recaptcha to continue." 85 81 msgstr "" 86 82 87 #: class.cscf_contact.php: 17583 #: class.cscf_contact.php:220 88 84 msgid "From" 89 85 msgstr "" 90 86 91 #: class.cscf_contact.php: 17687 #: class.cscf_contact.php:221 92 88 msgid "Email" 93 89 msgstr "" 94 90 95 #: class.cscf_contact.php: 17896 #: class.cscf_contact.php:2 1991 #: class.cscf_contact.php:223 92 #: class.cscf_contact.php:267 97 93 msgid "Phone" 98 94 msgstr "" 99 95 100 #: class.cscf_contact.php: 18096 #: class.cscf_contact.php:225 101 97 msgid "Page URL" 102 98 msgstr "" 103 99 104 #: class.cscf_contact.php: 181105 #: class.cscf_contact.php:2 21100 #: class.cscf_contact.php:226 101 #: class.cscf_contact.php:269 106 102 msgid "Message" 107 103 msgstr "" 108 104 109 #: class.cscf_contact.php: 183110 #: class.cscf_contact.php:2 16105 #: class.cscf_contact.php:228 106 #: class.cscf_contact.php:264 111 107 msgid "yes" 112 108 msgstr "" 113 109 114 #: class.cscf_contact.php: 183115 #: class.cscf_contact.php:2 16110 #: class.cscf_contact.php:228 111 #: class.cscf_contact.php:264 116 112 msgid "no" 117 113 msgstr "" 118 114 119 #: class.cscf_contact.php:2 14115 #: class.cscf_contact.php:262 120 116 msgid "Here is a copy of your message :" 121 117 msgstr "" … … 141 137 msgstr "" 142 138 139 #: class.cscf_rest_api.php:48 140 msgid "Authentication required." 141 msgstr "" 142 143 #: class.cscf_rest_api.php:58 144 msgid "Insufficient permissions." 145 msgstr "" 146 147 #: class.cscf_rest_api.php:96 148 msgid "Validation failed." 149 msgstr "" 150 151 #: class.cscf_rest_api.php:110 152 msgid "Failed to send email." 153 msgstr "" 154 143 155 #: class.cscf_settings.php:29 144 156 msgid "Contact Form Settings" … … 261 273 msgstr "" 262 274 263 #: class.cscf_settings.php:224 275 #: class.cscf_settings.php:222 276 msgid "REST API Settings" 277 msgstr "" 278 279 #: class.cscf_settings.php:229 280 msgid "Enable REST API :" 281 msgstr "" 282 283 #: class.cscf_settings.php:235 284 msgid "Required User Capability :" 285 msgstr "" 286 287 #: class.cscf_settings.php:247 264 288 msgid "Congratulations: you are protected by Fullworks Anti Spam" 265 289 msgstr "" 266 290 267 #: class.cscf_settings.php:2 25291 #: class.cscf_settings.php:248 268 292 msgid "Configure" 269 293 msgstr "" 270 294 271 #: class.cscf_settings.php:2 25295 #: class.cscf_settings.php:248 272 296 msgid "Anti Spam Settings here" 273 297 msgstr "" 274 298 275 #: class.cscf_settings.php:2 27299 #: class.cscf_settings.php:250 276 300 msgid "The best way to show your appreciation for this free plugin and keep it maintained is to support it by installing Fullworks Anti Spam Pro" 277 301 msgstr "" 278 302 279 #: class.cscf_settings.php:2 28303 #: class.cscf_settings.php:251 280 304 msgid "With a 14 day free trial, you will find it surprisingly affordable when you compare it with Akismet, yet extremely effective." 281 305 msgstr "" 282 306 283 #: class.cscf_settings.php:2 29284 #: class.cscf_settings.php:2 32307 #: class.cscf_settings.php:252 308 #: class.cscf_settings.php:255 285 309 msgid "Try Fullworks Anti Spam Pro now and support the maintenance this FREE contact form plugin" 286 310 msgstr "" 287 311 288 #: class.cscf_settings.php:2 39312 #: class.cscf_settings.php:262 289 313 msgid "Message logging is enabled by Fullworks Anti Spam Pro" 290 314 msgstr "" 291 315 292 #: class.cscf_settings.php:2 41316 #: class.cscf_settings.php:264 293 317 msgid "View Logs here" 294 318 msgstr "" 295 319 296 #: class.cscf_settings.php:2 43320 #: class.cscf_settings.php:266 297 321 msgid "Enable message log by installing Fullworks Anti Spam Pro" 298 322 msgstr "" 299 323 300 #: class.cscf_settings.php:2 44324 #: class.cscf_settings.php:267 301 325 msgid "With a 14 day free trial, will automatically log all messages from this form." 302 326 msgstr "" 303 327 304 #: class.cscf_settings.php:2 45328 #: class.cscf_settings.php:268 305 329 msgid "Enable logs now" 306 330 msgstr "" 307 331 308 #: class.cscf_settings.php:3 32332 #: class.cscf_settings.php:364 309 333 msgid "Enter your reCAPTCHA settings below :" 310 334 msgstr "" 311 335 312 #: class.cscf_settings.php:3 33336 #: class.cscf_settings.php:365 313 337 msgid "To use reCAPTCHA you must get an API key from" 314 338 msgstr "" 315 339 316 #: class.cscf_settings.php:3 38340 #: class.cscf_settings.php:370 317 341 msgid "Enter your message settings below :" 318 342 msgstr "" 319 343 320 #: class.cscf_settings.php:459 344 #: class.cscf_settings.php:381 345 msgid "Enable REST API support for headless WordPress implementations." 346 msgstr "" 347 348 #: class.cscf_settings.php:383 349 msgid "When enabled, authenticated users can submit the form via: POST /wp-json/cscf/v1/submit" 350 msgstr "" 351 352 #: class.cscf_settings.php:396 353 msgid "use recaptcha" 354 msgstr "" 355 356 #: class.cscf_settings.php:403 357 msgid "load stylesheet" 358 msgstr "" 359 360 #: class.cscf_settings.php:410 361 msgid "recaptcha public key" 362 msgstr "" 363 364 #: class.cscf_settings.php:418 365 msgid "recaptcha private key" 366 msgstr "" 367 368 #: class.cscf_settings.php:430 369 msgid "recipient email" 370 msgstr "" 371 372 #: class.cscf_settings.php:437 373 msgid "add button for new recipient email" 374 msgstr "" 375 376 #: class.cscf_settings.php:443 377 msgid "remove button for new recipient email" 378 msgstr "" 379 380 #: class.cscf_settings.php:457 381 msgid "confirm email" 382 msgstr "" 383 384 #: class.cscf_settings.php:464 385 msgid "override from address" 386 msgstr "" 387 388 #: class.cscf_settings.php:471 389 msgid "email to sender" 390 msgstr "" 391 392 #: class.cscf_settings.php:478 393 msgid "contact consent" 394 msgstr "" 395 396 #: class.cscf_settings.php:484 397 msgid "contact consent message" 398 msgstr "" 399 400 #: class.cscf_settings.php:492 401 msgid "phone number" 402 msgstr "" 403 404 #: class.cscf_settings.php:499 405 msgid "phone number mandatory" 406 msgstr "" 407 408 #: class.cscf_settings.php:506 409 msgid "from email address" 410 msgstr "" 411 412 #: class.cscf_settings.php:513 413 msgid "email subject" 414 msgstr "" 415 416 #: class.cscf_settings.php:519 417 msgid "sent message heading" 418 msgstr "" 419 420 #: class.cscf_settings.php:526 421 msgid "sent message body" 422 msgstr "" 423 424 #: class.cscf_settings.php:532 425 msgid "message" 426 msgstr "" 427 428 #: class.cscf_settings.php:540 429 msgid "recaptcha theme" 430 msgstr "" 431 432 #: class.cscf_settings.php:545 321 433 msgid "Light" 322 434 msgstr "" 323 435 324 #: class.cscf_settings.php: 461436 #: class.cscf_settings.php:547 325 437 msgid "Dark" 438 msgstr "" 439 440 #: class.cscf_settings.php:554 441 msgid "use client validation" 442 msgstr "" 443 444 #: class.cscf_settings.php:561 445 msgid "enable REST API" 446 msgstr "" 447 448 #: class.cscf_settings.php:568 449 msgid "REST API required capability" 450 msgstr "" 451 452 #: class.cscf_settings.php:572 453 msgid "Default: edit_posts. Common capabilities: edit_posts, publish_posts, manage_options" 454 msgstr "" 455 456 #. translators: %s is the path to the view file 457 #: class.view.php:25 458 msgid "View %s not found" 326 459 msgstr "" 327 460 -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/readme.txt
r3254319 r3339262 7 7 License URI: http://www.gnu.org/licenses/gpl.html 8 8 Tags: contact, form, contact form, feedback form, bootstrap 9 Tested up to: 6. 710 Stable tag: 4.1 09 Tested up to: 6.8 10 Stable tag: 4.11 11 11 12 12 A clean and simple contact form with Bootstrap markup. … … 14 14 15 15 == Description == 16 A clean and simple AJAX contact form with Google reCAPTCHA, Twitter Bootstrap markup and spam filtering.16 A clean and simple AJAX contact form with Google reCAPTCHA, Twitter Bootstrap markup, spam filtering, and REST API support for headless WordPress implementations. 17 17 18 18 * **Clean**: all user inputs are stripped in order to avoid cross-site scripting (XSS) vulnerabilities. … … 22 22 * **Stylish**: Use the included stylesheet or switch it off and use your own for seamless integration with your website. 23 23 Uses **Twitter Bootstrap** classes. 24 25 * **REST API Support**: Enable headless WordPress implementations to submit forms via authenticated REST API endpoints. 24 26 25 27 … … 66 68 * Original plugin written by an **experienced PHP programmer**, Megan Nicholas, the code is rock solid, safe, and rigorously tested as standard practice. 67 69 70 * **Headless WordPress ready**. REST API support allows you to submit forms from decoupled frontends, mobile apps, or any external application with proper authentication. 71 68 72 Hopefully this plugin will fulfil all your needs. 69 73 … … 136 140 137 141 * **Contact consent**: This option allows you to be GDPR compliant by adding a 'Consent to contact' check box at the bottom of the form. 142 143 * **Enable REST API**: Turn on REST API support to allow headless WordPress implementations to submit forms. 144 145 * **Required User Capability**: Set the minimum WordPress user capability required to use the REST API (default: edit_posts). 146 147 148 == REST API for Headless WordPress == 149 150 This plugin includes REST API support, making it perfect for headless WordPress implementations, mobile applications, and decoupled frontend frameworks like React, Vue.js, or Angular. 151 152 = Enabling REST API = 153 154 1. Go to the plugin settings page 155 2. Find the "REST API Settings" section 156 3. Check "Enable REST API" 157 4. Set the required user capability (default: edit_posts) 158 5. Save your settings 159 160 = API Endpoint = 161 162 **POST** `/wp-json/cscf/v1/submit` 163 164 = Authentication = 165 166 The REST API requires WordPress user authentication. Users must be logged in and have the capability specified in settings (default: edit_posts). 167 168 For headless implementations, you can use: 169 - Application Passwords (WordPress 5.6+) 170 - JWT Authentication plugins 171 - OAuth plugins 172 - Basic Authentication (development only) 173 174 = Request Format = 175 176 Send a POST request with JSON body: 177 178 ```json 179 { 180 "name": "John Doe", 181 "email": "john@example.com", 182 "confirm_email": "john@example.com", 183 "message": "Your message here", 184 "phone_number": "+1234567890", 185 "contact_consent": true, 186 "email_sender": false, 187 "post_id": 123 188 } 189 ``` 190 191 **Required fields:** 192 - `name`: Sender's name 193 - `email`: Sender's email address 194 - `message`: The message content 195 196 **Optional fields:** 197 - `confirm_email`: Required if email confirmation is enabled in settings 198 - `phone_number`: Required if phone number is set as mandatory in settings 199 - `contact_consent`: Required if contact consent is enabled in settings 200 - `email_sender`: Set to true to send a copy to the sender 201 - `post_id`: The ID of the page/post where the form would normally be displayed 202 203 = Response Format = 204 205 **Success Response (200):** 206 ```json 207 { 208 "success": true, 209 "message": "Message Sent" 210 } 211 ``` 212 213 **Validation Error Response (400):** 214 ```json 215 { 216 "code": "validation_failed", 217 "message": "Validation failed.", 218 "data": { 219 "status": 400, 220 "errors": { 221 "email": "Please enter a valid email address.", 222 "message": "Please enter a message." 223 } 224 } 225 } 226 ``` 227 228 **Authentication Error Response (401):** 229 ```json 230 { 231 "code": "rest_forbidden", 232 "message": "Authentication required.", 233 "data": { 234 "status": 401 235 } 236 } 237 ``` 238 239 = Example Implementation = 240 241 **JavaScript (fetch API):** 242 ```javascript 243 const formData = { 244 name: "John Doe", 245 email: "john@example.com", 246 confirm_email: "john@example.com", 247 message: "This is a test message from the REST API" 248 }; 249 250 fetch('https://yoursite.com/wp-json/cscf/v1/submit', { 251 method: 'POST', 252 headers: { 253 'Content-Type': 'application/json', 254 'Authorization': 'Bearer YOUR_AUTH_TOKEN' 255 }, 256 body: JSON.stringify(formData) 257 }) 258 .then(response => response.json()) 259 .then(data => { 260 if (data.success) { 261 console.log('Message sent successfully!'); 262 } else { 263 console.error('Validation errors:', data.data.errors); 264 } 265 }); 266 ``` 267 268 = Important Notes = 269 270 - REST API is disabled by default for security 271 - reCAPTCHA is bypassed for REST API submissions (authentication provides security) 272 - All other form validations and spam filtering still apply 273 - Form submissions via REST API are processed identically to regular submissions 274 - Email notifications work the same way as standard form submissions 138 275 139 276 -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/shortcodes/contact-form.php
r2551686 r3339262 9 9 if ( $contact->IsValid() ) { 10 10 if ( $contact->SendMail() ) { 11 // Action hook for standard form submission 12 do_action( 'cscf_form_submitted_standard', $contact ); 13 11 14 $view = new CSCF_View( 'message-sent' ); 12 15 $view->Set( 'heading', cscf_PluginSettings::SentMessageHeading() ); -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/vendor/autoload.php
r3254319 r3339262 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 23 20 require_once __DIR__ . '/composer/autoload_real.php'; 24 21 25 return ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c::getLoader();22 return ComposerAutoloaderInit27d86f03d1c986263483b369986ee068::getLoader(); -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/vendor/composer/InstalledVersions.php
r3254319 r3339262 28 28 { 29 29 /** 30 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 31 * @internal 32 */ 33 private static $selfDir = null; 34 35 /** 30 36 * @var mixed[]|null 31 37 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 32 38 */ 33 39 private static $installed; 40 41 /** 42 * @var bool 43 */ 44 private static $installedIsLocalDir; 34 45 35 46 /** … … 310 321 self::$installed = $data; 311 322 self::$installedByVendor = array(); 323 324 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 325 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 326 // so we have to assume it does not, and that may result in duplicate data being returned when listing 327 // all installed packages for example 328 self::$installedIsLocalDir = false; 329 } 330 331 /** 332 * @return string 333 */ 334 private static function getSelfDir() 335 { 336 if (self::$selfDir === null) { 337 self::$selfDir = strtr(__DIR__, '\\', '/'); 338 } 339 340 return self::$selfDir; 312 341 } 313 342 … … 323 352 324 353 $installed = array(); 354 $copiedLocalDir = false; 325 355 326 356 if (self::$canGetVendors) { 357 $selfDir = self::getSelfDir(); 327 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 359 $vendorDir = strtr($vendorDir, '\\', '/'); 328 360 if (isset(self::$installedByVendor[$vendorDir])) { 329 361 $installed[] = self::$installedByVendor[$vendorDir]; … … 331 363 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 364 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 365 self::$installedByVendor[$vendorDir] = $required; 366 $installed[] = $required; 367 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 368 self::$installed = $required; 369 self::$installedIsLocalDir = true; 336 370 } 371 } 372 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 373 $copiedLocalDir = true; 337 374 } 338 375 } … … 351 388 } 352 389 353 if (self::$installed !== array() ) {390 if (self::$installed !== array() && !$copiedLocalDir) { 354 391 $installed[] = self::$installed; 355 392 } -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/vendor/composer/autoload_real.php
r3254319 r3339262 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c5 class ComposerAutoloaderInit27d86f03d1c986263483b369986ee068 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit27d86f03d1c986263483b369986ee068', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit27d86f03d1c986263483b369986ee068', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit27d86f03d1c986263483b369986ee068::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/vendor/composer/autoload_static.php
r3254319 r3339262 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c7 class ComposerStaticInit27d86f03d1c986263483b369986ee068 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 38 38 { 39 39 return \Closure::bind(function () use ($loader) { 40 $loader->prefixLengthsPsr4 = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$prefixLengthsPsr4;41 $loader->prefixDirsPsr4 = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$prefixDirsPsr4;42 $loader->prefixesPsr0 = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$prefixesPsr0;43 $loader->classMap = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$classMap;40 $loader->prefixLengthsPsr4 = ComposerStaticInit27d86f03d1c986263483b369986ee068::$prefixLengthsPsr4; 41 $loader->prefixDirsPsr4 = ComposerStaticInit27d86f03d1c986263483b369986ee068::$prefixDirsPsr4; 42 $loader->prefixesPsr0 = ComposerStaticInit27d86f03d1c986263483b369986ee068::$prefixesPsr0; 43 $loader->classMap = ComposerStaticInit27d86f03d1c986263483b369986ee068::$classMap; 44 44 45 45 }, null, ClassLoader::class); -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/vendor/composer/installed.php
r3254319 r3339262 2 2 'root' => array( 3 3 'name' => 'fullworks/clean-and-simple-contact-form', 4 'pretty_version' => ' dev-main',5 'version' => ' dev-main',6 'reference' => ' 6057cf8bf7c1cd56b1f7d6b170e7208543f25dde',4 'pretty_version' => 'v4.11', 5 'version' => '4.11.0.0', 6 'reference' => '801b967317613364d9e34394960f064495cb2283', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 30 30 ), 31 31 'fullworks/clean-and-simple-contact-form' => array( 32 'pretty_version' => ' dev-main',33 'version' => ' dev-main',34 'reference' => ' 6057cf8bf7c1cd56b1f7d6b170e7208543f25dde',32 'pretty_version' => 'v4.11', 33 'version' => '4.11.0.0', 34 'reference' => '801b967317613364d9e34394960f064495cb2283', 35 35 'type' => 'wordpress-plugin', 36 36 'install_path' => __DIR__ . '/../../', -
clean-and-simple-contact-form-by-meg-nicholas/tags/4.11/vendor/composer/platform_check.php
r3142234 r3339262 20 20 } 21 21 } 22 trigger_error( 23 'Composer detected issues in your platform: ' . implode(' ', $issues), 24 E_USER_ERROR 22 throw new \RuntimeException( 23 'Composer detected issues in your platform: ' . implode(' ', $issues) 25 24 ); 26 25 } -
clean-and-simple-contact-form-by-meg-nicholas/trunk/ajax.php
r2551686 r3339262 14 14 if ( $result['valid'] ) { 15 15 $result['sent'] = $contact->SendMail(); 16 17 // Action hook for AJAX form submission 18 if ( $result['sent'] ) { 19 do_action( 'cscf_form_submitted_ajax', $contact ); 20 } 16 21 } 17 22 -
clean-and-simple-contact-form-by-meg-nicholas/trunk/changelog.txt
r3146820 r3339262 1 = 4.11 = 2 * Added REST API support for headless WordPress implementations 3 - New endpoint at /wp-json/cscf/v1/submit with authentication 4 - Configurable user capability requirements 5 - Full form validation (excluding reCAPTCHA for authenticated requests) 6 * Added SMTP configuration via wp-config constants 7 - Support for all major email services (Gmail, SendGrid, Mailgun, etc.) 8 - Useful for development with tools like Mailpit 9 - No UI needed - server-level configuration 10 * Added developer hooks for extensibility 11 - Action hooks: cscf_before_send_email, cscf_after_send_email, cscf_form_submitted (plus type-specific variants) 12 - Filter hook: cscf_form_data for REST API data modification 13 * Added comprehensive developer documentation 14 - Hooks and filters guide with examples 15 - REST API implementation guide 16 - SMTP configuration guide 17 * Improved extensibility for third-party integrations (CRMs, webhooks, mailing lists) 18 * Improved phone number validation 19 - Now validates format (only allows digits, +, (), -, and spaces) 20 - Format validation applies even when phone field is optional 21 - Fixed bug where phone validation error used wrong error key 22 * Improved form validation user experience 23 - reCAPTCHA validation now skipped if other form errors exist 24 - Prevents users from being blocked by reCAPTCHA when fixing validation errors 25 * Fixed JavaScript bugs 26 - Fixed server-side validation errors not displaying when using AJAX submission 27 - Fixed jQuery selector looking for div instead of span elements for error display 28 - Fixed deprecated jQuery .selector usage for jQuery 3.0+ compatibility 29 * Added comprehensive unit tests for form validation 30 * Removed deprecated load_plugin_textdomain() function - WordPress handles translations automatically since v4.6 31 32 = 4.10 = 33 * Added opt in 34 * Added code to comply with current plugin guidelines 35 1 36 = 4.9.1 = 2 * corrected link markup in settings pag 37 * corrected link markup in settings page 3 38 4 39 = 4.9 = … … 45 80 46 81 = 4.7.1 = 47 * Tested with Word press version 5.382 * Tested with WordPress version 5.3 48 83 Fixed XSS vulnerability in GDPR consent message 49 84 = 4.7.0 = 50 * Tested with Word press version 4.9.685 * Tested with WordPress version 4.9.6 51 86 * Added consent to contact checkbox for GDPR compliance 52 87 = 4.6.2 = … … 167 202 = 4.1.2 = 168 203 * Added some FAQs 169 * Added alternative shortcode [cscf-contact-form] for use when conflicts could occur. 170 * Updated the documentation. 171 * Recaptcha form now responds to language changes 172 * Updated pot file to reflect new name space 173 * Changed name space from cff to cscf 174 * Settings screen: recaptcha theme and key inputs are immediately enabled/disabled as the 'Use reCAPTCHA' box is clicked. 175 * Corrected some html seen as invalid by http://validator.w3.org/ 176 * removed '<?=' and replaced with '<?php echo' in cscf_settings, thanks go to andrewbacon 177 * Added notice to setting screen when JetPack's contact form is active 178 * Fixed problem where 'Please enter a valid email address' was not translating in the 'confirm email address' input 179 = 4.1.1 = 180 * Fixed potential conflicts with themes that use bootstrap 181 * Enabled internationalisation, this plugin will now work with multiple languages 182 * Added German translation file for my German friends, thanks to faktorzweinet for the translation 183 = 4.1.0 = 184 * Fixed a bug in class.cff_settings.php where php opening tag had got missed off. This problem caused the settings screen not to display correctly but only occurred with some versions of php. Please upgrade if you have this problem. 185 = 4.0.9 = 186 * Switched header argument of wp_mail over to a filter to remove any potential conflicts with other emailing plugins or themes 187 * The ability to set a different recipient email address. Previously all email was sent to the WordPress administrator email address. 188 * Allow the email subject to be customised. 189 = 4.0.8 = 190 * Fixed a bug: When using reCAPTCHA ajax did not work. 191 * Fixed a bug: Ajax validation was not checking email address were equal (server side was doing it instead) 192 * Improvement: Ajax now works better. 193 * Documentation update: nicer links (worked how to do them in markdown!), changelog and upgrade notice sections now correctly formatted. 194 = 4.0.7 = 195 * Fixed a bug: Plugin name is actually clean-and-simple-contact-form now (not contact-form) but this new name needed to be updated in the plugin settings definitions. I also needed to rename contact-form.php to clean-and-simple-contact-form.php. My thanks to Jakub for finding this bug. 196 * If your webpage is ssl then reCAPTCHA will now also use ssl mode. 197 198 199 == Upgrade Notice == 200 = 4.7.0 = 201 Tested with Wordpress version 4.9.6. Added 'consent to contact' GDPR compliance message 202 = 4.6.2 = 203 Updated translations. Tested up to WordPress 4.6.1. 204 = 4.6.0 = 205 Updated translations. Correct textdomain. Prevent multiple clicks. 206 = 4.5.1 = 207 Translation updates 208 = 4.5.0 = 209 Added support for Google Recaptcha2. Updated translation. Fixed layout bug. 210 = 4.4.4 = 211 Added languages, css fix for twenty fifteen theme, remove 'notice' errors, remove empty divs 212 = 4.4.3 = 213 Tested up to 4.1 214 = 4.4.2 = 215 Akismet tweak and translation updates 216 = 4.4.1 = 217 Fixed XSS issue 218 = 4.4.0 = 219 Added option for enquiry to email themselves a copy of the message plus Polish translation updated 220 = 4.3.4 = 221 Email now includes page url of contact form, removed link in main contact form view 222 = 4.3.3 = 223 Hebrew Language added, name field moved to top of form, added 'reply-to' 224 = 4.3.2 = 225 Added Norwegian and Brazilian Portugese Translations 226 = 4.3.1 = 227 Checked compatibility with WP 3.8 and TwentyFourteen theme, translation updates, defaults for new installations 228 = 4.3.0 = 229 Contact form is now filtered for spam when the Akismet plugin is present. 230 [Learn more](http://www.megnicholas.co.uk/articles/contact-form-plugin-can-detect-spam/ "Learn More"). 231 = 4.2.5 = 232 Small bug fix 233 = 4.2.4 = 234 'Confirm Email' can now be turned off. Arabic translation added. 235 = 4.2.3 = 236 Multiple recipients are now possible 237 = 4.2.2 = 238 Remove ALL possibility of conflicts with other plugins that also include Google reCAPTCHA library 239 = 4.2.1 = 240 Translation and housekeeping updates 241 = 4.2.0 = 242 Translation and documentation updates 243 = 4.1.9 = 244 Support for [Bootstrap 3](http://www.megnicholas.co.uk/articles/version-4-1-9-supports-bootstrap-3/ "More information on 4.1.9") 245 = 4.1.8 = 246 Added Russian translation and some modifications to Estonian and Spanish translations 247 = 4.1.7 248 More translations. A helpful note about the short code to use has been put on the settings screen 249 = 4.1.6 = 250 Ability to specify a 'From' address. This email will be used to send the mail instead of the form filler's email address. 251 = 4.1.5 = 252 Works with themes that pre-process the html. 253 = 4.1.4 = 254 New translations - Slovak and Catalan 255 = 4.1.3 = 256 Form now submits via ajax! 257 = 4.1.2 = 258 Alternative shortcode, recaptcha internationalisation, Jetpack conflict warning notice 259 = 4.1.1 = 260 Internationalisation, fixed conflict with some bootstrapped themes. 261 = 4.1.0 = 262 Please upgrade if your settings screen is not displaying. 263 = 4.0.9 = 264 More customisation: recipient email address, and email subject. 265 = 4.0.8 = 266 Ajax now works when your form has reCAPTCHA on it. Ajax validation is now cleaner. 267 = 4.0.7 = 268 Fixed a bug which occurred when plugin name was changed. reCAPTCHA will now use ssl if your webpage is ssl. 204 * Added alternative shortcode -
clean-and-simple-contact-form-by-meg-nicholas/trunk/class.cscf.php
r3254319 r3339262 21 21 $this, 22 22 'RegisterAdminStyles', 23 ) );24 25 add_action( 'init', array(26 $this,27 'RegisterTextDomain',28 23 ) ); 29 24 … … 44 39 //create the settings page 45 40 $settings = new cscf_settings(); 46 }47 48 49 function RegisterTextDomain() {50 //$path = CSCF_PLUGIN_DIR . '/languages';51 $path = '/' . CSCF_PLUGIN_NAME . '/languages';52 load_plugin_textdomain( 'clean-and-simple-contact-form-by-meg-nicholas', false, $path );53 41 } 54 42 -
clean-and-simple-contact-form-by-meg-nicholas/trunk/class.cscf_contact.php
r3254319 r3339262 19 19 var $PostID; 20 20 var $IsSpam; 21 var $IsRestApi = false; 21 22 22 23 function __construct() { … … 28 29 } 29 30 $request_method = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD']??'' ) ); 30 if ( $request_method === 'POST' ) {31 if ( $request_method === 'POST' && ! $this->IsRestApi ) { 31 32 // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- No action, nonce is not required for $_POST['cscf_nonce'] check later, array sanitized 32 33 if ( isset( $_POST['cscf'] ) ) { … … 73 74 } 74 75 76 /** 77 * Set contact data from array (used by REST API) 78 * 79 * @param array $data Contact form data 80 * @param int $post_id Post ID where form was submitted from 81 * @param bool $is_rest_api Whether this is a REST API request 82 */ 83 public function set_from_array( $data, $post_id = null, $is_rest_api = false ) { 84 $this->IsRestApi = $is_rest_api; 85 86 // Filter to allow modification of form data before processing 87 $data = apply_filters( 'cscf_form_data', $data, $post_id, $is_rest_api ); 88 89 if ( isset( $data['name'] ) ) { 90 $this->Name = sanitize_text_field( $data['name'] ); 91 } 92 if ( isset( $data['email'] ) ) { 93 $this->Email = sanitize_email( $data['email'] ); 94 } 95 if ( isset( $data['confirm-email'] ) ) { 96 $this->ConfirmEmail = sanitize_email( $data['confirm-email'] ); 97 } 98 if ( isset( $data['email-sender'] ) ) { 99 $this->EmailToSender = $data['email-sender'] ? true : false; 100 } 101 if ( isset( $data['message'] ) ) { 102 $this->Message = sanitize_textarea_field( $data['message'] ); 103 } 104 if ( isset( $data['phone-number'] ) ) { 105 $this->PhoneNumber = sanitize_text_field( $data['phone-number'] ); 106 } 107 if ( isset( $data['contact-consent'] ) ) { 108 $this->ContactConsent = $data['contact-consent'] ? true : false; 109 } 110 if ( $post_id !== null ) { 111 $this->PostID = absint( $post_id ); 112 } 113 } 114 75 115 public function IsValid() { 76 116 $this->Errors = array(); 77 117 $request_method = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD']??'' ) ); 78 if ( $request_method !== 'POST' ) {118 if ( $request_method !== 'POST' && ! $this->IsRestApi ) { 79 119 return false; 80 120 } 81 121 82 //check nonce 83 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- No action, not stored just a nonce check 84 if ( ! wp_verify_nonce( $_POST['cscf_nonce'] ?? '', 'cscf_contact' ) ) { 85 return false; 122 //check nonce (skip for REST API as it uses WordPress authentication) 123 if ( ! $this->IsRestApi ) { 124 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- No action, not stored just a nonce check 125 if ( ! wp_verify_nonce( $_POST['cscf_nonce'] ?? '', 'cscf_contact' ) ) { 126 return false; 127 } 86 128 } 87 129 … … 120 162 } 121 163 122 //mandatory phone number 123 if ( cscf_PluginSettings::PhoneNumber() && cscf_PluginSettings::PhoneNumberMandatory() ) { 124 if ( strlen( $this->PhoneNumber ) < 8 ) { 125 $this->Errors['confirm-email'] = esc_html__( 'Please enter a valid phone number.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 126 } 164 //phone number validation 165 if ( cscf_PluginSettings::PhoneNumber() && strlen( $this->PhoneNumber ) > 0 ) { 166 // Validate format - only allow digits, +, (), -, and spaces 167 if ( ! preg_match( '/^[0-9\+\(\)\-\s]+$/', $this->PhoneNumber ) ) { 168 $this->Errors['phone-number'] = esc_html__( 'Phone number can only contain numbers, +, (), - and spaces.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 169 } 170 // Check length for mandatory fields 171 elseif ( cscf_PluginSettings::PhoneNumberMandatory() && strlen( $this->PhoneNumber ) < 8 ) { 172 $this->Errors['phone-number'] = esc_html__( 'Please enter a valid phone number (minimum 8 characters).', 'clean-and-simple-contact-form-by-meg-nicholas' ); 173 } 174 } 175 // Check if phone is mandatory but not provided 176 elseif ( cscf_PluginSettings::PhoneNumber() && cscf_PluginSettings::PhoneNumberMandatory() && strlen( $this->PhoneNumber ) == 0 ) { 177 $this->Errors['phone-number'] = esc_html__( 'Please enter your phone number.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 127 178 } 128 179 … … 134 185 } 135 186 136 //check recaptcha but only if we have keys 137 if ( $this->RecaptchaPublicKey <> '' && $this->RecaptchaPrivateKey <> '' ) { 187 //check recaptcha but only if we have keys, not REST API, and no other validation errors 188 //This prevents reCAPTCHA from blocking users who need to fix other form errors 189 if ( $this->RecaptchaPublicKey <> '' && $this->RecaptchaPrivateKey <> '' && ! $this->IsRestApi && count( $this->Errors ) == 0 ) { 138 190 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- No action, no form fields are being saved 139 191 $resp = csf_RecaptchaV2::VerifyResponse( sanitize_text_field($_SERVER["REMOTE_ADDR"]??''), $this->RecaptchaPrivateKey, sanitize_text_field($_POST["g-recaptcha-response"]??'')); … … 153 205 return true; 154 206 } 207 208 // Action hook before sending email 209 do_action( 'cscf_before_send_email', $this ); 155 210 156 211 $filters = new cscf_Filters; … … 194 249 $filters->remove( 'wp_mail_from_name' ); 195 250 251 // Action hook after sending email 252 do_action( 'cscf_after_send_email', $this, $result ); 253 196 254 //send an email to the form-filler 197 255 if ( $this->EmailToSender ) { … … 228 286 } 229 287 288 // Action hook for successful form submission 289 if ( $result ) { 290 do_action( 'cscf_form_submitted', $this ); 291 } 292 230 293 return $result; 231 294 } -
clean-and-simple-contact-form-by-meg-nicholas/trunk/class.cscf_pluginsettings.php
r2561035 r3339262 193 193 return isset($options['confirm-email']) ? true : false; 194 194 } 195 196 static function RestApiEnabled() 197 { 198 $options = get_option(CSCF_OPTIONS_KEY); 199 return isset($options['enable_rest_api']) ? true : false; 200 } 201 202 static function RestApiCapability() 203 { 204 $options = get_option(CSCF_OPTIONS_KEY); 205 return isset($options['rest_api_capability']) ? $options['rest_api_capability'] : 'edit_posts'; 206 } 195 207 } 196 208 -
clean-and-simple-contact-form-by-meg-nicholas/trunk/class.cscf_settings.php
r3254319 r3339262 215 215 'recaptcha_private_key', 216 216 'class' => 'recaptcha-field', 217 ) ); 218 219 // REST API Settings 220 add_settings_section( 221 'section_rest_api', 222 '<h3>' . esc_html__( 'REST API Settings', 'clean-and-simple-contact-form-by-meg-nicholas' ) . '</h3>', 223 array( 224 $this, 225 'print_section_info_rest_api', 226 ), 227 'contact-form-settings' 228 ); 229 add_settings_field( 'enable_rest_api', esc_html__( 'Enable REST API :', 'clean-and-simple-contact-form-by-meg-nicholas' ), array( 230 $this, 231 'create_fields', 232 ), 'contact-form-settings', 'section_rest_api', array( 233 'enable_rest_api', 234 ) ); 235 add_settings_field( 'rest_api_capability', esc_html__( 'Required User Capability :', 'clean-and-simple-contact-form-by-meg-nicholas' ), array( 236 $this, 237 'create_fields', 238 ), 'contact-form-settings', 'section_rest_api', array( 239 'rest_api_capability', 217 240 ) ); 218 241 } … … 317 340 } 318 341 342 // REST API settings 343 if ( isset( $input['rest_api_capability'] ) ) { 344 $input['rest_api_capability'] = sanitize_text_field( $input['rest_api_capability'] ); 345 // Validate capability exists 346 if ( empty( $input['rest_api_capability'] ) ) { 347 $input['rest_api_capability'] = 'edit_posts'; 348 } 349 } 350 319 351 //tidy up the keys 320 352 $tidiedRecipients = array(); … … 343 375 //print 'Enter your styling settings below:'; 344 376 377 } 378 379 public function print_section_info_rest_api() { 380 echo '<p>'; 381 print esc_html__( 'Enable REST API support for headless WordPress implementations.', 'clean-and-simple-contact-form-by-meg-nicholas' ); 382 echo '</p><p>'; 383 print esc_html__( 'When enabled, authenticated users can submit the form via: POST /wp-json/cscf/v1/submit', 'clean-and-simple-contact-form-by-meg-nicholas' ); 384 echo '</p>'; 345 385 } 346 386 … … 516 556 name="<?php echo esc_attr( CSCF_OPTIONS_KEY ); ?>[use_client_validation]"><?php 517 557 break; 558 case 'enable_rest_api': 559 $checked = cscf_PluginSettings::RestApiEnabled() === true ? 'checked' : ''; 560 ?><label for="enable_rest_api" class="screen-reader-text"> 561 <?php esc_html_e('enable REST API', 'clean-and-simple-contact-form-by-meg-nicholas'); ?> 562 </label><input type="checkbox" <?php echo esc_attr( $checked ); ?> id="enable_rest_api" 563 name="<?php echo esc_attr( CSCF_OPTIONS_KEY ); ?>[enable_rest_api]"><?php 564 break; 565 case 'rest_api_capability': 566 $capability = cscf_PluginSettings::RestApiCapability(); 567 ?><label for="rest_api_capability" class="screen-reader-text"> 568 <?php esc_html_e('REST API required capability', 'clean-and-simple-contact-form-by-meg-nicholas'); ?> 569 </label><input type="text" size="40" id="rest_api_capability" 570 name="<?php echo esc_attr( CSCF_OPTIONS_KEY ); ?>[rest_api_capability]" 571 value="<?php echo esc_attr( $capability ); ?>" /> 572 <p class="description"><?php esc_html_e( 'Default: edit_posts. Common capabilities: edit_posts, publish_posts, manage_options', 'clean-and-simple-contact-form-by-meg-nicholas' ); ?></p><?php 573 break; 518 574 default: 519 575 break; -
clean-and-simple-contact-form-by-meg-nicholas/trunk/clean-and-simple-contact-form-by-meg-nicholas.php
r3254319 r3339262 8 8 Plugin URI: https://fullworks.net/products/clean-and-simple-contact-form 9 9 Description: A clean and simple contact form with Google reCAPTCHA and Twitter Bootstrap markup. 10 Version: 4.1 010 Version: 4.11 11 11 Requires at least: 5.6 12 12 Requires PHP: 7.4 … … 50 50 require 'class.view.php'; 51 51 require 'class.cscf_filters.php'; 52 require 'class.cscf_rest_api.php'; 52 53 require 'ajax.php'; 53 54 require 'recaptchav2.php'; … … 75 76 76 77 if ( ! defined( 'CSCF_VERSION_NUM' ) ) { 77 define( 'CSCF_VERSION_NUM', '4.1 0' );78 define( 'CSCF_VERSION_NUM', '4.11' ); 78 79 } 79 80 … … 91 92 92 93 $cscf = new cscf(); 94 $cscf_rest_api = new cscf_rest_api(); 95 96 // Configure SMTP if constants are defined 97 if ( defined( 'CSCF_USE_SMTP' ) && CSCF_USE_SMTP ) { 98 add_action( 'phpmailer_init', function( $phpmailer ) { 99 $phpmailer->isSMTP(); 100 101 // Required settings 102 if ( defined( 'CSCF_SMTP_HOST' ) ) { 103 $phpmailer->Host = CSCF_SMTP_HOST; 104 } 105 106 if ( defined( 'CSCF_SMTP_PORT' ) ) { 107 $phpmailer->Port = (int) CSCF_SMTP_PORT; 108 } 109 110 // Authentication settings 111 if ( defined( 'CSCF_SMTP_AUTH' ) && CSCF_SMTP_AUTH ) { 112 $phpmailer->SMTPAuth = true; 113 114 if ( defined( 'CSCF_SMTP_USER' ) ) { 115 $phpmailer->Username = CSCF_SMTP_USER; 116 } 117 118 if ( defined( 'CSCF_SMTP_PASS' ) ) { 119 $phpmailer->Password = CSCF_SMTP_PASS; 120 } 121 } else { 122 $phpmailer->SMTPAuth = false; 123 } 124 125 // Security settings 126 if ( defined( 'CSCF_SMTP_SECURE' ) ) { 127 $phpmailer->SMTPSecure = CSCF_SMTP_SECURE; // 'tls' or 'ssl' or empty string 128 } 129 130 // Optional: From email override 131 if ( defined( 'CSCF_SMTP_FROM' ) ) { 132 $phpmailer->From = CSCF_SMTP_FROM; 133 } 134 135 // Optional: From name override 136 if ( defined( 'CSCF_SMTP_FROM_NAME' ) ) { 137 $phpmailer->FromName = CSCF_SMTP_FROM_NAME; 138 } 139 140 // Debug mode 141 if ( defined( 'CSCF_SMTP_DEBUG' ) && CSCF_SMTP_DEBUG ) { 142 $phpmailer->SMTPDebug = 2; 143 } 144 }); 145 } 93 146 94 147 /*get the current version and update options to the new option*/ -
clean-and-simple-contact-form-by-meg-nicholas/trunk/js/jquery.validate.contact.form.js
r2551686 r3339262 7 7 $form.find("#recaptcha_response_field").focus(function () { 8 8 9 $errele = $form.find(" div[for='cscf_recaptcha']");9 $errele = $form.find("span[for='cscf_recaptcha']"); 10 10 $errele.html(''); 11 11 … … 56 56 jQuery('html,body') 57 57 .animate({ 58 scrollTop: jQuery($div.selector) 59 .offset().top 58 scrollTop: $div.offset().top 60 59 }, 'slow'); 61 60 } … … 63 62 64 63 else { 64 // Clear any previous errors first 65 $form.find("span.help-inline.help-block.error").html('').css('display', 'none'); 66 $form.find('.form-group').removeClass('has-error').addClass('has-success'); 67 $form.find('.control-group').removeClass('error').addClass('success'); 68 65 69 $.each(response.errorlist, function (name, value) { 66 $errele = $form.find("div[for='cscf_" + name + "']"); 67 $errele.html(value); 68 $errele.closest('.form-group').removeClass('has-success').addClass('has-error'); 69 $errele.closest('.control-group').removeClass('success').addClass('error'); // support for bootstrap 2 70 // Debug logging 71 if (window.console) { 72 console.log("Error for field: " + name + ", message: " + value); 73 } 74 75 $errele = $form.find("span[for='cscf_" + name + "']"); 76 if ($errele.length > 0) { 77 $errele.html(value); 78 $errele.css('display', 'block'); 79 $errele.closest('.form-group').removeClass('has-success').addClass('has-error'); 80 $errele.closest('.control-group').removeClass('success').addClass('error'); // support for bootstrap 2 81 } else if (window.console) { 82 console.log("Could not find error element for: cscf_" + name); 83 } 70 84 }); 71 85 $button.removeAttr("disabled"); -
clean-and-simple-contact-form-by-meg-nicholas/trunk/languages/clean-and-simple-contact-form-by-meg-nicholas-pl_PL.po
r3142234 r3339262 7 7 "PO-Revision-Date: 2024-08-27 12:26+0100\n" 8 8 "Last-Translator: \n" 9 "Language-Team: Kacper Ruciński <kacper.rucinski@gmail.com>\n"9 "Language-Team: Kacper Ruciński\n" 10 10 "Language: pl_PL\n" 11 11 "MIME-Version: 1.0\n" … … 42 42 #: clean-and-simple-contact-form-by-meg-nicholas/views/contact-form.view.php:34 43 43 msgid "Please give your name." 44 msgstr "Prosimy wpisać imię i nazwisko."44 msgstr "Prosimy się przedstawić." 45 45 46 46 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:110 47 47 msgid "Please enter a message." 48 msgstr "Prosimy wp isać wiadomość."48 msgstr "Prosimy wprowadzić wiadomość." 49 49 50 50 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:115, … … 52 52 #: clean-and-simple-contact-form-by-meg-nicholas/views/contact-form.view.php:93 53 53 msgid "Please enter a valid email address." 54 msgstr "Prosimy wp isać poprawny adres e-mail."54 msgstr "Prosimy wprowadzić poprawny adres e-mail." 55 55 56 56 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:121 57 57 msgid "Please enter a valid phone number." 58 msgstr "Pros zęwprowadzić poprawny numer telefonu."58 msgstr "Prosimy wprowadzić poprawny numer telefonu." 59 59 60 60 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:128, … … 65 65 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:137 66 66 msgid "Please solve the recaptcha to continue." 67 msgstr "Pros zę rozwiązać recaptcha, aby kontynuować."67 msgstr "Prosimy rozwiązać reCAPTCHA, aby kontynuować." 68 68 69 69 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:170 … … 82 82 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:175 83 83 msgid "Page URL" 84 msgstr " Strona URL"84 msgstr "URL strony" 85 85 86 86 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_contact.php:176, … … 129 129 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:30 130 130 msgid "Contact Form Settings" 131 msgstr "Ustawienia Contact Form"131 msgstr "Ustawienia formularza kontaktowego" 132 132 133 133 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:31 134 134 msgid "Contact Form" 135 msgstr " Contact Form"135 msgstr "Formularz kontaktowy" 136 136 137 137 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:43 138 138 msgid "Clean and Simple Contact Form Settings" 139 msgstr "Ustawienia Clean and Simple Contact Form"139 msgstr "Ustawienia wtyczki Przejrzysty i prosty formularz kontaktowy" 140 140 141 141 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:52 … … 223 223 "Use the plugin default stylesheet (un-tick to use your theme style sheet " 224 224 "instead) :" 225 msgstr "Użyj domyślnego stylu wtyczki (odznacz, aby użyć stylów motywu "225 msgstr "Użyj domyślnego stylu wtyczki (odznacz, aby użyć stylów motywu):" 226 226 227 227 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:168 … … 235 235 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:187 236 236 msgid "Use reCAPTCHA :" 237 msgstr "Użyj reCAPTCHA :"237 msgstr "Użyj reCAPTCHA:" 238 238 239 239 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:194 … … 255 255 msgstr "" 256 256 "Najlepszym sposobem na okazanie uznania dla tej darmowej wtyczki i " 257 " utrzymanie jejjest wsparcie jej poprzez zainstalowanie Fullworks Anti Spam "257 "jej utrzymanie jest wsparcie jej poprzez zainstalowanie Fullworks Anti Spam " 258 258 "Pro" 259 259 … … 263 263 "compare it with Akismet, yet extremely effective." 264 264 msgstr "" 265 " Dzięki 14-dniowemu bezpłatnemu okresowi próbnemu jest on zaskakująco"266 " przystępnycenowo w porównaniu z Akismet, a jednocześnie niezwykle skuteczny."265 "Oferując darmowy 14-dniowy okres próbny, jest on zaskakująco przystępny " 266 "cenowo w porównaniu z Akismet, a jednocześnie niezwykle skuteczny." 267 267 268 268 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:226, … … 273 273 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:221 274 274 msgid "Congratulations: you are protected by Fullworks Anti Spam" 275 msgstr "Gratulacje : jesteś chroniony przezFullworks Anti Spam"275 msgstr "Gratulacje! Ochronę zapewnia Ci Fullworks Anti Spam" 276 276 277 277 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:222 278 278 msgid "Configure" 279 msgstr " Konfiguracja"279 msgstr "Skonfiguruj" 280 280 281 281 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:222 … … 291 291 "With a 14 day free trial, will automatically log all messages from this form." 292 292 msgstr "" 293 " Dzięki 14-dniowemu bezpłatnemu okresowi próbnemu automatycznie rejestruje "294 "w szystkie wiadomości z tego formularza."293 "Oferując darmowy 14-dniowy okres próbny, automatycznie rejestruje wszystkie " 294 "wiadomości z tego formularza." 295 295 296 296 #: clean-and-simple-contact-form-by-meg-nicholas/class.cscf_settings.php:243 … … 402 402 403 403 #~ msgid "Clean and Simple Contact Form!" 404 #~ msgstr " Clean and Simple Contact Form!"404 #~ msgstr "Przejrzysty i prosty formularz kontaktowy!" 405 405 406 406 #~ msgid "You are using version" … … 420 420 421 421 #~ msgid "*New*" 422 #~ msgstr "*Now e*"422 #~ msgstr "*Nowość*" 423 423 424 424 #~ msgid "Clean and Simple Contact Form" 425 #~ msgstr " Czyste i proste Formularz kontaktowy"425 #~ msgstr "Przejrzysty i prosty formularz kontaktowy" 426 426 427 427 #~ msgid "" … … 436 436 #~ "Bootstrap markup." 437 437 #~ msgstr "" 438 #~ " Czysty i prosty formularz kontaktowy z Google i Twitter Bootstrap"439 #~ "reCAPTCHA znaczników."438 #~ "Przejrzysty i prosty formularz kontaktowy z Google reCAPTCHA i znacznikami " 439 #~ Twitter Bootstrap." 440 440 441 441 #~ msgid "Meghan Nicholas" … … 446 446 447 447 #~ msgid "Sorry the code wasn't entered correctly please try again." 448 #~ msgstr "" 449 #~ "Przepraszamy, kod nie został wprowadzony poprawnie. Spróbuj ponownie." 448 #~ msgstr "Przepraszamy, kod nie został wprowadzony poprawnie. Spróbuj ponownie." 450 449 451 450 #~ msgid "Red" -
clean-and-simple-contact-form-by-meg-nicholas/trunk/languages/clean-and-simple-contact-form-by-meg-nicholas.pot
r3254319 r3339262 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: C lean and Simple Contact Form 4.10\n"5 "Project-Id-Version: Contact Form Clean and Simple 4.11\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/clean-and-simple-contact-form-by-meg-nicholas\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-0 3-10T17:28:16+00:00\n"12 "POT-Creation-Date: 2025-08-04T19:28:59+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.10.0\n" … … 17 17 #. Plugin Name of the plugin 18 18 #: clean-and-simple-contact-form-by-meg-nicholas.php 19 msgid "C lean and Simple Contact Form"19 msgid "Contact Form Clean and Simple" 20 20 msgstr "" 21 21 … … 40 40 msgstr "" 41 41 42 #: class.cscf.php:68 43 msgid "Settings" 44 msgstr "" 45 46 #: class.cscf_contact.php:91 42 #: class.cscf_contact.php:133 47 43 msgid "Sorry the email addresses do not match." 48 44 msgstr "" 49 45 50 #: class.cscf_contact.php: 9746 #: class.cscf_contact.php:139 51 47 #: views/contact-form.view.php:63 52 48 msgid "Please give your email address." 53 49 msgstr "" 54 50 55 #: class.cscf_contact.php:1 0351 #: class.cscf_contact.php:145 56 52 msgid "Please confirm your email address." 57 53 msgstr "" 58 54 59 #: class.cscf_contact.php:1 0955 #: class.cscf_contact.php:151 60 56 #: views/contact-form.view.php:34 61 57 msgid "Please give your name." 62 58 msgstr "" 63 59 64 #: class.cscf_contact.php:1 1460 #: class.cscf_contact.php:156 65 61 msgid "Please enter a message." 66 62 msgstr "" 67 63 68 #: class.cscf_contact.php:1 1964 #: class.cscf_contact.php:161 69 65 #: views/contact-form.view.php:64 70 66 #: views/contact-form.view.php:93 … … 72 68 msgstr "" 73 69 74 #: class.cscf_contact.php:1 2570 #: class.cscf_contact.php:167 75 71 msgid "Please enter a valid phone number." 76 72 msgstr "" 77 73 78 #: class.cscf_contact.php:1 3274 #: class.cscf_contact.php:174 79 75 #: views/contact-form.view.php:198 80 76 msgid "Please give your consent." 81 77 msgstr "" 82 78 83 #: class.cscf_contact.php:1 4279 #: class.cscf_contact.php:184 84 80 msgid "Please solve the recaptcha to continue." 85 81 msgstr "" 86 82 87 #: class.cscf_contact.php: 17583 #: class.cscf_contact.php:220 88 84 msgid "From" 89 85 msgstr "" 90 86 91 #: class.cscf_contact.php: 17687 #: class.cscf_contact.php:221 92 88 msgid "Email" 93 89 msgstr "" 94 90 95 #: class.cscf_contact.php: 17896 #: class.cscf_contact.php:2 1991 #: class.cscf_contact.php:223 92 #: class.cscf_contact.php:267 97 93 msgid "Phone" 98 94 msgstr "" 99 95 100 #: class.cscf_contact.php: 18096 #: class.cscf_contact.php:225 101 97 msgid "Page URL" 102 98 msgstr "" 103 99 104 #: class.cscf_contact.php: 181105 #: class.cscf_contact.php:2 21100 #: class.cscf_contact.php:226 101 #: class.cscf_contact.php:269 106 102 msgid "Message" 107 103 msgstr "" 108 104 109 #: class.cscf_contact.php: 183110 #: class.cscf_contact.php:2 16105 #: class.cscf_contact.php:228 106 #: class.cscf_contact.php:264 111 107 msgid "yes" 112 108 msgstr "" 113 109 114 #: class.cscf_contact.php: 183115 #: class.cscf_contact.php:2 16110 #: class.cscf_contact.php:228 111 #: class.cscf_contact.php:264 116 112 msgid "no" 117 113 msgstr "" 118 114 119 #: class.cscf_contact.php:2 14115 #: class.cscf_contact.php:262 120 116 msgid "Here is a copy of your message :" 121 117 msgstr "" … … 141 137 msgstr "" 142 138 139 #: class.cscf_rest_api.php:48 140 msgid "Authentication required." 141 msgstr "" 142 143 #: class.cscf_rest_api.php:58 144 msgid "Insufficient permissions." 145 msgstr "" 146 147 #: class.cscf_rest_api.php:96 148 msgid "Validation failed." 149 msgstr "" 150 151 #: class.cscf_rest_api.php:110 152 msgid "Failed to send email." 153 msgstr "" 154 143 155 #: class.cscf_settings.php:29 144 156 msgid "Contact Form Settings" … … 261 273 msgstr "" 262 274 263 #: class.cscf_settings.php:224 275 #: class.cscf_settings.php:222 276 msgid "REST API Settings" 277 msgstr "" 278 279 #: class.cscf_settings.php:229 280 msgid "Enable REST API :" 281 msgstr "" 282 283 #: class.cscf_settings.php:235 284 msgid "Required User Capability :" 285 msgstr "" 286 287 #: class.cscf_settings.php:247 264 288 msgid "Congratulations: you are protected by Fullworks Anti Spam" 265 289 msgstr "" 266 290 267 #: class.cscf_settings.php:2 25291 #: class.cscf_settings.php:248 268 292 msgid "Configure" 269 293 msgstr "" 270 294 271 #: class.cscf_settings.php:2 25295 #: class.cscf_settings.php:248 272 296 msgid "Anti Spam Settings here" 273 297 msgstr "" 274 298 275 #: class.cscf_settings.php:2 27299 #: class.cscf_settings.php:250 276 300 msgid "The best way to show your appreciation for this free plugin and keep it maintained is to support it by installing Fullworks Anti Spam Pro" 277 301 msgstr "" 278 302 279 #: class.cscf_settings.php:2 28303 #: class.cscf_settings.php:251 280 304 msgid "With a 14 day free trial, you will find it surprisingly affordable when you compare it with Akismet, yet extremely effective." 281 305 msgstr "" 282 306 283 #: class.cscf_settings.php:2 29284 #: class.cscf_settings.php:2 32307 #: class.cscf_settings.php:252 308 #: class.cscf_settings.php:255 285 309 msgid "Try Fullworks Anti Spam Pro now and support the maintenance this FREE contact form plugin" 286 310 msgstr "" 287 311 288 #: class.cscf_settings.php:2 39312 #: class.cscf_settings.php:262 289 313 msgid "Message logging is enabled by Fullworks Anti Spam Pro" 290 314 msgstr "" 291 315 292 #: class.cscf_settings.php:2 41316 #: class.cscf_settings.php:264 293 317 msgid "View Logs here" 294 318 msgstr "" 295 319 296 #: class.cscf_settings.php:2 43320 #: class.cscf_settings.php:266 297 321 msgid "Enable message log by installing Fullworks Anti Spam Pro" 298 322 msgstr "" 299 323 300 #: class.cscf_settings.php:2 44324 #: class.cscf_settings.php:267 301 325 msgid "With a 14 day free trial, will automatically log all messages from this form." 302 326 msgstr "" 303 327 304 #: class.cscf_settings.php:2 45328 #: class.cscf_settings.php:268 305 329 msgid "Enable logs now" 306 330 msgstr "" 307 331 308 #: class.cscf_settings.php:3 32332 #: class.cscf_settings.php:364 309 333 msgid "Enter your reCAPTCHA settings below :" 310 334 msgstr "" 311 335 312 #: class.cscf_settings.php:3 33336 #: class.cscf_settings.php:365 313 337 msgid "To use reCAPTCHA you must get an API key from" 314 338 msgstr "" 315 339 316 #: class.cscf_settings.php:3 38340 #: class.cscf_settings.php:370 317 341 msgid "Enter your message settings below :" 318 342 msgstr "" 319 343 320 #: class.cscf_settings.php:459 344 #: class.cscf_settings.php:381 345 msgid "Enable REST API support for headless WordPress implementations." 346 msgstr "" 347 348 #: class.cscf_settings.php:383 349 msgid "When enabled, authenticated users can submit the form via: POST /wp-json/cscf/v1/submit" 350 msgstr "" 351 352 #: class.cscf_settings.php:396 353 msgid "use recaptcha" 354 msgstr "" 355 356 #: class.cscf_settings.php:403 357 msgid "load stylesheet" 358 msgstr "" 359 360 #: class.cscf_settings.php:410 361 msgid "recaptcha public key" 362 msgstr "" 363 364 #: class.cscf_settings.php:418 365 msgid "recaptcha private key" 366 msgstr "" 367 368 #: class.cscf_settings.php:430 369 msgid "recipient email" 370 msgstr "" 371 372 #: class.cscf_settings.php:437 373 msgid "add button for new recipient email" 374 msgstr "" 375 376 #: class.cscf_settings.php:443 377 msgid "remove button for new recipient email" 378 msgstr "" 379 380 #: class.cscf_settings.php:457 381 msgid "confirm email" 382 msgstr "" 383 384 #: class.cscf_settings.php:464 385 msgid "override from address" 386 msgstr "" 387 388 #: class.cscf_settings.php:471 389 msgid "email to sender" 390 msgstr "" 391 392 #: class.cscf_settings.php:478 393 msgid "contact consent" 394 msgstr "" 395 396 #: class.cscf_settings.php:484 397 msgid "contact consent message" 398 msgstr "" 399 400 #: class.cscf_settings.php:492 401 msgid "phone number" 402 msgstr "" 403 404 #: class.cscf_settings.php:499 405 msgid "phone number mandatory" 406 msgstr "" 407 408 #: class.cscf_settings.php:506 409 msgid "from email address" 410 msgstr "" 411 412 #: class.cscf_settings.php:513 413 msgid "email subject" 414 msgstr "" 415 416 #: class.cscf_settings.php:519 417 msgid "sent message heading" 418 msgstr "" 419 420 #: class.cscf_settings.php:526 421 msgid "sent message body" 422 msgstr "" 423 424 #: class.cscf_settings.php:532 425 msgid "message" 426 msgstr "" 427 428 #: class.cscf_settings.php:540 429 msgid "recaptcha theme" 430 msgstr "" 431 432 #: class.cscf_settings.php:545 321 433 msgid "Light" 322 434 msgstr "" 323 435 324 #: class.cscf_settings.php: 461436 #: class.cscf_settings.php:547 325 437 msgid "Dark" 438 msgstr "" 439 440 #: class.cscf_settings.php:554 441 msgid "use client validation" 442 msgstr "" 443 444 #: class.cscf_settings.php:561 445 msgid "enable REST API" 446 msgstr "" 447 448 #: class.cscf_settings.php:568 449 msgid "REST API required capability" 450 msgstr "" 451 452 #: class.cscf_settings.php:572 453 msgid "Default: edit_posts. Common capabilities: edit_posts, publish_posts, manage_options" 454 msgstr "" 455 456 #. translators: %s is the path to the view file 457 #: class.view.php:25 458 msgid "View %s not found" 326 459 msgstr "" 327 460 -
clean-and-simple-contact-form-by-meg-nicholas/trunk/readme.txt
r3254319 r3339262 7 7 License URI: http://www.gnu.org/licenses/gpl.html 8 8 Tags: contact, form, contact form, feedback form, bootstrap 9 Tested up to: 6. 710 Stable tag: 4.1 09 Tested up to: 6.8 10 Stable tag: 4.11 11 11 12 12 A clean and simple contact form with Bootstrap markup. … … 14 14 15 15 == Description == 16 A clean and simple AJAX contact form with Google reCAPTCHA, Twitter Bootstrap markup and spam filtering.16 A clean and simple AJAX contact form with Google reCAPTCHA, Twitter Bootstrap markup, spam filtering, and REST API support for headless WordPress implementations. 17 17 18 18 * **Clean**: all user inputs are stripped in order to avoid cross-site scripting (XSS) vulnerabilities. … … 22 22 * **Stylish**: Use the included stylesheet or switch it off and use your own for seamless integration with your website. 23 23 Uses **Twitter Bootstrap** classes. 24 25 * **REST API Support**: Enable headless WordPress implementations to submit forms via authenticated REST API endpoints. 24 26 25 27 … … 66 68 * Original plugin written by an **experienced PHP programmer**, Megan Nicholas, the code is rock solid, safe, and rigorously tested as standard practice. 67 69 70 * **Headless WordPress ready**. REST API support allows you to submit forms from decoupled frontends, mobile apps, or any external application with proper authentication. 71 68 72 Hopefully this plugin will fulfil all your needs. 69 73 … … 136 140 137 141 * **Contact consent**: This option allows you to be GDPR compliant by adding a 'Consent to contact' check box at the bottom of the form. 142 143 * **Enable REST API**: Turn on REST API support to allow headless WordPress implementations to submit forms. 144 145 * **Required User Capability**: Set the minimum WordPress user capability required to use the REST API (default: edit_posts). 146 147 148 == REST API for Headless WordPress == 149 150 This plugin includes REST API support, making it perfect for headless WordPress implementations, mobile applications, and decoupled frontend frameworks like React, Vue.js, or Angular. 151 152 = Enabling REST API = 153 154 1. Go to the plugin settings page 155 2. Find the "REST API Settings" section 156 3. Check "Enable REST API" 157 4. Set the required user capability (default: edit_posts) 158 5. Save your settings 159 160 = API Endpoint = 161 162 **POST** `/wp-json/cscf/v1/submit` 163 164 = Authentication = 165 166 The REST API requires WordPress user authentication. Users must be logged in and have the capability specified in settings (default: edit_posts). 167 168 For headless implementations, you can use: 169 - Application Passwords (WordPress 5.6+) 170 - JWT Authentication plugins 171 - OAuth plugins 172 - Basic Authentication (development only) 173 174 = Request Format = 175 176 Send a POST request with JSON body: 177 178 ```json 179 { 180 "name": "John Doe", 181 "email": "john@example.com", 182 "confirm_email": "john@example.com", 183 "message": "Your message here", 184 "phone_number": "+1234567890", 185 "contact_consent": true, 186 "email_sender": false, 187 "post_id": 123 188 } 189 ``` 190 191 **Required fields:** 192 - `name`: Sender's name 193 - `email`: Sender's email address 194 - `message`: The message content 195 196 **Optional fields:** 197 - `confirm_email`: Required if email confirmation is enabled in settings 198 - `phone_number`: Required if phone number is set as mandatory in settings 199 - `contact_consent`: Required if contact consent is enabled in settings 200 - `email_sender`: Set to true to send a copy to the sender 201 - `post_id`: The ID of the page/post where the form would normally be displayed 202 203 = Response Format = 204 205 **Success Response (200):** 206 ```json 207 { 208 "success": true, 209 "message": "Message Sent" 210 } 211 ``` 212 213 **Validation Error Response (400):** 214 ```json 215 { 216 "code": "validation_failed", 217 "message": "Validation failed.", 218 "data": { 219 "status": 400, 220 "errors": { 221 "email": "Please enter a valid email address.", 222 "message": "Please enter a message." 223 } 224 } 225 } 226 ``` 227 228 **Authentication Error Response (401):** 229 ```json 230 { 231 "code": "rest_forbidden", 232 "message": "Authentication required.", 233 "data": { 234 "status": 401 235 } 236 } 237 ``` 238 239 = Example Implementation = 240 241 **JavaScript (fetch API):** 242 ```javascript 243 const formData = { 244 name: "John Doe", 245 email: "john@example.com", 246 confirm_email: "john@example.com", 247 message: "This is a test message from the REST API" 248 }; 249 250 fetch('https://yoursite.com/wp-json/cscf/v1/submit', { 251 method: 'POST', 252 headers: { 253 'Content-Type': 'application/json', 254 'Authorization': 'Bearer YOUR_AUTH_TOKEN' 255 }, 256 body: JSON.stringify(formData) 257 }) 258 .then(response => response.json()) 259 .then(data => { 260 if (data.success) { 261 console.log('Message sent successfully!'); 262 } else { 263 console.error('Validation errors:', data.data.errors); 264 } 265 }); 266 ``` 267 268 = Important Notes = 269 270 - REST API is disabled by default for security 271 - reCAPTCHA is bypassed for REST API submissions (authentication provides security) 272 - All other form validations and spam filtering still apply 273 - Form submissions via REST API are processed identically to regular submissions 274 - Email notifications work the same way as standard form submissions 138 275 139 276 -
clean-and-simple-contact-form-by-meg-nicholas/trunk/shortcodes/contact-form.php
r2551686 r3339262 9 9 if ( $contact->IsValid() ) { 10 10 if ( $contact->SendMail() ) { 11 // Action hook for standard form submission 12 do_action( 'cscf_form_submitted_standard', $contact ); 13 11 14 $view = new CSCF_View( 'message-sent' ); 12 15 $view->Set( 'heading', cscf_PluginSettings::SentMessageHeading() ); -
clean-and-simple-contact-form-by-meg-nicholas/trunk/vendor/autoload.php
r3254319 r3339262 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 23 20 require_once __DIR__ . '/composer/autoload_real.php'; 24 21 25 return ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c::getLoader();22 return ComposerAutoloaderInit27d86f03d1c986263483b369986ee068::getLoader(); -
clean-and-simple-contact-form-by-meg-nicholas/trunk/vendor/composer/InstalledVersions.php
r3254319 r3339262 28 28 { 29 29 /** 30 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 31 * @internal 32 */ 33 private static $selfDir = null; 34 35 /** 30 36 * @var mixed[]|null 31 37 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 32 38 */ 33 39 private static $installed; 40 41 /** 42 * @var bool 43 */ 44 private static $installedIsLocalDir; 34 45 35 46 /** … … 310 321 self::$installed = $data; 311 322 self::$installedByVendor = array(); 323 324 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 325 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 326 // so we have to assume it does not, and that may result in duplicate data being returned when listing 327 // all installed packages for example 328 self::$installedIsLocalDir = false; 329 } 330 331 /** 332 * @return string 333 */ 334 private static function getSelfDir() 335 { 336 if (self::$selfDir === null) { 337 self::$selfDir = strtr(__DIR__, '\\', '/'); 338 } 339 340 return self::$selfDir; 312 341 } 313 342 … … 323 352 324 353 $installed = array(); 354 $copiedLocalDir = false; 325 355 326 356 if (self::$canGetVendors) { 357 $selfDir = self::getSelfDir(); 327 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 359 $vendorDir = strtr($vendorDir, '\\', '/'); 328 360 if (isset(self::$installedByVendor[$vendorDir])) { 329 361 $installed[] = self::$installedByVendor[$vendorDir]; … … 331 363 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 332 364 $required = require $vendorDir.'/composer/installed.php'; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 365 self::$installedByVendor[$vendorDir] = $required; 366 $installed[] = $required; 367 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 368 self::$installed = $required; 369 self::$installedIsLocalDir = true; 336 370 } 371 } 372 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 373 $copiedLocalDir = true; 337 374 } 338 375 } … … 351 388 } 352 389 353 if (self::$installed !== array() ) {390 if (self::$installed !== array() && !$copiedLocalDir) { 354 391 $installed[] = self::$installed; 355 392 } -
clean-and-simple-contact-form-by-meg-nicholas/trunk/vendor/composer/autoload_real.php
r3254319 r3339262 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c5 class ComposerAutoloaderInit27d86f03d1c986263483b369986ee068 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit27d86f03d1c986263483b369986ee068', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit de3652cf7e4bf8e2010815060c1bc76c', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit27d86f03d1c986263483b369986ee068', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit27d86f03d1c986263483b369986ee068::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
clean-and-simple-contact-form-by-meg-nicholas/trunk/vendor/composer/autoload_static.php
r3254319 r3339262 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c7 class ComposerStaticInit27d86f03d1c986263483b369986ee068 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 38 38 { 39 39 return \Closure::bind(function () use ($loader) { 40 $loader->prefixLengthsPsr4 = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$prefixLengthsPsr4;41 $loader->prefixDirsPsr4 = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$prefixDirsPsr4;42 $loader->prefixesPsr0 = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$prefixesPsr0;43 $loader->classMap = ComposerStaticInit de3652cf7e4bf8e2010815060c1bc76c::$classMap;40 $loader->prefixLengthsPsr4 = ComposerStaticInit27d86f03d1c986263483b369986ee068::$prefixLengthsPsr4; 41 $loader->prefixDirsPsr4 = ComposerStaticInit27d86f03d1c986263483b369986ee068::$prefixDirsPsr4; 42 $loader->prefixesPsr0 = ComposerStaticInit27d86f03d1c986263483b369986ee068::$prefixesPsr0; 43 $loader->classMap = ComposerStaticInit27d86f03d1c986263483b369986ee068::$classMap; 44 44 45 45 }, null, ClassLoader::class); -
clean-and-simple-contact-form-by-meg-nicholas/trunk/vendor/composer/installed.php
r3254319 r3339262 2 2 'root' => array( 3 3 'name' => 'fullworks/clean-and-simple-contact-form', 4 'pretty_version' => ' dev-main',5 'version' => ' dev-main',6 'reference' => ' 6057cf8bf7c1cd56b1f7d6b170e7208543f25dde',4 'pretty_version' => 'v4.11', 5 'version' => '4.11.0.0', 6 'reference' => '801b967317613364d9e34394960f064495cb2283', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 30 30 ), 31 31 'fullworks/clean-and-simple-contact-form' => array( 32 'pretty_version' => ' dev-main',33 'version' => ' dev-main',34 'reference' => ' 6057cf8bf7c1cd56b1f7d6b170e7208543f25dde',32 'pretty_version' => 'v4.11', 33 'version' => '4.11.0.0', 34 'reference' => '801b967317613364d9e34394960f064495cb2283', 35 35 'type' => 'wordpress-plugin', 36 36 'install_path' => __DIR__ . '/../../', -
clean-and-simple-contact-form-by-meg-nicholas/trunk/vendor/composer/platform_check.php
r3142234 r3339262 20 20 } 21 21 } 22 trigger_error( 23 'Composer detected issues in your platform: ' . implode(' ', $issues), 24 E_USER_ERROR 22 throw new \RuntimeException( 23 'Composer detected issues in your platform: ' . implode(' ', $issues) 25 24 ); 26 25 }
Note: See TracChangeset
for help on using the changeset viewer.