# sureforms/2.12.8/inc/updater-callbacks.php

SureForms – Contact Form Builder, AI Forms, Payment Form, Survey &amp; Quiz, version 2.12.8. 129 lines.

- Page: https://pluginprobe.com/plugins/sureforms/2.12.8/code/inc/updater-callbacks.php
- Raw: https://pluginprobe.com/plugins/sureforms/2.12.8/raw/inc/updater-callbacks.php
- Modified: 2026-08-06T02:07:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/sureforms/2.12.8/code/inc/updater-callbacks.php#L10-L20`.

```php
<?php
/**
 * SureForms Updater Callbacks.
 * Provides static methods for the updater class.
 *
 * @package sureforms.
 * @since 1.0.0
 */

namespace SRFM\Inc;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Updater class.
 *
 * @since 1.0.0
 */
class Updater_Callbacks {
	/**
	 * Update callback method to handle the default dynamic block options in the global settings.
	 *
	 * @since 1.0.2
	 * @return void
	 */
	public static function manage_default_dynamic_options() {

		$previous_options = get_option( 'get_default_dynamic_block_option' );

		if ( ! empty( $previous_options ) && is_array( $previous_options ) ) {
			update_option( 'srfm_default_dynamic_block_option', $previous_options );
			delete_option( 'get_default_dynamic_block_option' );
		}
	}

	/**
	 * Update callback method to handle the default dynamic block options in the global settings.
	 *
	 * @since 1.0.4
	 * @return void
	 */
	public static function manage_empty_default_dynamic_options() {

		$previous_options = get_option( 'srfm_default_dynamic_block_option' );

		if ( ! empty( $previous_options ) && is_array( $previous_options ) ) {
			// get default options values.
			$default_options = Helper::default_dynamic_block_option();
			// merge previous options with default options after filtering empty values.
			$previous_options = array_merge( $default_options, array_filter( $previous_options ) );
			// update the options.
			update_option( 'srfm_default_dynamic_block_option', $previous_options );
		}
	}

	/**
	 * Update callback method to handle the honeypot option in the global settings.
	 *
	 * @since 1.2.1
	 * @return void
	 */
	public static function manage_honeypot_option() {
		// Retrieve the previous general settings options.
		$general_options = get_option( 'srfm_general_settings_options' );
		if ( ! empty( $general_options ) && is_array( $general_options ) && isset( $general_options['srfm_honeypot'] ) ) {
			// Retrieve the security settings options.
			$security_options = get_option( 'srfm_security_settings_options' );
			if ( is_array( $security_options ) ) {
				// Set the honeypot setting in the security options.
				$security_options['srfm_honeypot'] = $general_options['srfm_honeypot'];
				// Update the security options.
				update_option( 'srfm_security_settings_options', $security_options );
			}
			// Remove the honeypot setting from the general options and update it.
			unset( $general_options['srfm_honeypot'] );
			update_option( 'srfm_general_settings_options', $general_options );
		}
	}

	/**
	 * Update callback method to handle the default dynamic block options in the global settings.
	 *
	 * @since 1.2.1
	 * @return void
	 */
	public static function manage_empty_global_dynamic_options() {
		$previous_options = get_option( 'srfm_default_dynamic_block_option' );
		$new_options      = Translatable::dynamic_messages();

		if ( ! empty( $previous_options ) && is_array( $previous_options ) ) {
			// Iterate and update the options.
			foreach ( $new_options as $key => $value ) {
				if ( ! isset( $previous_options[ $key ] ) ) {
					$previous_options[ $key ] = $value;
				}
			}
		} else {
			$previous_options = Helper::default_dynamic_block_option();
		}

		// update the options.
		update_option( 'srfm_default_dynamic_block_option', $previous_options );
	}

	/**
	 * Clear Elementor's cached per-page asset list so pages built before the Payment
	 * History widget declared its stylesheet dependency pick up the new head-loaded CSS.
	 *
	 * Elementor only recomputes `_elementor_page_assets` on document save, so without
	 * this a page built with the widget in 2.12.2 keeps loading the CSS at render time
	 * (footer → FOUC) after the update until it is re-saved in the editor. Dropping the
	 * meta forces Elementor to regenerate it (including this dependency) on next render.
	 *
	 * @since 2.12.3
	 * @return void
	 */
	public static function clear_elementor_page_assets_cache() {
		// Deliberately NOT gated on class_exists( '\Elementor\Plugin' ). Updater::init()
		// writes the version marker unconditionally, so this callback runs exactly once —
		// and if Elementor happens not to be loaded in that particular request, the cache
		// would never be cleared and every pre-existing Elementor page would keep
		// footer-loading the CSS forever. delete_post_meta_by_key() is a harmless no-op on
		// sites that never used Elementor, so the guard bought nothing.
		delete_post_meta_by_key( '_elementor_page_assets' );
	}
}

```
