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