PluginProbe ʕ •ᴥ•ʔ
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.12.3
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.12.3
2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8 0.0.9 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.1.2 1.10.0 1.10.1 1.11.0 1.12.0 1.12.1 1.12.2 1.12.3 1.13.0 1.13.1 1.13.2 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.2 2.6.0
sureforms / inc / updater-callbacks.php
sureforms / inc Last commit date
abilities 3 weeks ago admin 3 months ago ai-form-builder 1 month ago blocks 2 months ago compatibility 3 weeks ago database 3 weeks ago email 3 weeks ago fields 3 weeks ago global-settings 1 month ago lib 1 month ago migrator 2 months ago page-builders 3 weeks ago payments 3 weeks ago single-form-settings 2 months ago traits 2 months ago activator.php 1 year ago admin-ajax.php 2 months ago background-process.php 9 months ago create-new-form.php 3 months ago duplicate-form.php 3 months ago entries.php 3 weeks ago events-scheduler.php 2 years ago export.php 3 months ago field-validation.php 3 weeks ago form-restriction.php 2 months ago form-styling.php 1 month ago form-submit.php 3 weeks ago forms-data.php 5 months ago frontend-assets.php 1 month ago generate-form-markup.php 3 weeks ago gutenberg-hooks.php 3 weeks ago helper.php 3 weeks ago learn.php 4 months ago onboarding.php 2 months ago post-types.php 1 month ago rest-api.php 3 weeks ago smart-tags.php 4 months ago submit-token.php 4 months ago translatable.php 1 month ago updater-callbacks.php 3 weeks ago updater.php 3 weeks ago
updater-callbacks.php
129 lines
1 <?php
2 /**
3 * SureForms Updater Callbacks.
4 * Provides static methods for the updater class.
5 *
6 * @package sureforms.
7 * @since 1.0.0
8 */
9
10 namespace SRFM\Inc;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly.
14 }
15
16 /**
17 * Updater class.
18 *
19 * @since 1.0.0
20 */
21 class Updater_Callbacks {
22 /**
23 * Update callback method to handle the default dynamic block options in the global settings.
24 *
25 * @since 1.0.2
26 * @return void
27 */
28 public static function manage_default_dynamic_options() {
29
30 $previous_options = get_option( 'get_default_dynamic_block_option' );
31
32 if ( ! empty( $previous_options ) && is_array( $previous_options ) ) {
33 update_option( 'srfm_default_dynamic_block_option', $previous_options );
34 delete_option( 'get_default_dynamic_block_option' );
35 }
36 }
37
38 /**
39 * Update callback method to handle the default dynamic block options in the global settings.
40 *
41 * @since 1.0.4
42 * @return void
43 */
44 public static function manage_empty_default_dynamic_options() {
45
46 $previous_options = get_option( 'srfm_default_dynamic_block_option' );
47
48 if ( ! empty( $previous_options ) && is_array( $previous_options ) ) {
49 // get default options values.
50 $default_options = Helper::default_dynamic_block_option();
51 // merge previous options with default options after filtering empty values.
52 $previous_options = array_merge( $default_options, array_filter( $previous_options ) );
53 // update the options.
54 update_option( 'srfm_default_dynamic_block_option', $previous_options );
55 }
56 }
57
58 /**
59 * Update callback method to handle the honeypot option in the global settings.
60 *
61 * @since 1.2.1
62 * @return void
63 */
64 public static function manage_honeypot_option() {
65 // Retrieve the previous general settings options.
66 $general_options = get_option( 'srfm_general_settings_options' );
67 if ( ! empty( $general_options ) && is_array( $general_options ) && isset( $general_options['srfm_honeypot'] ) ) {
68 // Retrieve the security settings options.
69 $security_options = get_option( 'srfm_security_settings_options' );
70 if ( is_array( $security_options ) ) {
71 // Set the honeypot setting in the security options.
72 $security_options['srfm_honeypot'] = $general_options['srfm_honeypot'];
73 // Update the security options.
74 update_option( 'srfm_security_settings_options', $security_options );
75 }
76 // Remove the honeypot setting from the general options and update it.
77 unset( $general_options['srfm_honeypot'] );
78 update_option( 'srfm_general_settings_options', $general_options );
79 }
80 }
81
82 /**
83 * Update callback method to handle the default dynamic block options in the global settings.
84 *
85 * @since 1.2.1
86 * @return void
87 */
88 public static function manage_empty_global_dynamic_options() {
89 $previous_options = get_option( 'srfm_default_dynamic_block_option' );
90 $new_options = Translatable::dynamic_messages();
91
92 if ( ! empty( $previous_options ) && is_array( $previous_options ) ) {
93 // Iterate and update the options.
94 foreach ( $new_options as $key => $value ) {
95 if ( ! isset( $previous_options[ $key ] ) ) {
96 $previous_options[ $key ] = $value;
97 }
98 }
99 } else {
100 $previous_options = Helper::default_dynamic_block_option();
101 }
102
103 // update the options.
104 update_option( 'srfm_default_dynamic_block_option', $previous_options );
105 }
106
107 /**
108 * Clear Elementor's cached per-page asset list so pages built before the Payment
109 * History widget declared its stylesheet dependency pick up the new head-loaded CSS.
110 *
111 * Elementor only recomputes `_elementor_page_assets` on document save, so without
112 * this a page built with the widget in 2.12.2 keeps loading the CSS at render time
113 * (footer → FOUC) after the update until it is re-saved in the editor. Dropping the
114 * meta forces Elementor to regenerate it (including this dependency) on next render.
115 *
116 * @since 2.12.3
117 * @return void
118 */
119 public static function clear_elementor_page_assets_cache() {
120 // Deliberately NOT gated on class_exists( '\Elementor\Plugin' ). Updater::init()
121 // writes the version marker unconditionally, so this callback runs exactly once —
122 // and if Elementor happens not to be loaded in that particular request, the cache
123 // would never be cleared and every pre-existing Elementor page would keep
124 // footer-loading the CSS forever. delete_post_meta_by_key() is a harmless no-op on
125 // sites that never used Elementor, so the guard bought nothing.
126 delete_post_meta_by_key( '_elementor_page_assets' );
127 }
128 }
129