fix(instanda): hygiene pass + v1.1.0 (uninstall, notices, cron, resubmit, theme)
- F-15: uninstall now removes ALL espinstanda_* options and transients (incl. the encrypted password and its self-provisioned key). - F-16: register the "Gravity Forms required" admin notice unconditionally so it is reachable when GF is inactive (gform_loaded never fires then). - F-22: self-heal the daily retention cron on admin_init (matches the schema self-heal). - F-19: re-validate the stored payload via Field_Mapper::validate_payload() before a resubmit (DB-tamper trust boundary). - F-20: increment the retry count on resubmit and dispatch the previously-dead espinstanda_resubmit_success notification event. - F-23: emit the theme's Form-5 date-range JS only on pages that embed a Gravity Form and disconnect the MutationObserver (was observing the DOM subtree forever). - F-24: bump plugin to 1.1.0; add readme.txt changelog documenting the audit fixes and the required ops actions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -189,7 +189,17 @@ function gf_validate_date_range( $validation_result ) {
|
||||
add_action( 'wp_footer', 'gf_date_range_scripts' );
|
||||
|
||||
function gf_date_range_scripts() {
|
||||
if ( ! class_exists( 'GFForms' ) ) {
|
||||
if ( ! class_exists( 'GFForms' ) || is_admin() ) {
|
||||
return;
|
||||
}
|
||||
// Only emit this inline script on requests whose content embeds a Gravity Form -
|
||||
// keeps ~220 lines of JS off every other page. Server-side validation is unaffected.
|
||||
// If the post cannot be inspected, fall back to emitting (safe default).
|
||||
$post = get_post();
|
||||
if ( $post instanceof WP_Post
|
||||
&& ! has_shortcode( (string) $post->post_content, 'gravityform' )
|
||||
&& ! has_block( 'gravityforms/form', $post )
|
||||
&& false === strpos( (string) $post->post_content, 'gform' ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
@@ -410,10 +420,14 @@ function gf_date_range_scripts() {
|
||||
}
|
||||
|
||||
if ( ! attachListeners() ) {
|
||||
var tries = 0;
|
||||
var observer = new MutationObserver( function () {
|
||||
if ( attachListeners() ) observer.disconnect();
|
||||
// Stop once the fields are wired, or after a bounded number of tries, so we
|
||||
// never observe the whole document subtree indefinitely on non-form pages.
|
||||
if ( attachListeners() || ++tries > 20 ) observer.disconnect();
|
||||
} );
|
||||
observer.observe( document.body, { childList: true, subtree: true } );
|
||||
setTimeout( function () { observer.disconnect(); }, 10000 );
|
||||
}
|
||||
|
||||
} )();
|
||||
|
||||
Reference in New Issue
Block a user