Access
3 years ago
Admin
3 months ago
Db
1 year ago
Emails
4 months ago
Forms
3 months ago
Frontend
3 months ago
Helpers
5 months ago
Integrations
3 months ago
Lite
4 months ago
Logger
8 months ago
Migrations
5 months ago
Providers
4 months ago
Requirements
3 months ago
SmartTags
4 months ago
Tasks
11 months ago
API.php
2 years ago
ErrorHandler.php
11 months ago
Loader.php
3 months ago
WPForms.php
8 months ago
Loader.php
974 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPForms; |
| 4 | |
| 5 | /** |
| 6 | * WPForms Class Loader. |
| 7 | * |
| 8 | * @since 1.5.8 |
| 9 | */ |
| 10 | class Loader { |
| 11 | |
| 12 | /** |
| 13 | * Classes to register. |
| 14 | * |
| 15 | * @since 1.5.8 |
| 16 | * |
| 17 | * @var array |
| 18 | */ |
| 19 | private $classes = []; |
| 20 | |
| 21 | /** |
| 22 | * Loader init. |
| 23 | * |
| 24 | * @since 1.5.8 |
| 25 | */ |
| 26 | public function init(): void { |
| 27 | |
| 28 | $this->populate_classes(); |
| 29 | |
| 30 | wpforms()->register_bulk( $this->classes ); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Populate the classes to register. |
| 35 | * |
| 36 | * @since 1.5.8 |
| 37 | */ |
| 38 | protected function populate_classes(): void { |
| 39 | |
| 40 | $this->populate_common(); |
| 41 | $this->populate_frontend(); |
| 42 | $this->populate_admin(); |
| 43 | $this->populate_caches(); |
| 44 | $this->populate_fields(); |
| 45 | $this->populate_forms_overview(); |
| 46 | $this->populate_entries(); |
| 47 | $this->populate_builder(); |
| 48 | $this->populate_db(); |
| 49 | $this->populate_migrations(); |
| 50 | $this->populate_capabilities(); |
| 51 | $this->populate_tasks(); |
| 52 | $this->populate_forms(); |
| 53 | $this->populate_smart_tags(); |
| 54 | $this->populate_logger(); |
| 55 | $this->populate_education(); |
| 56 | $this->populate_robots(); |
| 57 | $this->populate_anti_spam(); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Populate common classes. |
| 62 | * |
| 63 | * @since 1.8.6 |
| 64 | */ |
| 65 | private function populate_common(): void { |
| 66 | |
| 67 | $this->classes[] = [ |
| 68 | 'name' => 'API', |
| 69 | 'id' => 'api', |
| 70 | ]; |
| 71 | |
| 72 | $this->classes[] = [ |
| 73 | 'name' => 'Emails\Summaries', |
| 74 | ]; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Populate the Forms related classes. |
| 79 | * |
| 80 | * @since 1.6.2 |
| 81 | */ |
| 82 | private function populate_forms(): void { |
| 83 | |
| 84 | $this->classes[] = [ |
| 85 | 'name' => 'Forms\Preview', |
| 86 | 'id' => 'preview', |
| 87 | ]; |
| 88 | |
| 89 | $this->classes[] = [ |
| 90 | 'name' => 'Forms\Token', |
| 91 | 'id' => 'token', |
| 92 | ]; |
| 93 | |
| 94 | $this->classes[] = [ |
| 95 | 'name' => 'Forms\Honeypot', |
| 96 | 'id' => 'honeypot', |
| 97 | ]; |
| 98 | |
| 99 | $this->classes[] = [ |
| 100 | 'name' => 'Forms\Akismet', |
| 101 | 'id' => 'akismet', |
| 102 | ]; |
| 103 | |
| 104 | $this->classes[] = [ |
| 105 | 'name' => 'Forms\Submission', |
| 106 | 'id' => 'submission', |
| 107 | 'hook' => false, |
| 108 | 'run' => false, |
| 109 | ]; |
| 110 | |
| 111 | $this->classes[] = [ |
| 112 | 'name' => 'Forms\Locator', |
| 113 | 'id' => 'locator', |
| 114 | ]; |
| 115 | |
| 116 | $this->classes[] = [ |
| 117 | 'name' => 'Forms\IconChoices', |
| 118 | 'id' => 'icon_choices', |
| 119 | ]; |
| 120 | |
| 121 | $this->classes[] = [ |
| 122 | 'name' => 'Forms\AntiSpam', |
| 123 | 'id' => 'anti_spam', |
| 124 | ]; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Populate Frontend-related classes. |
| 129 | * |
| 130 | * @since 1.8.1 |
| 131 | */ |
| 132 | private function populate_frontend(): void { |
| 133 | |
| 134 | $this->classes[] = [ |
| 135 | 'name' => 'Frontend\Address', |
| 136 | 'id' => 'address', |
| 137 | ]; |
| 138 | |
| 139 | $this->classes[] = [ |
| 140 | 'name' => 'Frontend\Amp', |
| 141 | 'id' => 'amp', |
| 142 | ]; |
| 143 | |
| 144 | $this->classes[] = [ |
| 145 | 'name' => 'Frontend\Captcha', |
| 146 | 'id' => 'captcha', |
| 147 | ]; |
| 148 | |
| 149 | $this->classes[] = [ |
| 150 | 'name' => 'Frontend\CSSVars', |
| 151 | 'id' => 'css_vars', |
| 152 | ]; |
| 153 | |
| 154 | $this->classes[] = [ |
| 155 | 'name' => 'Frontend\Classic', |
| 156 | 'id' => 'frontend_classic', |
| 157 | ]; |
| 158 | |
| 159 | $this->classes[] = [ |
| 160 | 'name' => 'Frontend\Modern', |
| 161 | 'id' => 'frontend_modern', |
| 162 | ]; |
| 163 | |
| 164 | $this->classes[] = [ |
| 165 | 'name' => 'Frontend\Frontend', |
| 166 | 'id' => 'frontend', |
| 167 | ]; |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * Populate Admin-related classes. |
| 172 | * |
| 173 | * @since 1.6.0 |
| 174 | */ |
| 175 | private function populate_admin(): void { |
| 176 | |
| 177 | array_push( |
| 178 | $this->classes, |
| 179 | [ |
| 180 | 'name' => 'Admin\Notice', |
| 181 | 'id' => 'notice', |
| 182 | ], |
| 183 | [ |
| 184 | 'name' => 'Admin\Revisions', |
| 185 | 'id' => 'revisions', |
| 186 | 'hook' => 'admin_init', |
| 187 | ], |
| 188 | [ |
| 189 | 'name' => 'Admin\Addons\AddonsCache', |
| 190 | 'id' => 'addons_cache', |
| 191 | ], |
| 192 | [ |
| 193 | 'name' => 'Admin\CoreInfoCache', |
| 194 | 'id' => 'core_info_cache', |
| 195 | ], |
| 196 | [ |
| 197 | 'name' => 'Admin\Addons\Addons', |
| 198 | 'id' => 'addons', |
| 199 | ], |
| 200 | [ |
| 201 | 'name' => 'Admin\AdminBarMenu', |
| 202 | 'hook' => 'init', |
| 203 | ], |
| 204 | [ |
| 205 | 'name' => 'Admin\Notifications\Notifications', |
| 206 | 'id' => 'notifications', |
| 207 | ], |
| 208 | [ |
| 209 | 'name' => 'Admin\Entries\Handler', |
| 210 | 'hook' => 'admin_init', |
| 211 | ], |
| 212 | [ |
| 213 | 'name' => 'Admin\Pages\Templates', |
| 214 | 'id' => 'templates_page', |
| 215 | 'hook' => 'admin_init', |
| 216 | ], |
| 217 | [ |
| 218 | 'name' => 'Admin\Forms\UserTemplates', |
| 219 | 'id' => 'user_templates', |
| 220 | ], |
| 221 | [ |
| 222 | 'name' => 'Admin\Forms\Page', |
| 223 | 'id' => 'forms_overview', |
| 224 | ], |
| 225 | [ |
| 226 | 'name' => 'Admin\Challenge', |
| 227 | 'id' => 'challenge', |
| 228 | ], |
| 229 | [ |
| 230 | 'name' => 'Admin\FormEmbedWizard', |
| 231 | 'hook' => 'admin_init', |
| 232 | 'id' => 'form_embed_wizard', |
| 233 | ], |
| 234 | [ |
| 235 | 'name' => 'Admin\SiteHealth', |
| 236 | 'hook' => 'admin_init', |
| 237 | ], |
| 238 | [ |
| 239 | 'name' => 'Admin\Settings\ModernMarkup', |
| 240 | 'hook' => 'admin_init', |
| 241 | ], |
| 242 | [ |
| 243 | 'name' => 'Admin\Settings\Email', |
| 244 | 'hook' => 'admin_init', |
| 245 | ], |
| 246 | [ |
| 247 | 'name' => 'Admin\Settings\Captcha\Page', |
| 248 | 'hook' => 'admin_init', |
| 249 | ], |
| 250 | [ |
| 251 | 'name' => 'Admin\Settings\Payments', |
| 252 | 'hook' => 'admin_init', |
| 253 | ], |
| 254 | [ |
| 255 | 'name' => 'Admin\Tools\Tools', |
| 256 | 'hook' => 'current_screen', |
| 257 | ], |
| 258 | [ |
| 259 | 'name' => 'Admin\Payments\Payments', |
| 260 | 'hook' => 'init', |
| 261 | ], |
| 262 | [ |
| 263 | 'name' => 'Admin\Payments\Views\Overview\Ajax', |
| 264 | 'hook' => 'admin_init', |
| 265 | 'run' => 'hooks', |
| 266 | 'condition' => wpforms_is_admin_ajax(), |
| 267 | ], |
| 268 | [ |
| 269 | 'name' => 'Admin\Tools\Importers', |
| 270 | 'hook' => 'admin_init', |
| 271 | 'run' => 'load', |
| 272 | 'condition' => wp_doing_ajax(), |
| 273 | ], |
| 274 | [ |
| 275 | 'name' => 'Admin\Pages\Addons', |
| 276 | 'id' => 'addons_page', |
| 277 | ], |
| 278 | [ |
| 279 | 'name' => 'Admin\Pages\ConstantContact', |
| 280 | 'hook' => 'admin_init', |
| 281 | ], |
| 282 | [ |
| 283 | 'name' => 'Admin\Pages\PrivacyCompliance', |
| 284 | 'hook' => 'admin_init', |
| 285 | ], |
| 286 | [ |
| 287 | 'name' => 'Admin\Pages\SugarCalendar', |
| 288 | 'hook' => 'admin_init', |
| 289 | ], |
| 290 | [ |
| 291 | 'name' => 'Admin\Pages\Duplicator', |
| 292 | 'hook' => 'admin_init', |
| 293 | ], |
| 294 | [ |
| 295 | 'name' => 'Admin\Pages\UncannyAutomator', |
| 296 | 'hook' => 'admin_init', |
| 297 | ], |
| 298 | [ |
| 299 | 'name' => 'Forms\Fields\Richtext\EntryViewContent', |
| 300 | ], |
| 301 | [ |
| 302 | 'name' => 'Admin\DashboardWidget', |
| 303 | 'hook' => wpforms()->is_pro() ? 'admin_init' : 'init', |
| 304 | ], |
| 305 | [ |
| 306 | 'name' => 'Emails\Preview', |
| 307 | 'hook' => 'admin_init', |
| 308 | ], |
| 309 | [ |
| 310 | 'name' => 'Admin\Addons\GoogleSheets', |
| 311 | 'hook' => 'admin_init', |
| 312 | ], |
| 313 | [ |
| 314 | 'name' => 'Admin\PluginList', |
| 315 | 'id' => 'plugin_list', |
| 316 | 'hook' => 'admin_init', |
| 317 | ], |
| 318 | [ |
| 319 | 'name' => 'Admin\Splash\SplashScreen', |
| 320 | 'id' => 'splash_screen', |
| 321 | 'hook' => 'admin_init', |
| 322 | ], |
| 323 | [ |
| 324 | 'name' => 'Admin\Splash\SplashCache', |
| 325 | 'id' => 'splash_cache', |
| 326 | 'hook' => 'plugins_loaded', |
| 327 | ], |
| 328 | [ |
| 329 | 'name' => 'Admin\Splash\SplashUpgrader', |
| 330 | 'id' => 'splash_upgrader', |
| 331 | 'hook' => 'plugins_loaded', |
| 332 | ] |
| 333 | ); |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Populate Caches related classes. |
| 338 | * |
| 339 | * @since 1.8.7 |
| 340 | */ |
| 341 | private function populate_caches(): void { |
| 342 | |
| 343 | array_push( |
| 344 | $this->classes, |
| 345 | [ |
| 346 | 'name' => 'LicenseApi\PluginUpdateCache', |
| 347 | 'id' => 'license_api_plugin_update_cache', |
| 348 | ], |
| 349 | [ |
| 350 | 'name' => 'LicenseApi\ValidateKeyCache', |
| 351 | 'id' => 'license_api_validate_key_cache', |
| 352 | ] |
| 353 | ); |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Populate Fields related classes. |
| 358 | * |
| 359 | * @since 1.8.2 |
| 360 | * |
| 361 | * @noinspection ClassConstantCanBeUsedInspection |
| 362 | */ |
| 363 | private function populate_fields(): void { |
| 364 | |
| 365 | // Fancy fields. |
| 366 | $this->classes[] = [ |
| 367 | 'name' => 'Forms\Fields\Address\Field', |
| 368 | 'hook' => 'init', |
| 369 | ]; |
| 370 | |
| 371 | $this->classes[] = [ |
| 372 | 'name' => 'Forms\Fields\Content\Field', |
| 373 | 'hook' => 'init', |
| 374 | ]; |
| 375 | |
| 376 | $this->classes[] = [ |
| 377 | 'name' => 'Forms\Fields\DateTime\Field', |
| 378 | 'hook' => 'init', |
| 379 | ]; |
| 380 | |
| 381 | $this->classes[] = [ |
| 382 | 'name' => 'Forms\Fields\Divider\Field', |
| 383 | 'hook' => 'init', |
| 384 | ]; |
| 385 | |
| 386 | $this->classes[] = [ |
| 387 | 'name' => 'Forms\Fields\FileUpload\Field', |
| 388 | 'hook' => 'init', |
| 389 | ]; |
| 390 | |
| 391 | $this->classes[] = [ |
| 392 | 'name' => 'Forms\Fields\Hidden\Field', |
| 393 | 'hook' => 'init', |
| 394 | ]; |
| 395 | |
| 396 | $this->classes[] = [ |
| 397 | 'name' => 'Forms\Fields\Html\Field', |
| 398 | 'hook' => 'init', |
| 399 | ]; |
| 400 | |
| 401 | $this->classes[] = [ |
| 402 | 'name' => 'Forms\Fields\Phone\Field', |
| 403 | 'hook' => 'init', |
| 404 | ]; |
| 405 | |
| 406 | $this->classes[] = [ |
| 407 | 'name' => 'Forms\Fields\EntryPreview\Field', |
| 408 | 'hook' => 'init', |
| 409 | ]; |
| 410 | |
| 411 | $this->classes[] = [ |
| 412 | 'name' => 'Forms\Fields\Password\Field', |
| 413 | 'hook' => 'init', |
| 414 | ]; |
| 415 | |
| 416 | $this->classes[] = [ |
| 417 | 'name' => 'Forms\Fields\CreditCard\Field', |
| 418 | 'hook' => 'init', |
| 419 | ]; |
| 420 | |
| 421 | $this->classes[] = [ |
| 422 | 'name' => 'Forms\Fields\Rating\Field', |
| 423 | 'hook' => 'init', |
| 424 | ]; |
| 425 | |
| 426 | $this->classes[] = [ |
| 427 | 'name' => 'Forms\Fields\Url\Field', |
| 428 | 'hook' => 'init', |
| 429 | ]; |
| 430 | |
| 431 | $this->classes[] = [ |
| 432 | 'name' => 'Forms\Fields\Richtext\Field', |
| 433 | 'hook' => 'init', |
| 434 | ]; |
| 435 | |
| 436 | $this->classes[] = [ |
| 437 | 'name' => 'Forms\Fields\Pagebreak\Field', |
| 438 | 'hook' => 'init', |
| 439 | ]; |
| 440 | |
| 441 | $this->classes[] = [ |
| 442 | 'name' => 'Forms\Fields\CustomCaptcha\Field', |
| 443 | ]; |
| 444 | |
| 445 | $this->classes[] = [ |
| 446 | 'name' => 'Forms\Fields\Layout\Field', |
| 447 | 'hook' => 'init', |
| 448 | ]; |
| 449 | |
| 450 | $this->classes[] = [ |
| 451 | 'name' => 'Forms\Fields\Layout\Process', |
| 452 | 'hook' => 'init', |
| 453 | ]; |
| 454 | |
| 455 | $this->classes[] = [ |
| 456 | 'name' => 'Forms\Fields\Layout\Notifications', |
| 457 | 'hook' => 'init', |
| 458 | ]; |
| 459 | |
| 460 | $this->classes[] = [ |
| 461 | 'name' => 'Forms\Fields\Repeater\Field', |
| 462 | ]; |
| 463 | |
| 464 | $this->classes[] = [ |
| 465 | 'name' => 'Forms\Fields\Camera\Field', |
| 466 | 'hook' => 'init', |
| 467 | ]; |
| 468 | |
| 469 | $this->classes[] = [ |
| 470 | 'name' => 'Forms\Fields\Repeater\Process', |
| 471 | 'id' => 'repeater_process', |
| 472 | 'hook' => 'init', |
| 473 | ]; |
| 474 | |
| 475 | $this->classes[] = [ |
| 476 | 'name' => 'Forms\Fields\Repeater\Notifications', |
| 477 | 'hook' => 'init', |
| 478 | ]; |
| 479 | |
| 480 | // Payment fields. |
| 481 | $this->classes[] = [ |
| 482 | 'name' => 'Forms\Fields\PaymentCheckbox\Field', |
| 483 | 'hook' => 'init', |
| 484 | ]; |
| 485 | |
| 486 | $this->classes[] = [ |
| 487 | 'name' => 'Forms\Fields\PaymentMultiple\Field', |
| 488 | 'hook' => 'init', |
| 489 | ]; |
| 490 | |
| 491 | $this->classes[] = [ |
| 492 | 'name' => 'Forms\Fields\PaymentSelect\Field', |
| 493 | 'hook' => 'init', |
| 494 | ]; |
| 495 | |
| 496 | $this->classes[] = [ |
| 497 | 'name' => 'Forms\Fields\PaymentSingle\Field', |
| 498 | 'hook' => 'init', |
| 499 | ]; |
| 500 | |
| 501 | $this->classes[] = [ |
| 502 | 'name' => 'Forms\Fields\PaymentTotal\Field', |
| 503 | 'hook' => 'init', |
| 504 | ]; |
| 505 | |
| 506 | // Addon fields in Lite. |
| 507 | $this->classes[] = [ |
| 508 | 'name' => 'Forms\Fields\Addons\Coupon\Field', |
| 509 | 'addon_class' => 'WPFormsCoupons\Field', |
| 510 | 'addon_slug' => 'coupons', |
| 511 | ]; |
| 512 | |
| 513 | $this->classes[] = [ |
| 514 | 'name' => 'Forms\Fields\Addons\Signature\Field', |
| 515 | 'addon_class' => 'WPFormsSignatures\Fields\Signature', |
| 516 | 'addon_slug' => 'signatures', |
| 517 | ]; |
| 518 | |
| 519 | $this->classes[] = [ |
| 520 | 'name' => 'Forms\Fields\Addons\LikertScale\Field', |
| 521 | 'addon_class' => 'WPFormsSurveys\Fields\LikertScale\Field', |
| 522 | 'addon_slug' => 'surveys-polls', |
| 523 | ]; |
| 524 | |
| 525 | $this->classes[] = [ |
| 526 | 'name' => 'Forms\Fields\Addons\NetPromoterScore\Field', |
| 527 | 'addon_class' => 'WPFormsSurveys\Fields\NetPromoterScore\Field', |
| 528 | 'addon_slug' => 'surveys-polls', |
| 529 | ]; |
| 530 | |
| 531 | $this->classes[] = [ |
| 532 | 'name' => 'Forms\Fields\Addons\Map\Field', |
| 533 | 'addon_class' => 'WPFormsGeolocation\Forms\Field', |
| 534 | 'addon_slug' => 'geolocation', |
| 535 | ]; |
| 536 | } |
| 537 | |
| 538 | /** |
| 539 | * Populate Forms Overview admin page related classes. |
| 540 | * |
| 541 | * @since 1.7.5 |
| 542 | */ |
| 543 | private function populate_forms_overview(): void { |
| 544 | |
| 545 | if ( ! wpforms_is_admin_page( 'overview' ) && ! wpforms_is_admin_ajax() ) { |
| 546 | return; |
| 547 | } |
| 548 | |
| 549 | array_push( |
| 550 | $this->classes, |
| 551 | [ |
| 552 | 'name' => 'Admin\Forms\Ajax\Columns', |
| 553 | 'id' => 'forms_columns_ajax', |
| 554 | ], |
| 555 | [ |
| 556 | 'name' => 'Admin\Forms\Ajax\Tags', |
| 557 | 'id' => 'forms_tags_ajax', |
| 558 | ], |
| 559 | [ |
| 560 | 'name' => 'Admin\Forms\Search', |
| 561 | 'id' => 'forms_search', |
| 562 | ], |
| 563 | [ |
| 564 | 'name' => 'Admin\Forms\Views', |
| 565 | 'id' => 'forms_views', |
| 566 | ], |
| 567 | [ |
| 568 | 'name' => 'Admin\Forms\BulkActions', |
| 569 | 'id' => 'forms_bulk_actions', |
| 570 | ], |
| 571 | [ |
| 572 | 'name' => 'Admin\Forms\Tags', |
| 573 | 'id' => 'forms_tags', |
| 574 | ] |
| 575 | ); |
| 576 | } |
| 577 | |
| 578 | /** |
| 579 | * Populate Entries related classes. |
| 580 | * |
| 581 | * @since 1.8.6 |
| 582 | */ |
| 583 | private function populate_entries(): void { |
| 584 | |
| 585 | array_push( |
| 586 | $this->classes, |
| 587 | [ |
| 588 | 'name' => 'Admin\Entries\PageOptions', |
| 589 | 'id' => 'entries_page_options', |
| 590 | ], |
| 591 | [ |
| 592 | 'name' => 'Admin\Entries\Page', |
| 593 | 'id' => 'entries_list_page', |
| 594 | 'hook' => 'admin_init', |
| 595 | ], |
| 596 | [ |
| 597 | 'name' => 'Admin\Entries\Overview\Page', |
| 598 | 'id' => 'entries_overview', |
| 599 | ], |
| 600 | [ |
| 601 | 'name' => 'Admin\Entries\Overview\Ajax', |
| 602 | 'hook' => 'admin_init', |
| 603 | 'run' => 'hooks', |
| 604 | 'condition' => wpforms_is_admin_ajax(), |
| 605 | ], |
| 606 | [ |
| 607 | 'name' => 'Admin\Entries\Ajax\Columns', |
| 608 | 'id' => 'entries_columns_ajax', |
| 609 | ], |
| 610 | [ |
| 611 | 'name' => 'Admin\Entries\Edit', |
| 612 | 'id' => 'entries_edit', |
| 613 | 'hook' => 'admin_init', |
| 614 | ], |
| 615 | [ |
| 616 | 'name' => 'Admin\Entries\Export\Export', |
| 617 | 'id' => 'entries_export', |
| 618 | 'hook' => 'init', |
| 619 | ], |
| 620 | [ |
| 621 | 'name' => 'Admin\Entries\DefaultScreen', |
| 622 | 'hook' => 'admin_init', |
| 623 | ] |
| 624 | ); |
| 625 | } |
| 626 | |
| 627 | /** |
| 628 | * Populate Form Builder related classes. |
| 629 | * |
| 630 | * @since 1.6.8 |
| 631 | */ |
| 632 | private function populate_builder(): void { |
| 633 | |
| 634 | array_push( |
| 635 | $this->classes, |
| 636 | [ |
| 637 | 'name' => 'Admin\Builder\HelpCache', |
| 638 | 'id' => 'builder_help_cache', |
| 639 | ], |
| 640 | [ |
| 641 | 'name' => 'Admin\Builder\Help', |
| 642 | 'id' => 'builder_help', |
| 643 | ], |
| 644 | [ |
| 645 | 'name' => 'Admin\Builder\Shortcuts', |
| 646 | ], |
| 647 | [ |
| 648 | 'name' => 'Admin\Builder\TemplatesCache', |
| 649 | 'id' => 'builder_templates_cache', |
| 650 | ], |
| 651 | [ |
| 652 | 'name' => 'Admin\Builder\TemplateSingleCache', |
| 653 | 'id' => 'builder_template_single', |
| 654 | ], |
| 655 | [ |
| 656 | 'name' => 'Admin\Builder\Templates', |
| 657 | 'id' => 'builder_templates', |
| 658 | ], |
| 659 | [ |
| 660 | 'name' => 'Admin\Builder\AntiSpam', |
| 661 | 'hook' => 'wpforms_builder_init', |
| 662 | ], |
| 663 | [ |
| 664 | 'name' => 'Admin\Builder\Settings\Themes', |
| 665 | 'hook' => 'wpforms_builder_init', |
| 666 | ], |
| 667 | [ |
| 668 | 'name' => 'Admin\Builder\Notifications\Advanced\EmailTemplate', |
| 669 | 'hook' => 'wpforms_builder_init', |
| 670 | ], |
| 671 | [ |
| 672 | 'name' => 'Admin\Builder\ContextMenu', |
| 673 | 'hook' => 'wpforms_builder_init', |
| 674 | 'id' => 'context_menu', |
| 675 | ], |
| 676 | [ |
| 677 | 'name' => 'Admin\Builder\ImageUpload', |
| 678 | 'hook' => 'wpforms_builder_init', |
| 679 | 'id' => 'image_upload', |
| 680 | ], |
| 681 | [ |
| 682 | 'name' => 'Admin\Builder\Notifications\Advanced\Settings', |
| 683 | ], |
| 684 | [ |
| 685 | 'name' => 'Admin\Builder\Notifications\Advanced\FileUploadAttachment', |
| 686 | ], |
| 687 | [ |
| 688 | 'name' => 'Admin\Builder\Notifications\Advanced\EntryCsvAttachment', |
| 689 | ], |
| 690 | [ |
| 691 | 'name' => 'Admin\Builder\Ajax\PanelLoader', |
| 692 | ], |
| 693 | [ |
| 694 | 'name' => 'Admin\Builder\Addons', |
| 695 | ], |
| 696 | [ |
| 697 | 'name' => 'Admin\Builder\Ajax\SaveForm', |
| 698 | 'id' => 'builder_save_form', |
| 699 | ], |
| 700 | [ |
| 701 | 'name' => 'Admin\Builder\Payments', |
| 702 | 'hook' => 'wpforms_builder_init', |
| 703 | 'id' => 'builder_payments', |
| 704 | ] |
| 705 | ); |
| 706 | } |
| 707 | |
| 708 | /** |
| 709 | * Populate database classes. |
| 710 | * |
| 711 | * @since 1.8.2 |
| 712 | */ |
| 713 | private function populate_db(): void { |
| 714 | |
| 715 | array_push( |
| 716 | $this->classes, |
| 717 | [ |
| 718 | 'name' => 'Db\Payments\Payment', |
| 719 | 'id' => 'payment', |
| 720 | 'hook' => false, |
| 721 | 'run' => false, |
| 722 | ], |
| 723 | [ |
| 724 | 'name' => 'Db\Payments\Meta', |
| 725 | 'id' => 'payment_meta', |
| 726 | 'hook' => false, |
| 727 | 'run' => false, |
| 728 | ], |
| 729 | [ |
| 730 | 'name' => 'Db\Payments\Queries', |
| 731 | 'id' => 'payment_queries', |
| 732 | 'hook' => false, |
| 733 | 'run' => false, |
| 734 | ], |
| 735 | [ |
| 736 | 'name' => 'Db\Files\ProtectedFiles', |
| 737 | 'id' => 'protected_files', |
| 738 | 'hook' => false, |
| 739 | 'run' => false, |
| 740 | ], |
| 741 | [ |
| 742 | 'name' => 'Db\Files\Restrictions', |
| 743 | 'id' => 'file_restrictions', |
| 744 | 'hook' => false, |
| 745 | 'run' => false, |
| 746 | ] |
| 747 | ); |
| 748 | } |
| 749 | |
| 750 | /** |
| 751 | * Populate migration classes. |
| 752 | * |
| 753 | * @since 1.5.9 |
| 754 | */ |
| 755 | private function populate_migrations(): void { |
| 756 | |
| 757 | $this->classes[] = [ |
| 758 | 'name' => 'Migrations\Migrations', |
| 759 | 'hook' => 'plugins_loaded', |
| 760 | ]; |
| 761 | } |
| 762 | |
| 763 | /** |
| 764 | * Populate access management (capabilities) classes. |
| 765 | * |
| 766 | * @since 1.5.8 |
| 767 | */ |
| 768 | private function populate_capabilities(): void { |
| 769 | |
| 770 | array_push( |
| 771 | $this->classes, |
| 772 | [ |
| 773 | 'name' => 'Access\Capabilities', |
| 774 | 'id' => 'access', |
| 775 | 'hook' => 'plugins_loaded', |
| 776 | ], |
| 777 | [ |
| 778 | 'name' => 'Access\Integrations', |
| 779 | ], |
| 780 | [ |
| 781 | 'name' => 'Access\File', |
| 782 | 'hook' => 'init', |
| 783 | 'condition' => ! is_admin(), |
| 784 | ], |
| 785 | [ |
| 786 | 'name' => 'Admin\Settings\Access', |
| 787 | 'condition' => is_admin(), |
| 788 | ] |
| 789 | ); |
| 790 | } |
| 791 | |
| 792 | /** |
| 793 | * Populate tasks related classes. |
| 794 | * |
| 795 | * @since 1.5.9 |
| 796 | */ |
| 797 | private function populate_tasks(): void { |
| 798 | |
| 799 | array_push( |
| 800 | $this->classes, |
| 801 | [ |
| 802 | 'name' => 'Tasks\Tasks', |
| 803 | 'id' => 'tasks', |
| 804 | 'hook' => 'init', |
| 805 | ], |
| 806 | [ |
| 807 | 'name' => 'Tasks\Meta', |
| 808 | 'id' => 'tasks_meta', |
| 809 | 'hook' => false, |
| 810 | 'run' => false, |
| 811 | ] |
| 812 | ); |
| 813 | } |
| 814 | |
| 815 | /** |
| 816 | * Populate smart tags loaded classes. |
| 817 | * |
| 818 | * @since 1.6.7 |
| 819 | */ |
| 820 | private function populate_smart_tags(): void { |
| 821 | |
| 822 | $this->classes[] = [ |
| 823 | 'name' => 'SmartTags\SmartTags', |
| 824 | 'id' => 'smart_tags', |
| 825 | 'run' => 'hooks', |
| 826 | ]; |
| 827 | } |
| 828 | |
| 829 | /** |
| 830 | * Populate logger-loaded classes. |
| 831 | * |
| 832 | * @since 1.6.3 |
| 833 | */ |
| 834 | private function populate_logger(): void { |
| 835 | |
| 836 | $this->classes[] = [ |
| 837 | 'name' => 'Logger\Log', |
| 838 | 'id' => 'log', |
| 839 | 'hook' => false, |
| 840 | 'run' => 'hooks', |
| 841 | ]; |
| 842 | } |
| 843 | |
| 844 | /** |
| 845 | * Populate education-related classes. |
| 846 | * |
| 847 | * @since 1.6.6 |
| 848 | */ |
| 849 | private function populate_education(): void { |
| 850 | |
| 851 | // Kill switch. |
| 852 | |
| 853 | /** |
| 854 | * Filters admin education status. |
| 855 | * |
| 856 | * @since 1.6.6 |
| 857 | * |
| 858 | * @param bool $status Current admin education status. |
| 859 | * |
| 860 | * @return bool |
| 861 | */ |
| 862 | if ( ! apply_filters( 'wpforms_admin_education', true ) ) { // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName |
| 863 | return; |
| 864 | } |
| 865 | |
| 866 | // Education core classes. |
| 867 | array_push( |
| 868 | $this->classes, |
| 869 | [ |
| 870 | 'name' => 'Admin\Education\Core', |
| 871 | 'id' => 'education', |
| 872 | ], |
| 873 | [ |
| 874 | 'name' => 'Admin\Education\Fields', |
| 875 | 'id' => 'education_fields', |
| 876 | ], |
| 877 | [ |
| 878 | 'name' => 'Admin\Education\Admin\Settings\SMTP', |
| 879 | 'id' => 'education_smtp_notice', |
| 880 | ], |
| 881 | [ |
| 882 | 'name' => 'Admin\Education\Admin\EditPost', |
| 883 | 'hook' => 'load-edit.php', |
| 884 | ], |
| 885 | [ |
| 886 | 'name' => 'Admin\Education\Admin\EditPost', |
| 887 | 'hook' => 'load-post-new.php', |
| 888 | ], |
| 889 | [ |
| 890 | 'name' => 'Admin\Education\Admin\EditPost', |
| 891 | 'hook' => 'load-post.php', |
| 892 | ], |
| 893 | [ |
| 894 | 'name' => 'Admin\Education\Admin\EditPost', |
| 895 | 'hook' => 'load-site-editor.php', |
| 896 | ], |
| 897 | [ |
| 898 | 'name' => 'Admin\Education\Pointers\Payment', |
| 899 | 'hook' => 'admin_init', |
| 900 | 'priority' => 20, |
| 901 | ] |
| 902 | ); |
| 903 | |
| 904 | // Education features classes. |
| 905 | $features = [ |
| 906 | 'LiteConnect', |
| 907 | 'Builder\Calculations', |
| 908 | 'Builder\Captcha', |
| 909 | 'Builder\Fields', |
| 910 | 'Builder\Settings', |
| 911 | 'Builder\Providers', |
| 912 | 'Builder\Payments', |
| 913 | 'Builder\DidYouKnow', |
| 914 | 'Builder\Geolocation', |
| 915 | 'Builder\Quiz', |
| 916 | 'Builder\Confirmations', |
| 917 | 'Builder\Notifications', |
| 918 | 'Builder\PDF', |
| 919 | 'Admin\DidYouKnow', |
| 920 | 'Admin\Settings\Integrations', |
| 921 | 'Admin\Settings\Geolocation', |
| 922 | 'Admin\NoticeBar', |
| 923 | 'Admin\Entries\Geolocation', |
| 924 | 'Admin\Entries\UserJourney', |
| 925 | ]; |
| 926 | |
| 927 | foreach ( $features as $feature ) { |
| 928 | $this->classes[] = [ |
| 929 | 'name' => 'Admin\Education\\' . $feature, |
| 930 | ]; |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | /** |
| 935 | * Populate robots loaded class. |
| 936 | * |
| 937 | * @since 1.7.0 |
| 938 | */ |
| 939 | private function populate_robots(): void { |
| 940 | |
| 941 | $this->classes[] = [ |
| 942 | 'name' => 'Robots', |
| 943 | 'run' => 'hooks', |
| 944 | ]; |
| 945 | } |
| 946 | |
| 947 | /** |
| 948 | * Populate AntiSpam loaded classes. |
| 949 | * |
| 950 | * @since 1.7.8 |
| 951 | */ |
| 952 | private function populate_anti_spam(): void { |
| 953 | |
| 954 | array_push( |
| 955 | $this->classes, |
| 956 | [ |
| 957 | 'name' => 'AntiSpam\CountryFilter', |
| 958 | 'id' => 'antispam_country_filter', |
| 959 | 'hook' => 'init', |
| 960 | ], |
| 961 | [ |
| 962 | 'name' => 'AntiSpam\KeywordFilter', |
| 963 | 'id' => 'antispam_keyword_filter', |
| 964 | 'hook' => 'init', |
| 965 | ], |
| 966 | [ |
| 967 | 'name' => 'AntiSpam\SpamEntry', |
| 968 | 'id' => 'spam_entry', |
| 969 | 'hook' => 'init', |
| 970 | ] |
| 971 | ); |
| 972 | } |
| 973 | } |
| 974 |