PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 1.0.3
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v1.0.3
2.12.6 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 All 96 releases
← All changes | plugin-loader.php +86 -73 0.0.21.0.3 View file →
@@ -7,27 +7,36 @@
7 7 */
8 8
9 9 namespace SRFM;
10 10
11 -use SRFM\Inc\Post_Types;
12 -use SRFM\Inc\Form_Submit;
13 -use SRFM\Inc\Gutenberg_Hooks;
11 +use SRFM\Admin\Admin;
14 12 use SRFM\API\Block_Patterns;
15 -use SRFM\Inc\Forms_Data;
16 -use SRFM\Admin\Admin;
17 -use SRFM\Inc\Blocks\Register;
18 -use SRFM\Inc\Frontend_Assets;
19 -use SRFM\Inc\Helper;
20 13 use SRFM\Inc\Activator;
21 14 use SRFM\Inc\Admin_Ajax;
15 +use SRFM\Inc\AI_Form_Builder\AI_Auth;
16 +use SRFM\Inc\AI_Form_Builder\AI_Form_Builder;
17 +use SRFM\Inc\AI_Form_Builder\AI_Helper;
18 +use SRFM\Inc\AI_Form_Builder\Field_Mapping;
19 +use SRFM\Inc\Background_Process;
20 +use SRFM\Inc\Blocks\Register;
21 +use SRFM\Inc\Create_New_Form;
22 +use SRFM\Inc\Database\Register as DatabaseRegister;
23 +use SRFM\Inc\Events_Scheduler;
22 24 use SRFM\Inc\Export;
23 -use SRFM\Inc\Smart_Tags;
25 +use SRFM\Inc\Form_Submit;
26 +use SRFM\Inc\Forms_Data;
27 +use SRFM\Inc\Frontend_Assets;
24 28 use SRFM\Inc\Generate_Form_Markup;
25 -use SRFM\Inc\Create_New_Form;
29 +use SRFM\Inc\Global_Settings\Email_Summary;
26 30 use SRFM\Inc\Global_Settings\Global_Settings;
27 -use SRFM\Inc\Global_Settings\Email_Summary;
31 +use SRFM\Inc\Gutenberg_Hooks;
32 +use SRFM\Inc\Helper;
33 +use SRFM\Inc\Page_Builders\Page_Builders;
34 +use SRFM\Inc\Post_Types;
35 +use SRFM\Inc\Rest_Api;
28 36 use SRFM\Inc\Single_Form_Settings\Compliance_Settings;
29 -use SRFM\Inc\Events_Scheduler;
37 +use SRFM\Inc\Smart_Tags;
38 +use SRFM\Inc\Updater;
30 39
31 40 if ( ! defined( 'ABSPATH' ) ) {
32 41 exit; // Exit if accessed directly.
33 42 }
@@ -37,9 +46,8 @@
37 46 *
38 47 * @since 0.0.1
39 48 */
40 49 class Plugin_Loader {
41 -
42 50 /**
43 51 * Instance
44 52 *
45 53 * @access private
@@ -48,8 +56,72 @@
48 56 */
49 57 private static $instance = null;
50 58
51 59 /**
60 + * Constructor
61 + *
62 + * @since 0.0.1
63 + */
64 + public function __construct() {
65 + // Load the action scheduler before plugin loads.
66 + require_once SRFM_DIR . 'inc/lib/action-scheduler/action-scheduler.php';
67 +
68 + spl_autoload_register( [ $this, 'autoload' ] );
69 +
70 + add_action( 'plugins_loaded', [ $this, 'load_textdomain' ] );
71 + add_action( 'plugins_loaded', [ $this, 'load_plugin' ], 99 );
72 + add_action( 'init', [ $this, 'load_classes' ] );
73 + add_action( 'admin_init', [ $this, 'activation_redirect' ] );
74 + Post_Types::get_instance();
75 + Form_Submit::get_instance();
76 + Block_Patterns::get_instance();
77 + Gutenberg_Hooks::get_instance();
78 + Register::get_instance();
79 + Frontend_Assets::get_instance();
80 + Helper::get_instance();
81 + Activator::get_instance();
82 + Admin_Ajax::get_instance();
83 + Forms_Data::get_instance();
84 + Export::get_instance();
85 + Smart_Tags::get_instance();
86 + Generate_Form_Markup::get_instance();
87 + Create_New_Form::get_instance();
88 + Global_Settings::get_instance();
89 + Email_Summary::get_instance();
90 + Compliance_Settings::get_instance();
91 + Events_Scheduler::get_instance();
92 + AI_Form_Builder::get_instance();
93 + Field_Mapping::get_instance();
94 + Background_Process::get_instance();
95 + Page_Builders::get_instance();
96 + Rest_Api::get_instance();
97 + AI_Helper::get_instance();
98 + AI_Auth::get_instance();
99 + Updater::get_instance();
100 +
101 + DatabaseRegister::init();
102 +
103 + /**
104 + * The code that runs during plugin activation
105 + */
106 + register_activation_hook(
107 + SRFM_FILE,
108 + static function () {
109 + Activator::activate();
110 + }
111 + );
112 +
113 + register_deactivation_hook(
114 + SRFM_FILE,
115 + static function () {
116 + update_option( '__sureforms_do_redirect', false );
117 + Events_Scheduler::unschedule_events( 'srfm_weekly_scheduled_events' );
118 + Events_Scheduler::unschedule_events( 'srfm_daily_scheduled_action' );
119 + }
120 + );
121 + }
122 +
123 + /**
52 124 * Initiator
53 125 *
54 126 * @since 0.0.1
55 127 * @return object initialized object of class.
@@ -97,66 +169,11 @@
97 169 if ( is_readable( $file ) ) {
98 170 require_once $file;
99 171 }
100 172 }
101 -
102 173 }
103 174
104 175 /**
105 - * Constructor
106 - *
107 - * @since 0.0.1
108 - */
109 - public function __construct() {
110 - // Load the action scheduler before plugin loads.
111 - require_once SRFM_DIR . 'inc/lib/action-scheduler/action-scheduler.php';
112 -
113 - spl_autoload_register( [ $this, 'autoload' ] );
114 -
115 - add_action( 'plugins_loaded', [ $this, 'load_textdomain' ] );
116 - add_action( 'plugins_loaded', [ $this, 'load_plugin' ], 99 );
117 - add_action( 'init', [ $this, 'load_classes' ] );
118 - add_action( 'admin_init', [ $this, 'activation_redirect' ] );
119 - Post_Types::get_instance();
120 - Form_Submit::get_instance();
121 - Block_Patterns::get_instance();
122 - Gutenberg_Hooks::get_instance();
123 - Register::get_instance();
124 - Frontend_Assets::get_instance();
125 - Helper::get_instance();
126 - Activator::get_instance();
127 - Admin_Ajax::get_instance();
128 - Forms_Data::get_instance();
129 - Export::get_instance();
130 - Smart_Tags::get_instance();
131 - Generate_Form_Markup::get_instance();
132 - Create_New_Form::get_instance();
133 - Global_Settings::get_instance();
134 - Email_Summary::get_instance();
135 - Compliance_Settings::get_instance();
136 - Events_Scheduler::get_instance();
137 -
138 - /**
139 - * The code that runs during plugin activation
140 - */
141 - register_activation_hook(
142 - SRFM_FILE,
143 - function () {
144 - Activator::activate();
145 - }
146 - );
147 -
148 - register_deactivation_hook(
149 - SRFM_FILE,
150 - function () {
151 - update_option( '__sureforms_do_redirect', false );
152 - Events_Scheduler::unschedule_events( 'srfm_weekly_scheduled_events' );
153 - Events_Scheduler::unschedule_events( 'srfm_daily_scheduled_action' );
154 - }
155 - );
156 - }
157 -
158 - /**
159 176 * Activation Reset
160 177 *
161 178 * @return void
162 179 * @since 0.0.1
@@ -178,9 +195,9 @@
178 195 ],
179 196 admin_url( 'admin.php' )
180 197 )
181 198 );
182 - exit();
199 + exit;
183 200 }
184 201 }
185 202 }
186 203
@@ -227,9 +244,8 @@
227 244
228 245 /**
229 246 * Language Locale for plugin
230 247 *
231 - * @var string $get_locale The locale to use.
232 248 * Uses get_user_locale()` in WordPress 4.7 or greater,
233 249 * otherwise uses `get_locale()`.
234 250 */
235 251 $locale = apply_filters( 'plugin_locale', $get_locale, 'sureforms' );//phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- wordpress hook
@@ -250,9 +266,8 @@
250 266 load_plugin_textdomain( 'sureforms', false, $lang_dir );
251 267 }
252 268 }
253 269
254 -
255 270 /**
256 271 * Loads plugin files.
257 272 *
258 273 * @since 0.0.1
@@ -273,10 +288,8 @@
273 288 public function load_core_files() {
274 289 include_once SRFM_DIR . 'modules/gutenberg/classes/class-spec-block-loader.php';
275 290 }
276 291 }
277 -
278 -
279 292
280 293 /**
281 294 * Kicking this off by calling 'get_instance()' method
282 295 */