Skip to content

Commit

Permalink
Merge pull request #6 from bootscore/5.0.0.4
Browse files Browse the repository at this point in the history
5.0.0.4
  • Loading branch information
crftwrk authored Dec 11, 2022
2 parents d34e19b + dfcff1e commit 16a215e
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 44 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 The bootScore Contributors
Copyright (c) 2021 - 2022 The bootScore Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ Documentation: https://bootscore.me/documentation/bs-contact-form-7/

</div>

[acceptance acceptance-789 id:gdpr class:form-check-input use_label_element]I have read the <a href="https://yourdomain.com/privacy-policy/" target="_blank">privacy policy</a> note. I consent to the electronic storage and processing of my entered data to answer my request. Note: You can revoke your consent at any time in the future by emailing <a href="mailto:[email protected]">[email protected]</a>.[/acceptance]
<p>[acceptance acceptance-789 id:gdpr class:form-check-input use_label_element]I have read the <a href="https://yourdomain.com/privacy-policy/" target="_blank">privacy policy</a> note. I consent to the electronic storage and processing of my entered data to answer my request. Note: You can revoke your consent at any time in the future by emailing <a href="mailto:[email protected]">[email protected]</a>.[/acceptance]</p>

<button type="submit" class="btn btn-primary wpcf7-submit" disabled="disabled"><span class="spinner-border spinner-border-sm ajax-loader" role="status" aria-hidden="true"></span>Send Message</button>
<p><button type="submit" class="btn btn-primary w-100 wpcf7-submit" disabled="disabled">Send Message</button></p>
```

### Mail recipient
Expand Down
51 changes: 32 additions & 19 deletions css/contactform-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,6 @@ span.wpcf7-not-valid-tip {
display: none;
}

.wpcf7 .ajax-loader::before {
display: none;
}

.wpcf7-form .ajax-loader {
width: 0rem;
height: 1rem;
margin: 0 0 0 -.3rem;
opacity: 0;
transition: margin .3s, width .3s, opacity .1s;
}

.wpcf7-form.submitting .ajax-loader {
margin: 0 .5rem 0 0;
opacity: 1;
width: 1rem !important;
transition: margin .3s, width .3s, opacity .3s .3s ease;
}

.screen-reader-response {
display: none;
}
Expand Down Expand Up @@ -52,3 +33,35 @@ button.btn.btn-primary.wpcf7-submit:disabled {
.wpcf7-form.submitting .wpcf7-response-output {
display: none;
}

/* Hide HTML spinner until v5.0.0.3 form markup */
.wpcf7-submit span {
display: none !important;
}

.wpcf7 .ajax-loader::before {
display: none;
}

/* New spinner since v5.0.0.4 */
.wpcf7-submit {
position: relative;
}

.wpcf7-submit .ajax-loader {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
background-color: var(--bs-btn-bg);
border-radius: var(--bs-btn-border-radius);
opacity: 0;
}

.wpcf7-form.submitting .ajax-loader {
opacity: 1;
}
7 changes: 4 additions & 3 deletions js/contactform-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jQuery(document).ready(function ($) {
$('button.wpcf7-submit').attr('disabled', 'disabled');
}, false);


// Acceptance
if (!$('.wpcf7-response-output.wpcf7-display-none').hasClass('wpcf7-acceptance-missing')) {
$('.wpcf7-response-output.wpcf7-display-none').addClass('alert alert-danger')
Expand All @@ -29,7 +28,6 @@ jQuery(document).ready(function ($) {
$('label.form-check.form-check-checkbox').removeClass('not-valid checked');
}, false);


$('input#gdpr').change(function () {
if ($(this).is(":checked")) {
$('label.form-check.form-check-checkbox').addClass('checked');
Expand All @@ -46,5 +44,8 @@ jQuery(document).ready(function ($) {
$('button.wpcf7-submit').attr('disabled', 'disabled');
}
});

// New submit spinner since v5.0.0.4
$('.wpcf7-submit').prepend('<div class="ajax-loader"><div class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></div></div>');

}); // jQuery End
}); // jQuery End
29 changes: 15 additions & 14 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,41 @@
* Description: Adds Bootstrap 5 alerts and checkboxes to Contact Form 7. It´s an additional plugin and needs <a href="https://wordpress.org/plugins/contact-form-7/">CF7</a> to work.
* Author: bootScore
* Author URI: https://bootscore.me
* Version: 5.0.0.3
* Version: 5.0.0.4
*/


// Update checker
require 'update/update-checker.php';
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://bootscore.me/wp-content/plugins/bs-contact-form-7-main/update/plugin.json',
__FILE__, //Full path to the main plugin file or functions.php.
'bs-contact-form-7-main'
'https://bootscore.me/wp-content/plugins/bs-contact-form-7-main/update/plugin.json',
__FILE__, //Full path to the main plugin file or functions.php.
'bs-contact-form-7-main'
);


// Register Styles and Scripts
function contact_scripts() {

wp_enqueue_script( 'contactform-script', plugins_url( '/js/contactform-script.js' , __FILE__ ), array( 'jquery' ), '1.0', true );
wp_register_style( 'contactform-style', plugins_url('css/contactform-style.css', __FILE__) );
wp_enqueue_style( 'contactform-style' );
}
wp_enqueue_script( 'contactform-script', plugins_url( '/js/contactform-script.js' , __FILE__ ), array( 'jquery' ), '1.0', true );

wp_register_style( 'contactform-style', plugins_url('css/contactform-style.css', __FILE__) );
wp_enqueue_style( 'contactform-style' );
}

add_action('wp_enqueue_scripts','contact_scripts');

//Adjust contact form 7 radios and checkboxes to match bootstrap 4 custom radio structure.
add_filter('wpcf7_form_elements', function ($content) {
$content = preg_replace('/<label><input type="(checkbox|radio)" name="(.*?)" value="(.*?)" \/><span class="wpcf7-list-item-label">/i', '<label class="form-check form-check-inline form-check-\1"><input type="\1" name="\2" value="\3" class="form-check-input"><span class="wpcf7-list-item-label form-check-label">', $content);
$content = preg_replace('/<label><input type="(checkbox|radio)" name="(.*?)" value="(.*?)" \/><span class="wpcf7-list-item-label">/i', '<label class="form-check form-check-inline form-check-\1"><input type="\1" name="\2" value="\3" class="form-check-input"><span class="wpcf7-list-item-label form-check-label">', $content);

return $content;
return $content;
});


// Disable Contact Form 7 Styles
add_action( 'wp_print_styles', 'wps_deregister_styles', 100 );
function wps_deregister_styles() {
wp_deregister_style( 'contact-form-7' );
wp_deregister_style( 'contact-form-7' );
}

// Remove <p> tags (CF7 5.7)
add_filter('wpcf7_autop_or_not', '__return_false');
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Contributors: The bootScore Contributors

Requires at least: 4.5
Tested up to: 5.8.1
Tested up to: 6.1.1
Requires PHP: 5.6
Stable tag: 5.0.0.3
Stable tag: 5.0.0.4
License: MIT License
License URI: https://github.com/bootscore/bs-contact-form-7/blob/main/LICENSE

Expand All @@ -23,6 +23,11 @@ Use HTML Markup like here https://bootscore.me/plugins/bs-contact-form-7/

== Changelog ==

= 5.0.0.4 - December 11 2022 =

* [BUGFIX ]Add filter to remove autop (CF7 5.7)
* [IMPROVEMENT]Refactored ajax-loader spinner

= 5.0.0.3 - November 03 2021 =

* [IMPROVEMENT] Reformatted all files
Expand Down
6 changes: 3 additions & 3 deletions update/plugin.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name" : "bS Contact Form 7",
"version" : "5.0.0.3",
"download_url" : "https://github.com/bootscore/bs-contact-form-7/archive/refs/heads/main.zip",
"version" : "5.0.0.4",
"download_url" : "https://github.com/bootscore/bs-contact-form-7/releases/download/v5.0.0.4/bs-contact-form-7-main.zip",
"sections" : {
"description" : "Included Update Checker"
"description" : "Added filter to remove autop CF7 5.7 and refactored submit spinner"
}
}

0 comments on commit 16a215e

Please sign in to comment.