| @@ -8,14 +8,10 @@ | ||
| 8 | 8 | |
| 9 | 9 | namespace SRFM; |
| 10 | 10 | |
| 11 | 11 | use SRFM\Admin\Admin; |
| 12 | -use SRFM\Admin\Analytics; | |
| 13 | -use SRFM\Admin\Notice_Manager; | |
| 14 | -use SRFM\Inc\Abilities\Abilities_Registrar; | |
| 12 | +use SRFM\API\Block_Patterns; | |
| 15 | 13 | use SRFM\Inc\Activator; |
| 16 | -use SRFM\Inc\Admin\Editor_Nudge; | |
| 17 | -use SRFM\Inc\Admin\Html_Form_Detector; | |
| 18 | 14 | use SRFM\Inc\Admin_Ajax; |
| 19 | 15 | use SRFM\Inc\AI_Form_Builder\AI_Auth; |
| 20 | 16 | use SRFM\Inc\AI_Form_Builder\AI_Form_Builder; |
| 21 | 17 | use SRFM\Inc\AI_Form_Builder\AI_Helper; |
| @@ -21,17 +17,12 @@ | ||
| 21 | 17 | use SRFM\Inc\AI_Form_Builder\AI_Helper; |
| 22 | 18 | use SRFM\Inc\AI_Form_Builder\Field_Mapping; |
| 23 | 19 | use SRFM\Inc\Background_Process; |
| 24 | 20 | use SRFM\Inc\Blocks\Register; |
| 25 | -use SRFM\Inc\Compatibility\Multilingual\Multilingual_Manager; | |
| 26 | -use SRFM\Inc\Compatibility\Multilingual\String_Collector; | |
| 27 | -use SRFM\Inc\Compatibility\Themes\Astra; | |
| 28 | 21 | use SRFM\Inc\Create_New_Form; |
| 29 | 22 | use SRFM\Inc\Database\Register as DatabaseRegister; |
| 30 | -use SRFM\Inc\Duplicate_Form; | |
| 31 | 23 | use SRFM\Inc\Events_Scheduler; |
| 32 | 24 | use SRFM\Inc\Export; |
| 33 | -use SRFM\Inc\Form_Restriction; | |
| 34 | 25 | use SRFM\Inc\Form_Submit; |
| 35 | 26 | use SRFM\Inc\Forms_Data; |
| 36 | 27 | use SRFM\Inc\Frontend_Assets; |
| 37 | 28 | use SRFM\Inc\Generate_Form_Markup; |
| @@ -36,22 +27,14 @@ | ||
| 36 | 27 | use SRFM\Inc\Frontend_Assets; |
| 37 | 28 | use SRFM\Inc\Generate_Form_Markup; |
| 38 | 29 | use SRFM\Inc\Global_Settings\Email_Summary; |
| 39 | 30 | use SRFM\Inc\Global_Settings\Global_Settings; |
| 40 | -use SRFM\Inc\Global_Settings\Global_Settings_Defaults; | |
| 41 | 31 | use SRFM\Inc\Gutenberg_Hooks; |
| 42 | 32 | use SRFM\Inc\Helper; |
| 43 | -use SRFM\Inc\Learn; | |
| 44 | -// region: form-migration — Phase P1 foundation. | |
| 45 | -use SRFM\Inc\Migrator\Bootstrap as Migrator_Bootstrap; | |
| 46 | -// endregion: form-migration. | |
| 47 | -use SRFM\Inc\Onboarding; | |
| 48 | 33 | use SRFM\Inc\Page_Builders\Page_Builders; |
| 49 | -use SRFM\Inc\Payments\Payments; | |
| 50 | 34 | use SRFM\Inc\Post_Types; |
| 51 | 35 | use SRFM\Inc\Rest_Api; |
| 52 | 36 | use SRFM\Inc\Single_Form_Settings\Compliance_Settings; |
| 53 | -use SRFM\Inc\Single_Form_Settings\Form_Settings_Api; | |
| 54 | 37 | use SRFM\Inc\Smart_Tags; |
| 55 | 38 | use SRFM\Inc\Updater; |
| 56 | 39 | |
| 57 | 40 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -90,9 +73,9 @@ | ||
| 90 | 73 | add_action( 'plugins_loaded', [ $this, 'load_textdomain' ] ); |
| 91 | 74 | add_action( 'plugins_loaded', [ $this, 'load_plugin' ], 99 ); |
| 92 | 75 | add_action( 'init', [ $this, 'load_classes' ] ); |
| 93 | 76 | add_action( 'admin_init', [ $this, 'activation_redirect' ] ); |
| 94 | - Analytics::get_instance(); | |
| 77 | + | |
| 95 | 78 | /** |
| 96 | 79 | * The code that runs during plugin activation |
| 97 | 80 | */ |
| 98 | 81 | register_activation_hook( |
| @@ -150,24 +133,18 @@ | ||
| 150 | 133 | [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ], |
| 151 | 134 | $class |
| 152 | 135 | ); |
| 153 | 136 | |
| 154 | - if ( ! is_string( $filename ) ) { | |
| 155 | - return; | |
| 156 | - } | |
| 137 | + if ( is_string( $filename ) ) { | |
| 157 | 138 | |
| 158 | - // Check for directory traversal. | |
| 159 | - if ( strpos( $filename, '..' ) !== false ) { | |
| 160 | - return; | |
| 161 | - } | |
| 139 | + $filename = strtolower( $filename ); | |
| 162 | 140 | |
| 163 | - $filename = strtolower( $filename ); | |
| 141 | + $file = SRFM_DIR . $filename . '.php'; | |
| 164 | 142 | |
| 165 | - $file = SRFM_DIR . $filename . '.php'; | |
| 166 | - | |
| 167 | - // if the file is readable, include it. | |
| 168 | - if ( is_readable( $file ) ) { | |
| 169 | - require_once $file; | |
| 143 | + // if the file is readable, include it. | |
| 144 | + if ( is_readable( $file ) ) { | |
| 145 | + require_once $file; | |
| 146 | + } | |
| 170 | 147 | } |
| 171 | 148 | } |
| 172 | 149 | |
| 173 | 150 | /** |
| @@ -218,20 +195,9 @@ | ||
| 218 | 195 | |
| 219 | 196 | Register::get_instance(); |
| 220 | 197 | if ( is_admin() ) { |
| 221 | 198 | Admin::get_instance(); |
| 222 | - // phpcs:ignore /** @phpstan-ignore-next-line */ -- Class is loaded dynamically in WordPress | |
| 223 | - Notice_Manager::get_instance(); | |
| 224 | - Editor_Nudge::get_instance(); | |
| 225 | 199 | } |
| 226 | - // Always instantiate — script enqueue is self-gated by `allow_load()`, | |
| 227 | - // while the REST endpoint for converting HTML forms must register | |
| 228 | - // outside the admin context (REST dispatch runs with `is_admin()` === | |
| 229 | - // false, so admin-only instantiation would 404 the endpoint). | |
| 230 | - Html_Form_Detector::get_instance(); | |
| 231 | - Payments::get_instance(); | |
| 232 | - Duplicate_Form::get_instance(); | |
| 233 | - Learn::get_instance(); | |
| 234 | 200 | } |
| 235 | 201 | |
| 236 | 202 | /** |
| 237 | 203 | * Load Plugin Text Domain. |
| @@ -296,8 +262,9 @@ | ||
| 296 | 262 | */ |
| 297 | 263 | public function load_plugin() { |
| 298 | 264 | Post_Types::get_instance(); |
| 299 | 265 | Form_Submit::get_instance(); |
| 266 | + Block_Patterns::get_instance(); | |
| 300 | 267 | Gutenberg_Hooks::get_instance(); |
| 301 | 268 | Frontend_Assets::get_instance(); |
| 302 | 269 | Helper::get_instance(); |
| 303 | 270 | Activator::get_instance(); |
| @@ -307,12 +274,10 @@ | ||
| 307 | 274 | Smart_Tags::get_instance(); |
| 308 | 275 | Generate_Form_Markup::get_instance(); |
| 309 | 276 | Create_New_Form::get_instance(); |
| 310 | 277 | Global_Settings::get_instance(); |
| 311 | - Global_Settings_Defaults::get_instance(); | |
| 312 | 278 | Email_Summary::get_instance(); |
| 313 | 279 | Compliance_Settings::get_instance(); |
| 314 | - Form_Settings_Api::get_instance(); | |
| 315 | 280 | Events_Scheduler::get_instance(); |
| 316 | 281 | AI_Form_Builder::get_instance(); |
| 317 | 282 | Field_Mapping::get_instance(); |
| 318 | 283 | Background_Process::get_instance(); |
| @@ -317,22 +282,12 @@ | ||
| 317 | 282 | Field_Mapping::get_instance(); |
| 318 | 283 | Background_Process::get_instance(); |
| 319 | 284 | Page_Builders::get_instance(); |
| 320 | 285 | Rest_Api::get_instance(); |
| 321 | - // region: form-migration — Phase P1 foundation. | |
| 322 | - Migrator_Bootstrap::get_instance(); | |
| 323 | - // endregion: form-migration. | |
| 324 | 286 | AI_Helper::get_instance(); |
| 325 | 287 | AI_Auth::get_instance(); |
| 326 | 288 | Updater::get_instance(); |
| 327 | - Onboarding::get_instance(); | |
| 328 | 289 | DatabaseRegister::init(); |
| 329 | - Form_Restriction::get_instance(); | |
| 330 | - Abilities_Registrar::get_instance(); | |
| 331 | - // Initializing Compatibilities. | |
| 332 | - Astra::get_instance(); | |
| 333 | - Multilingual_Manager::get_instance(); | |
| 334 | - String_Collector::get_instance(); | |
| 335 | 290 | |
| 336 | 291 | /** |
| 337 | 292 | * Load core files necessary for the Spectra block. |
| 338 | 293 | * This method is called in the Spectra block loader to ensure core files are loaded during the 'plugins_loaded' action. |